Moving Average Ribbon free

by cW22Trader in category Trend at 05/06/2022
Description

This is a moving average ribbon which only shows the average, the max and the min value. This way any number of moving averages can be shown without recompiling the code.

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
´╗┐using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Cloud("Max", "Mean", FirstColor = "Lime")]
    [Cloud("Mean", "Min", FirstColor = "Crimson")]
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class MovingAverageRibbon : Indicator
    {
        [Parameter("MA Period Start", DefaultValue = 50)]
        public int MAPeriodStart { get; set; }

        [Parameter("MA Period Step", DefaultValue = 10)]
        public int MAPeriodStep { get; set; }

        [Parameter("# of MA", DefaultValue = 16, MaxValue = 200)]
        public int NumMA { get; set; }

        [Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType MaType { get; set; }



        [Output("Mean", LineColor = "Gray", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries Mean { get; set; }

        [Output("Max", LineColor = "Lime", PlotType = PlotType.Line, LineStyle = LineStyle.DotsRare, Thickness = 1)]
        public IndicatorDataSeries Max { get; set; }

        [Output("Min", LineColor = "Crimson", PlotType = PlotType.Line, LineStyle = LineStyle.DotsRare, Thickness = 1)]
        public IndicatorDataSeries Min { get; set; }



        private MovingAverage[] ma;


        protected override void Initialize()
        {
            ma = new MovingAverage[NumMA];
            for (int i = 0; i < NumMA; i++)
            {
                ma[i] = Indicators.MovingAverage(Bars.ClosePrices, MAPeriodStart + i * MAPeriodStep, MaType);
            }
        }

        public override void Calculate(int index)
        {
            Mean[index] = ma.Average(x => x.Result[index]);
            Max[index] = ma.Max(x => x.Result[index]);
            Min[index] = ma.Min(x => x.Result[index]);
        }
    }
}
Comments

fillipyang7 - June 24, 2022 @ 11:40

Utilize an article writer with best professional proofreading services can keep in contact with you all the time the paper is being formed to ensure that everything is working out true to form. You can go to  instead of basically any writer that is coordinated with you.
 

catherinetolberttheblogger - June 28, 2022 @ 11:09

Are you searching for cheap assignment writers? We are the best solution for you.

Cheap assignment writing help

cheap assignment help

marcusmartinez - September 20, 2022 @ 16:14

the most interesting post i read this day! mold removal miami

0