I wrote an indicator to display arrows & alert me whenever the closed candlestick is above 50, 100 and 150 EMA lines.
That worked and I'm happy with the code. But there's an issue occurred:
When I run the indicator, it draw many extra arrows as soon as the conditions are met. So, how may I disable creating more arrows when the first one is draw?
So, how may I disable creating more arrows when the first one is draw?
remember (static) the first arrow direction, until new arrow != new direction.
Thanks Mohammad, but can't understand what you mean
Don't Alert on a signal. Act on a change of signal. MQL4 (in Strategy Tester) - double testing of entry conditions - MQL5 programming forum #1 2017.12.12
What I do in mine is create a variable" int lastWas=5; " Then I check to make sure "lastWas" is not equal to 1 for up arrow or 2 for down arrow. So something like ...
( iClose(NULL,0,1)>iMA( bla bla bla)
&& iClose(NULL,0,2)< iMA( yadda , yadda, yadda)
&& lastWas!=1 //1 is up, 2 is down
As long as lastWas is not equal to 1 , it will paint, else..nothing but clean chart :)