Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator will not save with the workspace

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

    Indicator will not save with the workspace

    Hello,

    I recently created an indicator and shared it to the community. Unfortunately, I discovered (and some other folks also discovered) that the indicator will not save with the workspace. I add the indicator to my chart, save the workspace and exit NT8. The next time I open my workspace, my indicator is not there and it must be added to the chart again. When I add it to the chart, it works perfectly fine. I cannot figure out why this is happening. This issue also happens if I save the chart as a template and try to load the template.

    This morning I went so far as to completely reprogram the indicator from scratch but even the new version of the indicator is doing this. I have written other sample and test indicators and they are working fine. I've gone through this indicator line by line and I cannot for the life of me understand why it will not stay saved on the chart.

    Any ideas are welcome at this point.

    Thanks!

    #2
    Hello daskatzen,

    Do you have a link to the code for the indicator so I can get an idea what may be happening?

    When something is failing to save or load that generally relates to its public properties. You can save the workspace and then view the control center log tab to check for errors during saving. The same can be done if you load a workspace, any loading errors would be in the log.

    Public properties need to be a simple type to be saved, for example a string property can be directly saved but a Brush needs extra logic to be saved.

    Comment


      #3
      Jesse,

      It's called "Simple Leg Counter". This should be the link.
      This is my first attempt to program an indicator for NinjaTrader. The Simple Leg Counter is used to count the pullbacks in a trend. A new trend will start at zero then begin counting every pull back until there is a reset. For example, an uptrend will begin at zero and the indicator will label […]


      I found this message in the log:

      Could not save indicator 'LegCounter'. There was an error generating the XML document.

      Then also this one..

      Failed to restore Indicator 'Unknown'. Most likely (a) the implementation changed or (b) one or more properties have been renamed or removed or (c) the custom assembly which implements this indicator no longer is there.

      LegCounter is what I called the same indicator that I reprogrammed today.

      Comment


        #4
        Hello daskatzen,

        Yes it looks like that is due to the brushes. To correctly define a brush you need to not save the brush property directly and use a secondary property. The easiest way to generate this code is to make a new indicator and in the indicator wizard add the brush user inputs that you want and click generate. The code will look like the following:

        Code:
        [NinjaScriptProperty]
        [XmlIgnore]
        [Display(Name="TestBrush", Order=1, GroupName="Parameters")]
        public Brush TestBrush
        { get; set; }
        
        [Browsable(false)]
        public string TestBrushSerializable
        {
            get { return Serialize.BrushToString(TestBrush); }
            set { TestBrush = Serialize.StringToBrush(value); }
        }
        ​​

        Comment


          #5
          I'll give that a shot. Thank you!

          Comment


            #6
            Just a quick follow-up to let you know that this fixed the issue. I will be amending my script that I shared. Thanks again!

            Comment


              #7
              Hello Sir Please check all parameters are private

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              582 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              338 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