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
I'm new with mql4 and coding as a whole so can any of the experts please help me with the following two dilemmas.
I need to add an arrow and alert when price breaches an MA from above, but it should repaint as when the price does not close below the MA to disappear again.
It draws the arrow and alert for candle 0 when it breaches, but the alert goes of for the whole time the bar is open.
How can I make it to only alert just when the arrow is drawn, and not with every tick.
I've tried the following.
But keeps 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?
I'm thinking the logic is something like follows:
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.