Crash in example cBot with AddIndicators=true from help page "How to Manage cBots and Indicators Using Algos"
Crash in example cBot with AddIndicators=true from help page "How to Manage cBots and Indicators Using Algos"
21 Oct 2024, 13:40
Hi there,
Ideally I want a cBot to add a custom indicator and standard indicators to its chart and have them show, and later, dependant on some statistics, be able to change the indicators' parameters (or just stop/start the standard indicators).
But first, on a possible path the the above, I noticed there's an AddIndicators attribute for Robots - which seems to require v5 and/or .NET 6 (a Robot with it failed to build on 4.9.2 .NET 4.x) - which might from the doc enable added indicators to show on the chart. Then I found the example for controlling one cBot from another, and noticed it had the AddIndicators = true parameter.
https://help.ctrader.com/ctrader-algo/articles/for-developers/how-to-manage-cbots-and-indicators-using-algos
But after compiling it (on v5.0.39 .NET 6) I get these errors (and nothing beyond the normal candles appears on the Algo chart):
21/10/2024 13:05:48.161 | Error | Adding robot Sample Trend cBot to chart 74ee9d2a-34f5-473d-9fa4-97b5c97f827a failed with error Chart 74ee9d2a-34f5-473d-9fa4-97b5c97f827a is not a valid chart for add robot operation..
21/10/2024 13:05:48.161 | Error | Adding robot Sample Trend cBot to chart 74ee9d2a-34f5-473d-9fa4-97b5c97f827a failed with error Chart 74ee9d2a-34f5-473d-9fa4-97b5c97f827a is not a valid chart for add robot operation..
21/10/2024 13:06:00.255 | Error | Crashed in OnBarClosed with NullReferenceException: Object reference not set to an instance of an object.
Should I be trying the example in a different tab? the Trade tab not the Algo (but how?) or have I misunderstood more of it. Also, is it possible to have a cBot manage a custom indicator such that it shows on the Algo tab's chart, or in backtesting too?
Thanks
PanagiotisCharalampous
22 Oct 2024, 05:37
Hi there,
I just tried this and had no problems. Can you please record a video demonstrating what exactly you are doing?
Best regards,
Panagiotis
@PanagiotisCharalampous