# Moving Average and Shift parameter

52

Hi, there is something I don't understand about this parameter. Believe me that I've been searching for a while. The documentation says:

shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

So if I use Shift=0 then is the current bar, isn't it? But that current bar is incomplete so for a EA that makes calculations on bar close (for instance EMAs crossover on bar close) I should always use Shift=1 once I detect that a new bar is created, isn't it?

So, if I'm right with the above stuff then EMA with Shift=0 is not reliable as we don't know what will be the final shape of the bar. Who would use Shift=0 ? What is the utility?

3243

4 example, people who don't care 4 a close bar

52

qjol:

4 example, people who don't care 4 a close bar

But in my case, suppose I want to check the crossover on the close of the bar. I have to use Shift=1, right?

5394

fonx:

Hi, there is something I don't understand about this parameter. Believe me that I've been searching for a while. The documentation says:

shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

So if I use Shift=0 then is the current bar, isn't it? But that current bar is incomplete so for a EA that makes calculations on bar close (for instance EMAs crossover on bar close) I should always use Shift=1 once I detect that a new bar is created, isn't it?

So, if I'm right with the above stuff then EMA with Shift=0 is not reliable as we don't know what will be the final shape of the bar. Who would use Shift=0 ? What is the utility?

• The way I understand it.
• Shift=0 would base the ma_ calculations on the last_price.
• The last price is namely the last Bid because mt4 data is Bid data.
• People who would use that are people who care more for current price movements.
• However this means that ma keep changing during the bar.
• Also means that someone cannot look back and get the entire story.
• An ma cross-over which happened during the bar may-not show up in history.
• If someone understands the above and proceed anyway than that's fine.
• Otherwise, using Shift=0 is un-reliable from what they expect.

5394

fonx: But in my case, suppose I want to check the crossover on the close of the bar. I have to use Shift=1, right?
• I generally use Open_Prices and Shift=0.
• Because the Open Price doesn't change during the life of the Bar.
• Its almost the same as using Close Price and Shift=1
• They aren't exactly the same ... for example Weekend_Gaps.
• Choose which ever applies best to your system and methods.

2584

fonx:

Who would use Shift=0 ? What is the utility?

I would use it when I want to use values calculated by the indicator in real time on live prices.
52

Thanks for the answers guys, very appreciated. You've solved my question :)