Ah, the negative shift saga continues...
Let's try and put this issue to bed. Looking at this chart we can all see that the magenta line is a current MA aligned with the current price bar. Both the MA value and the price value are truly in step with each other in time.
Attachment:
0.gif [ 19.42 KiB | Viewed 3099 times ]
In the next chart, the MA is shifted by 5 bars. We can see easily enough that the current MA value is offset by 5 (nonexistent) price bars out into the future--meaning the MA value from 5 bars ago is, by definition, at the current price bar.
Attachment:
5.gif [ 19.5 KiB | Viewed 3094 times ]
Looking at our final chart, the MA is shifted by -5 bars. The current MA value is offset by -5 price bars into the past--meaning the current MA value is at 5 bars in the past.
Attachment:
-5.gif [ 19.38 KiB | Viewed 3107 times ]
Pay paticular attention to the last chart. All shift -5 is doing is allowing us to visually compare a 5 bar old price to the current MA. When we restate the comparison like this, the solution is simple--shift our price (Close, Bid, etc.) by 5 and leave the MA current to get the same result! In fact, if we were to black out our chart candles, build a new candle indicator shifted by 5, and overlay the current MA; we would see that the last 5 candles would be missing and we would have the same visual comparison.
If you insist on shifting your indicator, this is possible via:
Hard coding a
custom indicator's mql4 code to shift -5 permanently, or
Setting a
custom indicator's input parameter to shift -5 upon import into SB. Note that this is different than merely selecting iMA in SB where shift -5 will not work.