Is it not possible to Chart.DrawIcon only from a cBot?

Created at 27 Apr 2021, 18:38
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!
BE

belasto

Joined 11.02.2019

Is it not possible to Chart.DrawIcon only from a cBot?
27 Apr 2021, 18:38


I think the title says it all. :)

If I use an indicator, I can use Draw.ChartIcon and see arrows and stuff. If I put the same line into the OnBar() of a cBot, it's not working. Do I make a mistake or is this on purpose?
(Sorry, Im new to all this)

Thanks!


@belasto
Replies

PanagiotisCharalampous
28 Apr 2021, 08:03

Hi belasto,

It should work on both. Please share your code and we will spot the mistake.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

belasto
28 Apr 2021, 12:51 ( Updated at: 21 Dec 2023, 09:22 )

RE:

In the indicators Calculate function - working:
 

Chart.DrawIcon("arrow", ChartIconType.DownArrow, index, Bars[index].High + 5 * Symbol.PipSize, Color.Red);


In the cBot onBar function - not working, I let it run in backtesting, so onBar() is being called:
 

Chart.DrawIcon("arrow", ChartIconType.DownArrow, Bars.Count - 1, Bars[Bars.Count-1].High + 5 * Symbol.PipSize, Color.Red);



Thanks so much for helping out.


!!!! EDIT: If found the problem. I was not using the "visual mode" in backtesting... no wonder! Now it's working. Thanks!














 


@belasto