zeeye:
MQL4 how to identify in the past 10 days, MA 20days never below MA 10days? which means the 20-day average line is always above 10-day average line.
Basically these lines:
double MA20, MA10; bool above = true; for (int i=1; i<=10; i++) { MA20 = iMA(_Symbol,PERIOD_D1,20,0,MODE_SMA,PRICE_CLOSE,i); MA10 = iMA(_Symbol,PERIOD_D1,10,0,MODE_SMA,PRICE_CLOSE,i); if (MA20<=MA10) { above = false; break; } }
if, after this, above is still true, then you have it - MA20 has been above MA10 for the past 10 days.
Seng Joo Thio:
Basically these lines:
if, after this, above is still true, then you have it - MA20 has been above MA10 for the past 10 days.
thanks for your help.
![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
MQL4 how to identify in the past 10 days, MA 20days never below MA 10days? which means the 20-day average line is always above 10-day average line.
thanks