Here's the EA, put it on EURUSD, GBPUSD and any other pair. let it run for a while and youwill see the bug!
Files:
smallea_1.mq4
2 kb
alkravi:
You should add a sleep to your loop or it runs at max speed the CPU will allow and may freeze up your Terminal. It seems to update OK for the same symbol but different timeframe, for example, EURUSD M15
Here's the EA, put it on EURUSD, GBPUSD and any other pair. let it run for a while and youwill see the bug!
I added Sleep right after uploading and uploaded again, it was a mistake. Please try again if you didn't add sleep yourself.
Here's what I need - two opened windows - GBPUSD and EURUSD on H1 and this EA running on one of them (it's not the whole code ofcourse). Can you confirm the bug?
alkravi:
Can you confirm the bug?
Yes. Unless we are both doing something silly . . . ;-) I always reserve the right to have done something silly.
Your code with my small modifications . . .
extern string Pair_0 = "EURUSD"; extern string Pair_1 = "GBPUSD"; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { while (1==1) { Comment(Pair_0, " Macd1: ", DoubleToStr(iMACD(Pair_0,PERIOD_H1,1,25,1,PRICE_CLOSE,MODE_MAIN,0), 5), " ", Pair_1, " Macd2: ", DoubleToStr(iMACD(Pair_1,PERIOD_H1,1,25,1,PRICE_CLOSE,MODE_MAIN,0), 5) ); Sleep(200); } return(0); } //+------------------------------------------------------------------+
Thanks for your help!
alkravi:
Thanks for your help!
If you get rid of the loop it works as it should . . . Thanks for your help!
It also works with the loop and a longer sleep and the addition of RefreshRates() . . .
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.
Any ideas?
PS Sorry for my broken English.