cTrader 4.4.12 Indicator now suspended

Created at 03 Oct 2022, 22:08
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!
CT

ctid3999979

Joined 05.07.2021

cTrader 4.4.12 Indicator now suspended
03 Oct 2022, 22:08


Hi

cTrader just updated to 4.4.12 and the indicator that I use as part of my strategy gets suspended now. I tried debugging it but even if I put my breakpoint on the very first parameter of the public class, it doesn't break into the code. I just get an "f" icon in the chart tab saying it's been suspend due to errors.

In VS is have 0 errors and 2 warnings about a couple of fields that are currently never used.

I even thought it could be that I originally wrote it in .NET4, I built it in .NET6 and still got the same problem. I have now gone so far as to create a brand new indicator and start to re-write it from scratch in .NET6 and still the same problem when all I have coded is a StackPanel with only static attributes.

Any ideas?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.FullAccess)]
    public class MASlopeNET6 : Indicator
    {
        [Parameter("Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MA_Type { get; set; }

        [Parameter("MA Periods", DefaultValue = 15, MinValue = 2, Step = 1)]
        public int MA_Period { get; set; }

        [Parameter("Slope Length", DefaultValue = 15, MinValue = 5, Step = 1)]
        public int Slope_Length { get; set; }

        [Parameter("Slope Threshold", DefaultValue = 0.2, MinValue = 0.1, Step = 0.01)]
        public double Slope_Threshold { get; set; }

        [Parameter("TimeFrame", DefaultValue = "m1")]
        public TimeFrame MA_TimeFrame { get; set; }

        [Parameter("Smoothing", DefaultValue = true)]
        public bool MA_Smooting { get; set; }

        [Parameter("Show Info", DefaultValue = true)]
        public bool SHow_Info { get; set; }

        [Output("Close", LineColor = "#FFFF00C5")]
        public IndicatorDataSeries MA_Close_Line { get; set; }

        [Output("Slope", LineColor = "#FFFFFF01")]
        public IndicatorDataSeries MA_Slope_Line { get; set; }


        // Instatiate Indicator objects
        private Bars priceBars;
        private int maTimeIndex;
        private MovingAverage maClose;

        // Instantiate information panels
        private StackPanel maPanel;
        private StackPanel trendPanel;
        private TextBlock[] maTextBlock = new TextBlock[3];
        private TextBlock[] trendTextBlock = new TextBlock[2];

        protected override void Initialize()
        {
            //Get candle data and create moving average
            priceBars = MarketData.GetBars(MA_TimeFrame);
            maClose = Indicators.MovingAverage(priceBars.ClosePrices, MA_Period, MA_Type);

            // Create primary slope information panel
            maPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                BackgroundColor = Color.Black,
                Margin = 5
            };

            // Add text boxes to primary slope info panel
            for (int i = 0; i < maTextBlock.Count(); i++)
            {
                trendTextBlock[i] = new TextBlock
                {
                    Text = "",
                    ForegroundColor = Color.White,
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                trendPanel.AddChild(trendTextBlock[i]);
            }
            Chart.AddControl(trendPanel);
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = 
        }
    }
}

 


@ctid3999979
Replies

ctid3999979
06 Oct 2022, 13:42

RE:

ctid3999979 said:

Hi

cTrader just updated to 4.4.12 and the indicator that I use as part of my strategy gets suspended now. I tried debugging it but even if I put my breakpoint on the very first parameter of the public class, it doesn't break into the code. I just get an "f" icon in the chart tab saying it's been suspend due to errors.

In VS is have 0 errors and 2 warnings about a couple of fields that are currently never used.

I even thought it could be that I originally wrote it in .NET4, I built it in .NET6 and still got the same problem. I have now gone so far as to create a brand new indicator and start to re-write it from scratch in .NET6 and still the same problem when all I have coded is a StackPanel with only static attributes.

Any ideas?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.FullAccess)]
    public class MASlopeNET6 : Indicator
    {
        [Parameter("Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MA_Type { get; set; }

        [Parameter("MA Periods", DefaultValue = 15, MinValue = 2, Step = 1)]
        public int MA_Period { get; set; }

        [Parameter("Slope Length", DefaultValue = 15, MinValue = 5, Step = 1)]
        public int Slope_Length { get; set; }

        [Parameter("Slope Threshold", DefaultValue = 0.2, MinValue = 0.1, Step = 0.01)]
        public double Slope_Threshold { get; set; }

        [Parameter("TimeFrame", DefaultValue = "m1")]
        public TimeFrame MA_TimeFrame { get; set; }

        [Parameter("Smoothing", DefaultValue = true)]
        public bool MA_Smooting { get; set; }

        [Parameter("Show Info", DefaultValue = true)]
        public bool SHow_Info { get; set; }

        [Output("Close", LineColor = "#FFFF00C5")]
        public IndicatorDataSeries MA_Close_Line { get; set; }

        [Output("Slope", LineColor = "#FFFFFF01")]
        public IndicatorDataSeries MA_Slope_Line { get; set; }


        // Instatiate Indicator objects
        private Bars priceBars;
        private int maTimeIndex;
        private MovingAverage maClose;

        // Instantiate information panels
        private StackPanel maPanel;
        private StackPanel trendPanel;
        private TextBlock[] maTextBlock = new TextBlock[3];
        private TextBlock[] trendTextBlock = new TextBlock[2];

        protected override void Initialize()
        {
            //Get candle data and create moving average
            priceBars = MarketData.GetBars(MA_TimeFrame);
            maClose = Indicators.MovingAverage(priceBars.ClosePrices, MA_Period, MA_Type);

            // Create primary slope information panel
            maPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                BackgroundColor = Color.Black,
                Margin = 5
            };

            // Add text boxes to primary slope info panel
            for (int i = 0; i < maTextBlock.Count(); i++)
            {
                trendTextBlock[i] = new TextBlock
                {
                    Text = "",
                    ForegroundColor = Color.White,
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                trendPanel.AddChild(trendTextBlock[i]);
            }
            Chart.AddControl(trendPanel);
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = 
        }
    }
}

 

Anyone know why this could be happening?


@ctid3999979

ctid3999979
09 Oct 2022, 08:06

RE: RE:

ctid3999979 said:

ctid3999979 said:

Hi

cTrader just updated to 4.4.12 and the indicator that I use as part of my strategy gets suspended now. I tried debugging it but even if I put my breakpoint on the very first parameter of the public class, it doesn't break into the code. I just get an "f" icon in the chart tab saying it's been suspend due to errors.

In VS is have 0 errors and 2 warnings about a couple of fields that are currently never used.

I even thought it could be that I originally wrote it in .NET4, I built it in .NET6 and still got the same problem. I have now gone so far as to create a brand new indicator and start to re-write it from scratch in .NET6 and still the same problem when all I have coded is a StackPanel with only static attributes.

Any ideas?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.FullAccess)]
    public class MASlopeNET6 : Indicator
    {
        [Parameter("Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MA_Type { get; set; }

        [Parameter("MA Periods", DefaultValue = 15, MinValue = 2, Step = 1)]
        public int MA_Period { get; set; }

        [Parameter("Slope Length", DefaultValue = 15, MinValue = 5, Step = 1)]
        public int Slope_Length { get; set; }

        [Parameter("Slope Threshold", DefaultValue = 0.2, MinValue = 0.1, Step = 0.01)]
        public double Slope_Threshold { get; set; }

        [Parameter("TimeFrame", DefaultValue = "m1")]
        public TimeFrame MA_TimeFrame { get; set; }

        [Parameter("Smoothing", DefaultValue = true)]
        public bool MA_Smooting { get; set; }

        [Parameter("Show Info", DefaultValue = true)]
        public bool SHow_Info { get; set; }

        [Output("Close", LineColor = "#FFFF00C5")]
        public IndicatorDataSeries MA_Close_Line { get; set; }

        [Output("Slope", LineColor = "#FFFFFF01")]
        public IndicatorDataSeries MA_Slope_Line { get; set; }


        // Instatiate Indicator objects
        private Bars priceBars;
        private int maTimeIndex;
        private MovingAverage maClose;

        // Instantiate information panels
        private StackPanel maPanel;
        private StackPanel trendPanel;
        private TextBlock[] maTextBlock = new TextBlock[3];
        private TextBlock[] trendTextBlock = new TextBlock[2];

        protected override void Initialize()
        {
            //Get candle data and create moving average
            priceBars = MarketData.GetBars(MA_TimeFrame);
            maClose = Indicators.MovingAverage(priceBars.ClosePrices, MA_Period, MA_Type);

            // Create primary slope information panel
            maPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                BackgroundColor = Color.Black,
                Margin = 5
            };

            // Add text boxes to primary slope info panel
            for (int i = 0; i < maTextBlock.Count(); i++)
            {
                trendTextBlock[i] = new TextBlock
                {
                    Text = "",
                    ForegroundColor = Color.White,
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                trendPanel.AddChild(trendTextBlock[i]);
            }
            Chart.AddControl(trendPanel);
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = 
        }
    }
}

 

Anyone know why this could be happening?

Am I really the only person who this is happening to?


@ctid3999979