OnBar() not fired at specified interval

Created at 02 Oct 2024, 01:22
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!
YS

ys2310

Joined 03.12.2021

OnBar() not fired at specified interval
02 Oct 2024, 01:22


I'm working on JP225 with ICMarkets.

Noticed OnBar() event not firing at time it supposed to fire. 

For example, with 5 minute time frame, time after "2018-06-20 19:00" is “2018-06-20 19:10” which makes me wonder why there is no

“2018-06-20 19:05”. 

Also, even when OnBar() event fires, it's not happens at 00 second sharp. Sometime with 10 seconds delay.

Can anyone explain why this happens and is this the design or a bug?


@ys2310
Replies

PanagiotisCharalampous
02 Oct 2024, 05:29

Hi there,

Bars are not time based but tick based. Therefore the OnBar() method will be triggered when the new tick for that time range arrives. So if the tick comes 10 seconds after the previous bar was supposed to be closed, the OnBar method will be triggered with 10 seconds delay. If no tick arrives within that timeframe, then no bar will be formed.

Best regards,

Panagiotis 


@PanagiotisCharalampous

ys2310
02 Oct 2024, 05:33

RE: OnBar() not fired at specified interval

PanagiotisCharalampous said: 

Hi there,

Bars are not time based but tick based. Therefore the OnBar() method will be triggered when the new tick for that time range arrives. So if the tick comes 10 seconds after the previous bar was supposed to be closed, the OnBar method will be triggered with 10 seconds delay. If no tick arrives within that timeframe, then no bar will be formed.

Best regards,

Panagiotis 

Hello Panagiotis,

Thank you for your reply. I'm clear now.

What if I want to every 5 minutes event?


@ys2310

PanagiotisCharalampous
02 Oct 2024, 06:03

RE: RE: OnBar() not fired at specified interval

ys2310 said: 

PanagiotisCharalampous said: 

Hi there,

Bars are not time based but tick based. Therefore the OnBar() method will be triggered when the new tick for that time range arrives. So if the tick comes 10 seconds after the previous bar was supposed to be closed, the OnBar method will be triggered with 10 seconds delay. If no tick arrives within that timeframe, then no bar will be formed.

Best regards,

Panagiotis 

Hello Panagiotis,

Thank you for your reply. I'm clear now.

What if I want to every 5 minutes event?

In this case it is better to use a Timer.


@PanagiotisCharalampous