Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CS0200 error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CS0200 error

    Hello,

    I'm getting that CS0200 error :

    CS0200 error "Property or indexer 'MHaut cannot be assiggned to - it is read only

    This indicator used to compile correctly, I don't understand what is happening. This part of the code is automatically generated by Ninjatrader...

    Here is the code ; I've highlighted in red the part that is the problem.

    Many thanks in adance for your help.


    Code:
    #region Using declarations
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Gui.SuperDom;
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.Core.FloatingPoint;
    using NinjaTrader.NinjaScript.DrawingTools;
    #endregion
    
    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators.PM
    {
    public class MyBandesMogalef : Indicator
    {
    private Series<double> CPSerie;
    private Series<double> ESerie;
    private Series<double> FSerie;
    private double nMedian = 0, nHaut = 0, nBas = 0;
    private int LinRegPeriode = 3, StdDevPeriode = 7;
    
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "MyBandesMogalef";
    Calculate = Calculate.OnPriceChange;
    IsOverlay = false;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    
    AddPlot(new Stroke(Brushes.DarkTurquoise, DashStyleHelper.Solid, 2), PlotStyle.Line,"MHaut");
    AddPlot(new Stroke(Brushes.Purple, DashStyleHelper.Solid, 2), PlotStyle.Line,"MMedian");
    AddPlot(new Stroke(Brushes.Yellow, DashStyleHelper.Solid, 2), PlotStyle.Line,"MBas");
    //AddLine(Brushes.Aqua, 2, "MHaut");
    //AddLine(Brushes.DarkMagenta, 2, "MMilieu");
    //AddLine(Brushes.Yellow, 2, "MBas");
    }
    else if (State == State.Configure)
    {
    // AddDataSeries(Data.BarsPeriodType.Minute, 5);
    CPSerie = new Series<double>(this);
    ESerie = new Series<double>(this);
    FSerie = new Series<double>(this);
    }
    }
    
    protected override void OnBarUpdate()
    {
    if (CurrentBar < 8)
    {
    CPSerie[0] = ((Open[0] + High[0] + Low[0] + (2*Close[0]))/5);
    nMedian = CPSerie[0];
    nHaut = 0;
    nBas = 0;
    return;
    }
    
    CPSerie[0] = ((Open[0] + High[0] + Low[0] + (2*Close[0]))/5);
    if (CurrentBar > 8 + StdDevPeriode)
    {
    FSerie[0] = (LinReg(CPSerie,LinRegPeriode)[0]);
    ESerie[0] = (StdDev(FSerie,StdDevPeriode)[0]);
    }
    else
    {
    FSerie[0] = (CPSerie[0]);
    ESerie[0] = (0);
    }
    
    if (FSerie[0] < nBas || FSerie[0] > nHaut)
    {
    nMedian = FSerie[0];
    nHaut = nMedian + (2*ESerie[0]);
    nBas = nMedian - (2*ESerie[0]);
    }
    MMedian[0] = (nMedian);
    MHaut[0] = (nHaut);
    MBas[0] = (nBas);
    }
    
    #region Properties
    [NinjaScriptProperty]
    
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> MHaut
    {
    get { return Values[0]; }
    }
    
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> MMedian
    {
    get { return Values[1]; }
    }
    
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> MBas
    {
    get { return Values[2]; }
    }
    #endregion
    
    }
    }
    
    #region NinjaScript generated code. Neither change nor remove.
    
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {
    private PM.MyBandesMogalef[] cacheMyBandesMogalef;
    public PM.MyBandesMogalef MyBandesMogalef(Series<double> mHaut)
    {
    return MyBandesMogalef(Input, mHaut);
    }
    
    public PM.MyBandesMogalef MyBandesMogalef(ISeries<double> input, Series<double> mHaut)
    {
    if (cacheMyBandesMogalef != null)
    for (int idx = 0; idx < cacheMyBandesMogalef.Length; idx++)
    if (cacheMyBandesMogalef[idx] != null && cacheMyBandesMogalef[idx].MHaut == mHaut && cacheMyBandesMogalef[idx].EqualsInput(input))
    return cacheMyBandesMogalef[idx];
    return CacheIndicator<PM.MyBandesMogalef>(new PM.MyBandesMogalef(){ [COLOR=#e74c3c][B]MHaut = mHaut }[/B][/COLOR], input, ref cacheMyBandesMogalef);
    }
    }
    }
    
    namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
    {
    public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
    {
    public Indicators.PM.MyBandesMogalef MyBandesMogalef(Series<double> mHaut)
    {
    return indicator.MyBandesMogalef(Input, mHaut);
    }
    
    public Indicators.PM.MyBandesMogalef MyBandesMogalef(ISeries<double> input , Series<double> mHaut)
    {
    return indicator.MyBandesMogalef(input, mHaut);
    }
    }
    }
    
    namespace NinjaTrader.NinjaScript.Strategies
    {
    public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
    {
    public Indicators.PM.MyBandesMogalef MyBandesMogalef(Series<double> mHaut)
    {
    return indicator.MyBandesMogalef(Input, mHaut);
    }
    
    public Indicators.PM.MyBandesMogalef MyBandesMogalef(ISeries<double> input , Series<double> mHaut)
    {
    return indicator.MyBandesMogalef(input, mHaut);
    }
    }
    }
    
    #endregion

    #2
    Hello pmatrading,

    Thank you for your post.

    It looks like you maybe removed some old properties for this indicator, but left in a [NinjaScriptProperty] attribute. Remove that line (just inside the Properties region) and it should compile for you.

    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Hello Kate,

      thank you for your answer. I don't see anything in the NinjaScriptProperty region that is related to an old properties... Can you elaborate please ?
      Many thanks again,

      Pmat

      Comment


        #4
        Hello pmatrading,

        Thank you for your reply.

        Specifically, it will compile if you remove this line:

        Code:
        #region Properties
        [B][NinjaScriptProperty][/B]
        
        [Browsable(false)]
        [XmlIgnore]
        public Series<double> MHaut
        {
        get { return Values[0]; }
        }
        
        [Browsable(false)]
        [XmlIgnore]
        public Series<double> MMedian
        {
        get { return Values[1]; }
        }
        
        [Browsable(false)]
        [XmlIgnore]
        public Series<double> MBas
        {
        get { return Values[2]; }
        }
        #endregion
        Here's some further information on what that attribute does:


        Please let us know if we may be of further assistance to you.

        Comment


          #5
          Thanks Kate, I got it this time. And it is compiling !!!
          Great support, thank you !!!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          607 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          353 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          560 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          561 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X