Indicator instance problem. [Solved]

Created at 16 Feb 2024, 09: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!
CP

cpxiom

Joined 07.02.2024

Indicator instance problem. [Solved]
16 Feb 2024, 09:02


Hi everyone, I discovered cTrader recently and I am very happy with it, so I'm a new user but I managed to build some of my indicators, and a cBot that references one of them.

I run two instances of this cBot on a demo account for forward testing purposes (Renko charts, Mac version). After starting the instances, everything works as expected for some hours, but then it's like getting multiple entry signals when there are none. This happens around the time when in the log we can see that the indicator is unloaded then loaded successfully. Like a refresh maybe. It's working fine for some hours, but then again multiple signals start to happen.

In the image, below, we can see the correct signals, the only ones that should be happening. I mention also, that the indicator on its own, works well, without this error. Only when referenced, in the cBot, these signals happen, resulting in multiple unintended orders. I don't know if this error is because the indicator is unloaded, loaded, but this phenomena stops for a while then starts again, as you can see the arrows on the chart. 

The bot has buy sell identifiers(label), so the instances don't interfere. The indicator works with double.NaN, and when signal happens, it's -1 or 1. 

Honestly, I don't know if this is happening because of my coding, but the indicator works well on its own. It is referenced correctly I presume, since the correct signals work. Thank you, please check. 


@cpxiom
Replies

PanagiotisCharalampous
16 Feb 2024, 11:45

Hi there,

It is hard for anybody to assist you without the source code for your indicator and cBot, as well as steps to reproduce this behavior.

Best regards,

Panagiotis


@PanagiotisCharalampous

cpxiom
16 Feb 2024, 12:25 ( Updated at: 17 Feb 2024, 05:50 )

RE: Indicator instance Bug?

PanagiotisCharalampous said: 

Hi there,

It is hard for anybody to assist you without the source code for your indicator and cBot, as well as steps to reproduce this behavior.

Best regards,

Panagiotis

Hi, on a second thought, most probably it's the indicator… as I see the problem appears more often on one of the signal pairs, lighter red and lighter green signals. If it would be a problem from the app, it would make sense to multiply all of the signals. As that is not happening, it means it's an indicator problem. Also, if I am the only one having this problem, then it's even more clearer. :). 

This is the part I am most concerned of… UpHisto and DnHisto are private IndicatorDataSeries, with CreateDataSeries();. Then:

where UpTrendBuy, is one of the plotted hits lines, as signal. 

As specifics, the indicator plots histogram lines for signals, based on quite a few other indicators combination and calculations. I made it this way to output directly the strategy signals, thinking that it's easier for a cBot to reference only one indicator, not 5, let's say. As best practice… is it better to develop the strategy in the cBot, referencing all the indicators and combinations in the cBot, and not in the indicator? Or it's the same. 

Thank you. 


@cpxiom

cpxiom
20 Feb 2024, 11:43

RE: RE: Indicator instance problem? [SOLVED]

Solved with booleans. 

 


@cpxiom