Retrieve bars beyond LastValue?

Created at 04 Nov 2013, 22:36
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!
Hyperloop's avatar

Hyperloop

Joined 23.10.2013

Retrieve bars beyond LastValue?
04 Nov 2013, 22:36


I know we can use MarketSeries.Close.LastValue to obtain the close value last bar, but how do we get the value of the close, say 5 bars ago?


@Hyperloop
Replies

Cerunnos
05 Nov 2013, 08:29

RE:

Hyperloop said:

I know we can use MarketSeries.Close.LastValue to obtain the close value last bar, but how do we get the value of the close, say 5 bars ago?

Index = MarketSeries.Close.Count;
... MarketSeries.Close[Index-5]

 


@Cerunnos

Hyperloop
05 Nov 2013, 23:51

Perfect, thank you! :)


@Hyperloop

Spotware
02 Jan 2014, 10:17

RE: RE:

Now you can access it easier like this:

MarketSeries.Close.Last(5);

/api/reference/dataseries/last-870a

 

Cerunnos said:

Hyperloop said:

I know we can use MarketSeries.Close.LastValue to obtain the close value last bar, but how do we get the value of the close, say 5 bars ago?

Index = MarketSeries.Close.Count;
... MarketSeries.Close[Index-5]

 

 


@Spotware