[BUG] Objects multiplicate on chart in v3.8 when you switch symbols

Created at 15 Jun 2020, 18:23
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!
VI

Vitore

Joined 28.03.2020

[BUG] Objects multiplicate on chart in v3.8 when you switch symbols
15 Jun 2020, 18:23


Hi there,

there's a possible error in the public beta 3.8 implementation of the new object manager. It seems that when an indicator draws objects on the chart, and the objects are not set interactive, then under certain circumstances those objects may multiplicate on the chart and the original instance stays on the chart and cannot be removed. Even refreshing the chart or deleting the indicator does not help in such a case.

The bug is demonstrated by the following code. It is an indicator drawing one rectangle at a random position on the chart during its initialization.

In v 3.7, if you change the symbol and then change back to the original one, the rectangle just changes place which is an expected behavior.

In v 3.8, however, the rectangles duplicate on the chart and the original instance cannot be removed (both share the same name but the first one gets somehow orphaned). When you repeat switching symbols back and forth the rectangles keep adding up on the chart.

If you make the objects interactive, this problem does not appear as the objects are placed in the object manager and correctly assigned to their respective symbols. Only when they are not interactive the things start getting messed up

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SymbolInfo : Indicator
    {
        protected override void Initialize()
        {
            int shift = new Random().Next(10, 200);
            Chart.DrawRectangle("TestArea", Bars.Count - shift, 0.7 * Chart.TopY + 0.3 * Chart.BottomY, Bars.Count - shift - 20, 0.7 * Chart.BottomY + 0.3 * Chart.TopY, Color.FromArgb(64, Color.IndianRed)).IsFilled = true;
        }
 
       public override void Calculate(int index)
        {
        }
    }
}

 


 


@Vitore
Replies

Vitore
28 Jun 2020, 18:37

New issue introduced while fixing object multiplication bug

I noticed you have fixed the object multiplication in the latest beta v3.8 release; however, a new bug now seems to show up.

You can use the code above to reproduce it by simply move the whole chart area up or down in a way to make part of the rectange dissapear from the visible chart area. As soon as at least one pixel of the rectangle disappears its color changes (the transparency) and becomes more opaque. When you move the chart back to make the rectangle whole visible, the color transparency restores back to the correct value. It makes the object's color kind of "flash" as you move it in/out of the visible chart area.

Can you please fix it?


@Vitore

PanagiotisCharalampous
29 Jun 2020, 10:53

Hi Vitore,

Thanks for reporting this. We will fix it in the next hotfix of Spotware Beta.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous