MaxVisibleBars

Created at 07 Apr 2020, 08:45
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!
GE

gennimatas

Joined 19.09.2018

MaxVisibleBars
07 Apr 2020, 08:45


While developing an indicator which is using Chart.MaxVisibleBars add an instance.

Switching back to it's source window, the MaxVisibleBars value is changing.

To reproduce, run the code in snippet then toggle between source and instance.

 

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TestMaxVisibleBars : Indicator
    {

        int prevValue;

        public override void Calculate(int index)
        {
            if (prevValue != 0 && prevValue != Chart.MaxVisibleBars)
                Print("prev=", prevValue, " curr=", Chart.MaxVisibleBars);
            prevValue = Chart.MaxVisibleBars;
        }
    }
}

 


@gennimatas
Replies

PanagiotisCharalampous
08 Apr 2020, 11:25

Hi Takis,

We managed to reproduce this issue and we will fix it in the next version of cTrader. If you need to have the actual number of MaxVisibleBars at any time and you need to get notified when this size changes, you can subscribe to Chart.SizeChanged event.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous