Replies

fernandopaivabr
05 Mar 2019, 02:54

RE:

Panagiotis Charalampous said:

Hi fernandopaivabr,

Thanks for posting in our forum. This is possible but it requires some effort. You could always ask for professional assistance by posting a Job or getting in touch with a Consultant.

Best Regards,

Panagiotis

I've already posted there but I can't get a solution. Could you help me ?

I'm trying to create a script to make it but I don't know how do I to calculate the MA

Please, look at my code below and if you can help me I'll be glad.

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


namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Tabajara : Indicator
    {

        private MovingAverage MA { get; set; }

        [Parameter()]
        public DataSeries Source { get; set; }

        [Parameter("MA Periods", DefaultValue = 14)]
        public int Periods { get; set; }

        [Output("Default", LineColor = "#6E6E6E")]//default
        public IndicatorDataSeries Result { get; set; }

        [Output("Buy", LineColor = "#3ADF00")]//green
        public IndicatorDataSeries ResultBuy { get; set; }

        [Output("Sell", LineColor = "#FF0000")]//red
        public IndicatorDataSeries ResultSell { get; set; }

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

        
        protected override void Initialize()
        {
            MA = Indicators.MovingAverage(Source, Periods, MaType);

        }

        public override void Calculate(int index)
        {
            //MA default
            Result[index] = MA.Result[index];


            //MA buy green


            //MA sell red


        }

    }

}

 


@fernandopaivabr