trigger on MarketSeries Data resize eg. scroll to past causing reload

Created at 29 Aug 2019, 08:04
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!
BU

buccinator

Joined 04.08.2019

trigger on MarketSeries Data resize eg. scroll to past causing reload
29 Aug 2019, 08:04


Hi, RE: when a user scrolls to the first index bar and cTrader refreshes the data size all the existing relative draw lines become out of sequence. For the most part i have hacked a solution with a Chart.ScrollChanged function and by tracking the last known total bar size via OnBar. However this inherits a bug/issue where a user can quickly scroll to the first index then back to the last bar before cTrader updates the data size (i know most wont do this but the case is still possible).

 

        private void Chart_ScrollChanged(ChartScrollEventArgs obj)
        {

            if (Plot && 2 < (Chart.BarsTotal - Chart.LastVisibleBarIndex) && Chart.BarsTotal > Chart_BarsTotal)
            {
                Chart_BarsTotal = Chart.BarsTotal;
            }
            else
            {
                return;
            }

            //code here will only be executed if the user doesnt scroll back to the last bar
            // before cTrader updates to the new data size
        }

 

is there a nicer way to handle datasize being updated? eg. user scrolling to first bar causing market data to be updated?

cheers

 

 


@buccinator