I've tried the following.
if(i==1 && SoundAlert)Alert(_Symbol, _Period," Sell Alert");
if(i==0 && SoundAlert)Alert(_Symbol, _Period," Sell Alert");
i = 0 in the for loop
alerting with every tick.
Then my second query: I'd also like to know
as with example above, if price closes above an MA and stays there, but
after x bars closes again below to give me an alert. What I'd like
help with is how do I specify the x bars back when price closed again
below the MA. I need to specify how many bars back that price was
above the MA and then when the current bar closed below the MA should
give me an alert.
Where do I start, what would I need to look at?
thinking the logic is something like follows:
if((Close [i+1] && Close[i+2]&&Close[i+3]) > MA && Close[i] <MA)
but instead like this
line with the RED, I need to be able to select in the input how many
bars back to look and it should adjust this logic accordingly. ie.:
if(Close[range selected]>MA && Close[i]<MA)
Any help and direction is appreciated.