I've just realised that comparing that data is wrong because iMA will always be using data from the current tick (not from 5 bars ago).
You set the shift in iMA to the bar that you require the data from.
You set the shift in iMA to the bar that you require the data from.
Yes he does. You do not. Read the documentation.
iMA
- Technical Indicators - MQL4 Reference
Yes he does. You do not. Read the documentation.
iMA
- Technical Indicators - MQL4 Reference
Hi Keith,
It doesn't specify the timeframe, you do in the code. The 2nd parameter for iMA.
You did? What part of
shift
[in] Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
was unclear? Why did you ask:
It doesn't specify the timeframe, you do in the code. The 2nd parameter for iMA.
Ahh thanks - I see now :) You guys are right - I should have read this more closely, thanks again. I was confused because timeframe can be anything but I didn't spot the other part.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My algo looks at candlestick data from 5 bars ago and compares it with the moving average using the iMA function and Open[4].
I've just realised that comparing that data is wrong because iMA will always be using data from the current tick (not from 5 bars ago).
I figure I either need to somehow call iMA data that corresponds to the open, or save historical numbers to an array so they can be called?
Is there a simpler way to do this?
Thanks in advance
C