What happens on Bars.Reloaded?
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
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