How to get TimeFrame value?

Created at 02 Nov 2015, 20:38
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!
CB

cbotalerts

Joined 02.11.2015

How to get TimeFrame value?
02 Nov 2015, 20:38


Hi,

I need to get value of TimeFrame from current instance, which I later use in labels of orders and positions.


@cbotalerts
Replies

Spotware
02 Nov 2015, 22:56

Dear Trader,

Please have a look at the MarketSeries section of our API Reference and at the following code snippet:

//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];

We hope this helps you.


@Spotware

cbotalerts
03 Nov 2015, 08:44

Not exactly...

For example, the instance is initiated with timeframe of 10min. I need the robot to identify this exact timeframe (10min) and return a string value.


@cbotalerts

Daedalusx086
03 Nov 2015, 09:59

MarketSeries.TimeFrame.ToString()

Should be what you're after.


@Daedalusx086