if (MA(x) < 0)
if (MA(x) > 0)
R_Jang:
Let's say when i started EA price is on bar 3 (i don't want to open an order on bar 3) first i want to check if it's bar 1 and then open an order...
Try something like...
calc two variables using shift 0 & 1 to get the current mva value [0], and the prev mva value [1].
if Open[0] > yourmva_current && Open[1] <= yourmva_prev
then it's the first bar above.
if Open[0] < yourmva_current && Open[1] >= yourmva_prev
it's the first bar below your mva.
![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
Is there way to find if it's a first bar above/below the MA (first bar's open above/below the MA)?
Thanks
Example