hi sir have an EA that creates horizontal lines and create a button when initiated. If the button is pressed an order will open and all the horizontal line that have created upon inititating the EA will be deleted buy ObjectDelete. For example i pressed the button on 1 min TF it do its job making an order and deleting the lines, its works fine until i change the timeframe after pressing the button it seems to reset the EA and it brings back all the horizontal line that was deleted.
- Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes
- HELP WHO CAN !!!
- Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6.
Of course, it is reloaded on chart change.
What part of “is reloaded” was unclear?
William Roeder #:
What part of “is reloaded” was unclear?
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 } }
mark692 #: thank you sir but I have solved the problem I used this
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.
William Roeder #:
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

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