Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

[Browsable(false)] still browsable + error reflecting type

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

    [Browsable(false)] still browsable + error reflecting type

    Hello everyone,

    see the few code lines below,
    how could it be possible that mid3 still is browsable in the indicators dialog window ?


    Code:
    protected override void OnStateChange()
    {
        if (State == State.SetDefaults)
        {
            ArePlotsConfigurable = false;
            AddPlot(new Stroke(Brushes.LimeGreen    , DashStyleHelper.Solid, 3, 100), PlotStyle.Line, "mid3");
        }
    }
    
    protected override void OnBarUpdate()
    {
       mid3[0] = someDouble;
    }
    
    [Browsable(false)] [XmlIgnore()]
    private Series<double>    mid3    { get { return Values[0]; } }​
    I noticed this after encoutering the infamous
    Could not save indicator 'MyIndic:' There was an error reflecting type 'NinjaTrader.NinjaScript.Indicators.MyIndic'.
    while saving the wrokspace.
    Then I double checked my properties about [XmlIgnore()] following this post : https://forum.ninjatrader.com/forum/...79#post1305879

    I suspect the reflecting error is more likely to be related to the browsability than the serialization...
    Does all that makes sense ? Is my suspicion legit ?
    What did I miss about properties browsability ?
    Last edited by Amedeus; 08-16-2024, 01:55 PM.

    #2
    Hello Amedeus,

    A plot property should be a public property, this is an example from the bollinger:

    [Browsable(false)]
    [XmlIgnore()]
    public Series<double> Upper
    {
    get { return Values[0]; }
    }​

    If you have modified the script you will also need to remove it and re apply it to see that change, if you do an F5 reload that won't help to see class level changes.

    Comment


      #3
      Hey Jesse,

      Thank you very much.
      Browsability went off after the adjustments you indicated.

      One more detail regarding browsability :
      when I set ArePlotsConfigurable = true while keeping the properties [Browsable(false)], I can still browse them in the indicator window, it is is an anomaly right ?
      am I still missing something there ?

      Comment


        #4
        Hello Amedeus,

        No that is normal, any time you have ArePlotsConfigurable and have used AddPlot that makes a custom entry in the property grid to edit the plot settings, that is a convenience so you don't have to implement separate properties for the plots color, style and width.

        The only way to completely hide plots from being configured would be to set ArePlotsConfigurable to false and that will remove those entries the next time the script is applied.

        If you are using a plot to just store data but didn't want to see it or have it configurable another option is to just use a Series<double> without AddPlot, that would just be for data storage and retrieval in the same way that a plot works.


        Comment


          #5
          Hey Jesse, thank you.

          No I intend to see the plots. I noticed they were browsable even set as false while investigating the remaing reflecting error, on wich I need to concentrate back now.

          Maybe we'll talk about this in a new topic.

          have a great WE.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          585 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          340 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X