Is "Bars.Timeframe" synonymous with "Chart.Timeframe"?

Created at 11 May 2023, 03:37
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!
FI

firemyst

Joined 26.03.2019

Is "Bars.Timeframe" synonymous with "Chart.Timeframe"?
11 May 2023, 03:37


Hi all:

are these two statements always equivalent?

Bars b = MarketData.GetBars(Chart.TimeFrame, Symbol.Name);

and
Bars b = MarketData.GetBars(Bars.TimeFrame, Symbol.Name);

 

The API seems to indicate they are. If you look at the API for Bars:

it says the "Bars.Last" property, "Gets the last bar in the chart.". So it reads from whatever the chart is set to.

The API for Chart.Timeframe:

says it "Gets the chart Bar objects." So it reads from whatever the chart is set to as well.

So are they essentially equivalent?

If not, when would those two statements return different bar data?

Thank you.

 


@firemyst
Replies