Accessing chart objects drawn by custom indicator from bot

Created at 19 Oct 2020, 17:24
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!
ER

erik.lindblad

Joined 05.03.2019

Accessing chart objects drawn by custom indicator from bot
19 Oct 2020, 17:24


Hi!

Posted this morning but now I can't find my post so I guess I'll have to post again.

I have a custom indicator that draws trendlines on the chart. I want to access these lines and their coordinates from my bot.

However, during backtesting, in my bot Chart.Objects is always empty although I see the trendlines on the chart.

Print(Chart.Objects.Count()) => 0

 Also if I try to access the indicator's Chart object, it is also empty.

_myCustomIndicator = Indicators.GetIndicator<MyCustomIndicator>();
Print(_myCustomIndicator.Chart.Objects.Count()) => 0;

How can I access the trendlines I see drawn during back testing from my bot. Right now, only if the bot draws the lines itself, it can access them.

Thanks!

/Erik

 

 


@erik.lindblad
Replies

PanagiotisCharalampous
20 Oct 2020, 08:05

Hi Erik,

Can you provide both the indicator and cBot code?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous