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.
Hi everyone,
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:
https://i.ibb.co/5YfBRw8/090.jpg
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?
remember (static) the first arrow direction, until new arrow != new direction.
Thanks Mohammad, but can't understand what you mean
Most likely there is an error in your code, resulting in multiple arrows instead of only one.
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 ...
if
( iClose(NULL,0,1)>iMA( bla bla bla)
&& iClose(NULL,0,2)< iMA( yadda , yadda, yadda)
&& lastWas!=1 //1 is up, 2 is down
)
{
Buffer1[1]=iLow(NULL,0,1);
lastWas=1;
}
As long as lastWas is not equal to 1 , it will paint, else..nothing but clean chart :)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone,
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:
https://i.ibb.co/5YfBRw8/090.jpg
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?