Chart text dissapears quickly after backtesting

Created at 25 Aug 2022, 07:17
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!
MM

mmmsogood69

Joined 25.08.2022

Chart text dissapears quickly after backtesting
25 Aug 2022, 07:17


Hey, this is the code i"m using for a cBot to display accelerator indicator values on the chart.  Whenever I run the bot in backtesting it shows all the data points but then they all dissapear.   Any clue how I'm doing this wrong??

All the code is inside OnBar()

            var lastOsci1 =_acceleratorOscillator.Result.Last(1);
            var barHighValue = Bars.Last(1).High;
            Chart.DrawText($"{lastOsci1}" + $".{barHighValue}", $"{lastOsci1}", Bars.Last(1).OpenTime, barHighValue, Color.Red);
 


@mmmsogood69
Replies

PanagiotisCharalampous
25 Aug 2022, 09:09

Hi there,

Try making your objects interactive. See below

        var text = Chart.DrawText($"{lastOsci1}" + $".{barHighValue}", $"{lastOsci1}", Bars.Last(1).OpenTime, barHighValue, Color.Red);
        text.IsInteractive = true;

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous