What happens on Bars.Reloaded?

Created at 06 May 2022, 11:02
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!
AN

andi21

Joined 14.12.2016

What happens on Bars.Reloaded?
06 May 2022, 11:02


Dear cTrader Team,

i would like to know what i have to care about / to do, if a reconnect happens.

So there is the following simple scenario:

1. Indicator instantiated through cAlgo

2. Initialize Method is called

3. I call Bars..LoadMoreHistory and set ResultOutput[x] (so just used the Output IndicatorDataSeries)

4. Bars.Reloaded occurs

Now i have the following questions:

1. The Bars.Reloaded does only load the "default" amount of bars, so i need to use LoadMoreHistory() again?

2. The Output-IndicatorDataSeries (and so the corresponding drawings in the indicator-ChartArea) remains, so i do not have to set ResultOutput[0-x] again?

3. The initial calculate through cAlgo from Bar 0 to last bar is called again (the abstract Calculate() method)?

Thank you in advance for your help.

Best regards,

Andi21


@andi21
Replies

amusleh
06 May 2022, 12:29

Hi,

1. On indicators Bars.Reloaded is not called at all on re-connection, because when cTrader re-connects it re-initializes the indicators and your indicator Initialize method will be called, for now Bars.Reloaded is only called on cBots, in future versions we will add some options to control the initialization of indicators on re-connect.

2. No, they don't remain, your indicator will be re-initialized and all previous calculated data will be lost, only interactive drawings remain on chart.

3. Yes, after reconnection your indicator previous instance is destroyed and a new instance is created, then new instance Initialize method is called and after that Calculate method for all bars on the chart.

 


@amusleh