Annotations on the Candles

Created at 19 Oct 2020, 19:31
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!
JE

JeanPaul

Joined 17.10.2020

Annotations on the Candles
19 Oct 2020, 19:31


When running a bot in backtesting and taking a trade decision, it is good to attach a comment to the candle in which that decision is taken, so that if you are looking at the chart visually, you will be able to see why the bot took this decision.

- If I am in OnBar, can I identify on the chart the candle that I am at? And How?

- Can I add a comment to that candle?

- Can I attach an OnClick event to a candle so that when it is clicked, I can display the comment that I have added?

 

Do you recommend other way in annotating the chart during a backtest?

 


@JeanPaul
Replies

PanagiotisCharalampous
20 Oct 2020, 08:47

Hi JeanPaul,

  1. You can get the current bar in OnBar using Bars.Last(0)
  2. You use a TextBlock or DrawText to display your text
  3. You can use Chart.MouseDown to listen to mouse clicks on the chart.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

JeanPaul
20 Oct 2020, 15:21

RE:

PanagiotisCharalampous said:

Hi JeanPaul,

  1. You can get the current bar in OnBar using Bars.Last(0)
  2. You use a TextBlock or DrawText to display your text
  3. You can use Chart.MouseDown to listen to mouse clicks on the chart.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you, but I really meant the Visual Candle and not the actual bar. As I am assuming with the Visual Candle you have have access to features such as colour, so you can maybe append an onClick.

2 - I know this one, but can I attach this to the candle rather than the whole chart?

3 - Same as 2.

 


@JeanPaul

PanagiotisCharalampous
20 Oct 2020, 15:28

Hi JeanPaul,

You do not have access to the actual visual candle but you have all the information you need to develop this yourself. You know the OHLC values and time/index of the candle so you can check where the mouse was clicked and place the text accordingly.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous