Using Costom Indicator in a cBot

Created at 09 Dec 2017, 18:52
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!
CH

christophdaube

Joined 09.12.2017

Using Costom Indicator in a cBot
09 Dec 2017, 18:52


Hello,

I try to use an self written indicator in my cbot. The initalization is working:

"RF = Indicators.GetIndicator<RaisingFalling>(MACDLC, MACDSC, MACDP, BOLMAType, BOLSD, BOLP, MAX_GEWINN_FAKTOR);"  in my cbot is calling the Initialize() Methode in my indicator correctly. 

But the main methode "public override void Calculate(int index)" seems to be never called. All the variables have always the inital-values and never changes. When I debug my code, the nested indicators I use in my indicator are changing, but no other variables. The wierd thing is that when I use just the indicator everthing seems to work just fine, the methods are all in use.

Does anyone know where the problem coud be?

best regards


@christophdaube
Replies

ap11
11 Dec 2017, 11:03

RE:

Hi Christophdaube,

Do you call RF.Result[...] or RF.Result.LastValue in your cBot?

Referenced indicator using lazy evaluation. Calculate method will not be called untill cBot requests output data series value. But Initialize method is called when you creating indicator instance in cBot.
Please check if this is the issue here.

Kind Regards,
Andrey

 

christophdaube said:

Hello,

I try to use an self written indicator in my cbot. The initalization is working:

"RF = Indicators.GetIndicator<RaisingFalling>(MACDLC, MACDSC, MACDP, BOLMAType, BOLSD, BOLP, MAX_GEWINN_FAKTOR);"  in my cbot is calling the Initialize() Methode in my indicator correctly. 

But the main methode "public override void Calculate(int index)" seems to be never called. All the variables have always the inital-values and never changes. When I debug my code, the nested indicators I use in my indicator are changing, but no other variables. The wierd thing is that when I use just the indicator everthing seems to work just fine, the methods are all in use.

Does anyone know where the problem coud be?

best regards

 


@ap11

christophdaube
11 Dec 2017, 11:22

Hi Andrey,

this was the Issue. Already fixed it. Thanks!


@christophdaube