Maxwell Ogunsanya:
The code is supposed to perform the calculation shown in the my mql4 version on every bar. However, it shows the same value as far back as I try to go.
How do I make sure that the calculation is performed on each bar or if there is a more efficient way to code this I would appreciate that highly. :)
double lowestPrice = Low[iLowest(Symbol(),0,MODE_LOW,50,i)];
The other lines should be modified in the same way.

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 am trying to convert an indicator I found on tradingview to MQL4:
==============================================
BullTrend = (close - lowest(low, 50)) / atr(5)
BearTrend = (highest(high, 50) - close) / atr(5)
BearTrend2= -1*BearTrend
Trend = BullTrend - BearTrend
==============================================
The code is supposed to perform the calculation shown in the my mql4 version on every bar. However, it shows the same value as far back as I try to go.
How do I make sure that the calculation is performed on each bar or if there is a more efficient way to code this I would appreciate that highly. :)