VERY VERY Stupid error!!!
-
Hello Fx dreema,
I want to report a problem. Please follow these steps.
-
go to this link
https://fxdreema.com/shared/AA0jy8Usb -
download into your MT4 terminal for back testing.
-
Press start
Now appears the problem. It will show a text "error" and indeed it is an error because the first tick is NOT above "first_level_up" (this is a variable.)
But the funny thing is that if you stop the back testing and press again START, now, the second time, is will NOT appear this error.
-
-
Try this EA:
bool printed = false; void OnTick() { if (printed == true) {ExpertRemove(); return;} printed = true; Print("Value 1 = " + iClose(Symbol(), PERIOD_D1, 0)); Print("Value 2 = " + iClose(Symbol(), PERIOD_D1, 0)); Print("Value 3 = " + iClose(Symbol(), PERIOD_D1, 0)); Print("Value 4 = " + iClose(Symbol(), PERIOD_D1, 0)); Print("Value 5 = " + iClose(Symbol(), PERIOD_D1, 0)); }- Close MetaTrader
- Open MetaTrader
- Run the EA in the Tester using timeframe that is NOT Daily
The result is like this: http://prntscr.com/e8pnvm
-
If I make it like this, it fixes the problem also for other timeframes:
bool printed = false; void OnInit() { iClose(Symbol(), PERIOD_M1, 0); iClose(Symbol(), PERIOD_M1, 0); iClose(Symbol(), PERIOD_M5, 0); iClose(Symbol(), PERIOD_M5, 0); iClose(Symbol(), PERIOD_M15, 0); iClose(Symbol(), PERIOD_M15, 0); iClose(Symbol(), PERIOD_M30, 0); iClose(Symbol(), PERIOD_M30, 0); iClose(Symbol(), PERIOD_H1, 0); iClose(Symbol(), PERIOD_H1, 0); iClose(Symbol(), PERIOD_H4, 0); iClose(Symbol(), PERIOD_H4, 0); iClose(Symbol(), PERIOD_D1, 0); iClose(Symbol(), PERIOD_D1, 0); } void OnTick() { if (printed == true) {ExpertRemove(); return;} printed = true; Print("Value 1 = " + iClose(Symbol(), PERIOD_D1, 0)); Print("Value 2 = " + iClose(Symbol(), PERIOD_D1, 0)); Print("Value 3 = " + iClose(Symbol(), PERIOD_D1, 0)); Print("Value 4 = " + iClose(Symbol(), PERIOD_D1, 0)); Print("Value 5 = " + iClose(Symbol(), PERIOD_D1, 0)); }... but it makes the EA to start slow and probably uses more resources, because it loads all timeframes. So I don't want to use this fix in fxDreema