ChartObjects drawn in visual backtesting disappear on test completion
ChartObjects drawn in visual backtesting disappear on test completion
31 May 2019, 11:09
Hi,
I draw some ChartObjects in my cBot that are used in determining trade criteria, but if I run this in a visual backtest, they all disappear at the end of the test. This makes it impossible to scroll back and determine the conditions some trades were made under. I've not found anything in the UI or API to prevent this from happening, yet in an old post by Panagiotis, it seems these objects should remain visible. From this thread (https://ctrader.com/forum/calgo-support/12844) on 11 May 2018 I quote (Panagiotis):
3. The next version of cTrader will have visual backtesting. Chart objects, like lines and shapes, will be drawn on the chart during visual backtesting and at the end of silent backtesting all objects will stay on the chart.
Is there any way to keep the objects on the chart?. If not, the Visual backtesting mode isn't much use at all.
Thanks
Replies
mpistorius
31 May 2019, 18:14
Really?! Awesome. Gotta love these undocumented 'features' :)
As these objects were algorithmically generated and I didn't want them to be modified, I intentionally made them non-interactive. Never thought it would have such side effects. I'm just so happy there is a workaround, I don't care how hacky it is.
For others in my situation, a workaround to the workaround is to only set them as interactive during backtesting, but fixed during real-time trading:
line.interactive = IsBacktesting ? true : false;
Thanks, guys, keep up the good work, cTrader is becoming a better Metatrader replacement with every update!
@mpistorius
PanagiotisCharalampous
31 May 2019, 15:14
Hi mpistorius,
At the moment to keep the objects on the charts you need to make them interactive. Here is an example how to make them interactive
Best Regards,
Panagiotis
@PanagiotisCharalampous