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