chart objects not drawing

Created at 18 Nov 2023, 10:11
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!
CT

ctid4921325

Joined 18.11.2023

chart objects not drawing
18 Nov 2023, 10:11


Hi 

 

Below I've pasted code straight from the ctrader help to use as an example and eliminate anythign odd i might have done.

 

The issue i'm having is that, code that draws this  a grid and its child objects  isn't drawing on my charts. IF, in ‘Automate’ I add an instance to the indicator, it will draw on that chart the first time I add it, but then after any further changes, I have to remove the instance and re-add it.  On charts in ‘trade’ it doesn't draw at all, thought it does add the indicator area, and if i have print statements throughout it prints to the log as expected. 

 

What do i need to change to trigger this to draw ?

Here is some sample code:

 using cAlgo.API;
 namespace cAlgo
 {
     // This sample indicator shows how to use IndicatorArea
     [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class IndicatorAreaSample : Indicator
     {
         private TextBlock _indicatorAreaNumberTextBlock;
         protected override void Initialize()
         {
             var grid = new Grid(1, 2)
             {
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 BackgroundColor = Color.Gold,
                 Opacity = 0.7,
                 Width = 200
             };
             grid.AddChild(new TextBlock { Text = "Indicator Area #", Margin = 5, FontWeight = FontWeight.ExtraBold, ForegroundColor = Color.Black }, 0, 0);
             _indicatorAreaNumberTextBlock = new TextBlock
             {
                 Margin = 5,
                 Text = Chart.IndicatorAreas.Count.ToString(),
                 FontWeight = FontWeight.ExtraBold,
                 ForegroundColor = Color.Black
             };
             grid.AddChild(_indicatorAreaNumberTextBlock, 0, 1);
             IndicatorArea.AddControl(grid);
             Chart.IndicatorAreaAdded += Chart_IndicatorAreaAdded;
             Chart.IndicatorAreaRemoved += Chart_IndicatorAreaRemoved;
         }
         private void Chart_IndicatorAreaRemoved(IndicatorAreaRemovedEventArgs obj)
         {
             _indicatorAreaNumberTextBlock.Text = Chart.IndicatorAreas.Count.ToString();
         }
         private void Chart_IndicatorAreaAdded(IndicatorAreaAddedEventArgs obj)
         {
             _indicatorAreaNumberTextBlock.Text = Chart.IndicatorAreas.Count.ToString();
         }
         public override void Calculate(int index)
         {
         }
     }
 }

@ctid4921325
Replies

PanagiotisCharalampous
20 Nov 2023, 10:01

Reply to: chart objects not drawing

Hi there,

We managed to reproduce the problem and it will be solved in an upcoming release of cTrader Desktop.

Best regards,

Panagiotis


@PanagiotisCharalampous

ctid4921325
20 Nov 2023, 20:03 ( Updated at: 21 Nov 2023, 13:40 )

RE: Reply to: chart objects not drawing

PanagiotisCharalampous said: 

Hi there,

We managed to reproduce the problem and it will be solved in an upcoming release of cTrader Desktop.

Best regards,

Panagiotis

awesome, thanks!


@ctid4921325