Comments that do not relate to this topic, have been moved to "Off Topic Posts".
No need “to let the EA start counting.” Just loop through the bars until you find “the price crosses a moving average.” The index where you find it is the count.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hi all,
I've created several EA's based upon a strategy that works with almost all currency pairs by changing minor settings in the code. I'm looking to create a new strategy but my coding skills got his limitation and would need some help.
What I would like to code is the following.
When the price crosses a moving average, the EA should start counting the pips distance vs the moving average of the last cross. So you could have for example 200 pips since the last cross of the price of that moving average.
I would like to use that data to define a new strategy but I don't know how to let the EA start counting. I can use iHighest, Close Open and everything but what I can't is to let the EA start counting the pips distance
with my skills I should use Close[50] for example but as the price moves forward, we can't determine which will be the last bar that crossed that moving average.
Hoping this is clear
Thanks and kr,
Benoit