Convert to .Net 6.0

Created at 29 Jul 2024, 23:02
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!
TH

thecaffeinatedtrader

Joined 22.07.2020

Convert to .Net 6.0
29 Jul 2024, 23:02


Does anyone know how to convert an indicator from 4.0 to 6.0?

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 TripleExponentialMovingAverage : Indicator
    {
        // Single-, Double-, and Triple-Smoothed EMAs:
        // EMA1 = EMA of price
        // EMA2 = EMA of EMA1
        // EMA3 = EMA of EMA2
        // TEMA = (3 x EMA1) - (3 x EMA2) + (EMA3)

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

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

        [Output("TEMA", LineColor = "DodgerBlue", Thickness = 2)]
        public IndicatorDataSeries TEMA { get; set; }

        private ExponentialMovingAverage EMA1, EMA2, EMA3;

        protected override void Initialize()
        {
            EMA1 = Indicators.ExponentialMovingAverage(Source, Periods);
            EMA2 = Indicators.ExponentialMovingAverage(EMA1.Result, Periods);
            EMA3 = Indicators.ExponentialMovingAverage(EMA2.Result, Periods);
        }

        public override void Calculate(int index)
        {
            TEMA[index] = (3 * EMA1.Result[index]) - (3 * EMA2.Result[index]) + EMA3.Result[index];
        }
    }
}

@thecaffeinatedtrader
Replies

PanagiotisCharalampous
30 Jul 2024, 05:52

Hi there,

Just change the framework to .Net 6.0 and build it again

Best regards,

Panagiotis


@PanagiotisCharalampous