Why the chart becomes so slow?

Created at 24 Sep 2017, 19:05
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!
Traderfofever's avatar

Traderfofever

Joined 07.08.2017

Why the chart becomes so slow?
24 Sep 2017, 19:05


I just modified the Sample SMA a little to change the PlotType to Histogram, then the chart became very slow. Could anyone please tell me what happened and how to deal with it? Thank you!

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
    public class SMAHistogram : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter(DefaultValue = 20)]
        public int Periods { get; set; }

        [Output("Main", PlotType = PlotType.Histogram, Color = Colors.White, Thickness = 1)]
        public IndicatorDataSeries Result { get; set; }

        public override void Calculate(int index)
        {
            double sum = 0.0;

            for (int i = index - Periods + 1; i <= index; i++)
            {
                sum += Source[i];
            }
            Result[index] = sum / Periods;
        }
    }
}

 


@Traderfofever
Replies

PanagiotisCharalampous
25 Sep 2017, 10:10

Hi Trader4ever,

I tried your indicator but I didn't experience any performance degradation. Can you please share a screenshot of your chart. It could be that something else causes the slow down.

Best Regards,

Panagiotis


@PanagiotisCharalampous

Traderfofever
25 Sep 2017, 15:27 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Panagiotis Charalampous said:

Hi Trader4ever,

I tried your indicator but I didn't experience any performance degradation. Can you please share a screenshot of your chart. It could be that something else causes the slow down.

Best Regards,

Panagiotis

I am so sorry I didn't make myself clear. It depends on the LineStyle!


@Traderfofever