Missing commands I guess

Created at 06 Apr 2021, 22:46
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!
AN

animate44x

Joined 06.04.2021

Missing commands I guess
06 Apr 2021, 22:46


double OpenPrice = MarketSeries.Open.Last(BarsAgo);
double ClosePrice = MarketSeries.Close.Last(BarsAgo);
double HighPrice = MarketSeries.High.Last(BarsAgo);
double LowPrice = MarketSeries.Low.Last(BarsAgo);

So there is obviously these commands. But I need this data for 1min/4min/15min/1hr candles all in the same code. Is there a way to make them time specific. So like a command that would read me previous hour/15min/4min/1min candle high/low/open/close all in one cAlgo bot.


@animate44x
Replies

amusleh
07 Apr 2021, 09:25

Hi,

Not sure what do you mean by command, but you can access other time frames data from current or other symbols, here is a sample:

Once you got the bars then you can access the open/high/clow/close prices.


@amusleh

animate44x
07 Apr 2021, 11:00

RE:

amusleh said:

Hi,

Not sure what do you mean by command, but you can access other time frames data from current or other symbols, here is a sample:

Once you got the bars then you can access the open/high/clow/close prices.

Thank you, that is what I was looking for. Could not find how to specify timeframe with the bars syntax.


@animate44x

amusleh
07 Apr 2021, 11:10

RE: RE:

animate44x said:

amusleh said:

Hi,

Not sure what do you mean by command, but you can access other time frames data from current or other symbols, here is a sample:

Once you got the bars then you can access the open/high/clow/close prices.

Thank you, that is what I was looking for. Could not find how to specify timeframe with the bars syntax.

The first parameter of MarketData.GetBars method is time frame, its in the sample if you check the code.


@amusleh