EA reset when I change time frame
- Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes
- HELP WHO CAN !!!
- Conditionally adding/deleting a horizontal line
What part of “is reloaded” was unclear?
thank you sir but I have solved the problem I used this
bool FirstOnInit = False; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- if(Symbol()==_Symbol && FirstOnInit == False ) { FirstOnInit = True; /////Codes not to reload on change of timeframe } }
You haven't solved anything.
- Symbol() always equals _Symbol.
- Your EA has been reloaded, therefor FirstOnInit will always be reset.
if, and only if, the uninit reason iREASON_CHARTCHANGE, save your state in persistent storage (files, global variables) and check if the symbol has not changed on init.
You haven't solved anything.
- Symbol() always equals _Symbol.
- Your EA has been reloaded, therefor FirstOnInit will always be reset.
if, and only if, the uninit reason iREASON_CHARTCHANGE, save your state in persistent storage (files, global variables) and check if the symbol has not changed on init.
i dont know what happen sir but the horizontal line is not appearing now if i change my timeframe.. hmmm thats weird