TimeFrame Minutes

Created at 20 Aug 2020, 16:13
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!
bienve.pf's avatar

bienve.pf

Joined 19.09.2018

TimeFrame Minutes
20 Aug 2020, 16:13


Is there a property / quick method to know how many minutes a TimeFrame has?

I right now I do it in the following way:

var minutes = (Bars [1] .OpenTime - Bars [0] .OpenTime) .TotalMinutes;

// this would be ideal
var m = TimeFrame.Minutes;


@bienve.pf
Replies

PanagiotisCharalampous
21 Aug 2020, 08:22

Hi bienve.pf,

There is no other way at the moment. Your solution should work fine.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

genappsforex
21 Aug 2020, 12:09

RE:

bienve.pf said:

Is there a property / quick method to know how many minutes a TimeFrame has?

I right now I do it in the following way:

var minutes = (Bars [1] .OpenTime - Bars [0] .OpenTime) .TotalMinutes;

// this would be ideal
var m = TimeFrame.Minutes;

this will work on 99.999% of the times, But if it is mission critical .....

On smaller timeframes (e.g. M1) there is not always a tick in every timeframe
=thus=> not a OnBar on every timeframe
=thus=> Bars [1] .OpenTime - Bars [0] .OpenTime could be 2 or more minutes apart!!!

 

Therefor a TimeFrame Native function like TotalSeconds() would be nice!


@genappsforex