This will shift a 5 period MA forward by 5 periods.
shift = 5;
ma = iMA(NULL,0,5,shift,MODE_EMA,PRICE_CLOSE ,0);
and for -5 periods,
shift = -5;
ma = iMA(NULL,0,5,shift,MODE_EMA,PRICE_CLOSE ,0);
Thanks 4xCoder
if I understand you this means I can add something like:
ema = iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE ,0);
emaprevious = iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE ,1);
emashift = shift = 5;
iMA(NULL,0,5,shift,MODE_EMA,PRICE_CLOSE ,0);
emashiftprevious = shift = 5;
ima = iMA(NULL,0,5,shift,MODE_EMA,PRICE_CLOSE ,1);
to define them so that I can write an alert setup ?

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
Can someone please advise me on the following ?
When using a moving average in an EA it can be described as iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE ,0)
How does one alter this code to give the same moving average but shifted either forward or backwards ?
Many thanks for your kind assistance.