Index

Created at 13 Feb 2019, 07:04
IN

incdpr

Joined 13.02.2019

Index
13 Feb 2019, 07:04


//Accessing historical O-H-L-C prices from Robots
int index = MarketSeries.Close.Count-1;
double close = MarketSeries.Close[index];
double high = MarketSeries.High[index];
double low = MarketSeries.Low[index];
double open = MarketSeries.Open[index];

Good day. Can you please tell me this is the current candle in the OnBar() Method?

MarketSeries.Close.Count-1;

 

Is this the last candle formed?

       protected override void OnBar()
        {
            
            
                index = MarketSeries.Close.Count - 2;

                dataLast = MarketSeries.OpenTime[index];
                open = MarketSeries.Open[index];
                high = MarketSeries.High[index];
                low = MarketSeries.Low[index];
                close = MarketSeries.Close[index];
                volume = MarketSeries.TickVolume[index];

Thank You


@incdpr
Replies

PanagiotisCharalampous
13 Feb 2019, 10:35

Hi incdpr,

Thanks for posting in our forum. To access the current value of any series you can use LastValue e.g.

MarketSeries.Close.LastValue

To access previous values you can use Last(x) where x indicates the number of bars you want to move backwards e.g.

MarketSeries.Close.Last(1)

for the previous bar value.

Let me know if this helps.

Best Regards,

Panagiotis


@PanagiotisCharalampous

incdpr
13 Feb 2019, 15:37

RE:

Panagiotis Charalampous said:

Hi incdpr,

Thanks for posting in our forum. To access the current value of any series you can use LastValue e.g.

MarketSeries.Close.LastValue

To access previous values you can use Last(x) where x indicates the number of bars you want to move backwards e.g.

MarketSeries.Close.Last(1)

for the previous bar value.

Let me know if this helps.

Best Regards,

Panagiotis

Yes it is. I'll try.


@incdpr