shift in atr ?

Created at 11 Jul 2014, 10:27
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
RO

RootFX

Joined 09.09.2013

shift in atr ?
11 Jul 2014, 10:27


hi 

how set shift in cbot 

like this 

int shift = 0;

double atr=iATR(NULL,60,14,shift);

i try this in calgo but how set shift


        [Parameter("AtrPeriod", DefaultValue = "Hour")]
        public TimeFrame AtrPeriod { get; set; }

 protected override void OnStart()
        {
var atrperiod = MarketData.GetSeries(AtrPeriod);

atr = Indicators.AverageTrueRange(atrperiod, 14, MovingAverageType.Simple);


}

 

and this in moving 

double mov=iMA(NULL,60,55,ma_shift+3,0,0,shift+2);

i found this 

/forum/calgo-reference-samples/733

but how it's work in cbot .?

 


@RootFX
Replies

Spotware
11 Jul 2014, 11:55

You can shift the index:

        protected override void OnTick()
        {
            var index = MarketSeries.Close.Count - 1;
            var shift = 2;
            var shiftedValue = atr.Result[index - shift];
        }

 


@Spotware

RootFX
12 Jul 2014, 23:19

thank you 

i will try this in open market 

 


@RootFX