OnBarsReloaded is not called on disconnection at off market

Created at 13 Dec 2021, 22:11
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!
EY

eynt

Joined 08.05.2020

OnBarsReloaded is not called on disconnection at off market
13 Dec 2021, 22:11


Hello

Please view the following scenario:

1. Run cBot during trading hours and do not stop it

2. Wait to market to be closed

3; Disconnect and reconnect connection while market is closed

4. Wait to market to be opened

 

 

On this scenario the OnBarsReloaded event will not be called. Not while the market is closed (3) and not while the market is reopen (4).

The fact that OnBarsReloaded is not called despite the disconnection is in my opinion not the wanted behaviour and can cause for problems with the cBot.

For example, after the disconnection the Bars property is reduced to 1000 only. My cBot at the OnBarsReloaded event loads more history since 1000 bars is not enough. However due to the fact that the OnBarsReloaded is not called, when the market is reopened the cBot will continue to run with 1000 bars only which will cause problems.

 

Please address this issue

 


@eynt
Replies

amusleh
14 Dec 2021, 12:50

Hi,

We tried to reproduce this issue but we couldn't.

The Bars Reloaded event was triggered on all of your abovementioned cases.

You can also check the Bars count and load more if you needed:

protected override void OnBar()
{
      if (Bars.Count < 1000)
          Bars.LoadMoreHistory();
}

 


@amusleh