I am new to mql4 coding. This is my first indicator using arrays and I'm having problems with the object delete function, its not removing indicator after removing from the chart?
I have looked everywhere for a solution I can't see how this is not working, does anyone know what needs changing below?
Thanks in advance
It is bad practice to use ObjectsDeleteAll, as objects not drawn by the indicator will also be deleted.
I normally name my objects beginning with WindowExpertName(), then loop through the objects and delete those that begin with it in deinit
Check for an array out of range error as this can stop the indicator without executing deinit.
if (iMA (Symbol(),period[x], MA_Period,0,MA_method,PRICE_CLOSE,1) > iMA (Symbol(),period[x], MA_Period,0,MA_method,PRICE_CLOSE,2))
That is probably it.
period only has 5 elements, you are trying to access 9
To add comments, please log in or register