How to reload chart

Created at 04 Jun 2021, 14:35
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

ctid1442319

Joined 03.02.2021

How to reload chart
04 Jun 2021, 14:35


Hello,

at first - I've read similar topics but my problem is little different. I am using indicator that draws supply&demand zones on chart which I use as part of strategy in my cbot. Important thing is that this indicator don't have visible source code so I cannot just plug it to cbot to read these zones and as workaround I just read rectangles that it draws on chart.

Problem is that I've noticed that often it skips drawing some zones, when even on second cTrader instance using same pair, same broker, same timeframe they are visible. When I reload chart just by loading my saved default chart template, they are painted as they should right away and stay as it should. So my workaround to fix that problem was to force refreshing chart from time to time.

As I read on other topics, there is no function to just refresh chart, we can recalculate indicator variables instead - problem is I don't use that as indicator as its source code is hidden and all I can do is to read rectangles by cbot. Is there a way to force cbot to reload chart for every minute for example, like redraw rectangles or something? Or somehow, to force loading default chart template? Here is code I am using to read rectangles to know where are supply&demand zones drawn by that indicator:

foreach (var rectangle in rectangles)
            {
                var SRline = (rectangle as ChartRectangle).Y1;

                //Checking if there was SR line near 3rd brick close, not farer that half of brick
                if (Math.Round(Math.Abs(SRline - Bars.ClosePrices.Last(3)) / Symbol.PipSize, 0) <= brickSize * 0.5)
                {
                    SRbounced = 1;
                }

                //Checking if there is SR line closer than 2 bricks from last close to avoid trade
                if (Math.Round(Math.Abs(SRline - Bars.ClosePrices.Last(1)) / Symbol.PipSize, 0) <= brickSize * 2)
                {
                    SRahead = 1;
                }
            }

 


@ctid1442319
Replies

PanagiotisCharalampous
04 Jun 2021, 14:51

Hi ctid1442319,

Unfortunately there is no refresh functionality in the API. Also without the indicator source code, it is not easy to think of a solution. The proper solution would be for the developer of the indicator to fix the issue.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous