Strange problem with EA getting indicator data! Need help!

Hello everyone!

I’m writing an EA now for MT4, and here’s a very strange bug i found.

Here are lines of code it has (not exact, but you get the idea);

while (condition)

{Comment(“Macd1:”, iMACD(Pair_0,PERIOD_H1,1,25,1,PRICE_CLOSE,MODE_MAIN,0), “Macd2:”, iMACD(Pair_1,PERIOD_H1,1,25,1,PRICE_CLOSE,MODE_MAIN,0) );}

Here’s what happens:

  1. When I put my EA on window with graph of Pair0 it shows both MACD values of Pair0 and Pair1, time passes, MACD of Pair1 shows right, but MACD of Pair0 freezes, it shows only the first value.

  2. When I put my EA on window with graph of Pair1 it shows both MACD values of Pair0 and Pair1, time passes, MACD of Pair0 shows right, but MACD of Pair1 freezes, it shows only the first value.

  3. When I put my EA on window with graph of Pair3 it shows both MACD values of Pair0 and Pair1, time passes, everything is OK and values are up to date.

I use MT4 build 445.
Here’s the EA, put it on EURUSD, GBPUSD and any other pair. let it run for a while and youwill see the bug! Set timeframe to H1.

Any ideas?

PS Sorry for my broken English.

Try adding “RefreshRates();” before Comment()