How to make sum of last 30 values on indicator

Created at 27 Nov 2014, 20:31
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!
LS

LSR2412

Joined 07.11.2014

How to make sum of last 30 values on indicator
27 Nov 2014, 20:31


Hi,

I have simple indicator which calculates some values and prints them on price chart on each bar...some bars don't have values

how to make sum of those values (in last 30 bars), and how to count them as they are not on each bar

my indicator is something like High - Low...so you can use that example to help me ..thanks

using System;
using cAlgo.API;
 
namespace cAlgo.Indicators
{
    [Indicator(AccessRights = AccessRights.None)]
    class HighMinusLow : Indicator
    {
        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }
 
        public override void Calculate(int index)
        {
            Result[index] = MarketSeries.High[index] - MarketSeries.Low[index];
        }
    }
}

 


@LSR2412