Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Could not save indicator 'blabla', how I can I resolve this??

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

    Could not save indicator 'blabla', how I can I resolve this??

    I might be wrong in the assumption it was not already asked and I was not looking for it the proper way....but...

    Could not save indicator 'BlaBla:' There was an error reflecting type 'NinjaTrader.NinjaScript.Indicators.BlaBla' .

    This is an annoying error, as it does not show what is wrong. I am not asking for someone to resolve this error, I like to do this myself, but how? I use Visual Studio, but can work also in the standard editor.

    Is there some log file I can look into?​

    #2
    Chances are one or more of your public properties
    cannot be properly serialized.

    For ex, brushes require extra work to make them
    serializable.

    See here,


    Comment


      #3
      Originally posted by tullips View Post
      Is there some log file I can look into?
      Have you looked at the 'Log' tab?

      The messages in the 'Log' tab are reflected in
      files stored in the 'log' folder.

      Another location with accumulated error messages
      are the files stored in the 'trace' folder.

      Comment


        #4
        Hello tullips,

        Thanks for your post.

        bltdavid has provided some great information on this matter.

        The error is likely being thrown because a public property in the script cannot be serialized. For example, it could be a public Brush property in your script as bltdavid noted.

        Adding [XmlIgnore] to the public property could resolve the error.

        You could find the line(s) of code causing the error by reducing the code and testing to see if the error persists. For example, you could uncomment public properties one by one in the script and test to see if the error persists. If you uncomment the lines of code for a public property and see the error stop, the property you just uncommented is likely causing the error to occur.

        See this help guide page for more information on XmlIgnoreAttribute: https://ninjatrader.com/support/help...eattribute.htm

        Also, see the 'Working with Brushes' help guide page bltdavid shared a link to in post # 2 for more information about working with brushes in NinjaScript.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Hello you both

          As I was not able to sleep, I went out of my bed at 2 am and did find the error (a typical programmer's decease, not being able when ...)

          The issue was simple; I was stating a private var as a public var, but this was not seen in the log. I think what throws you off is when it compiles and works fine, but when trying to save the template it fails (showing the error in the NinjaScript Output window).

          Perhaps the Ninja Team can opt for the 'possible issues or things that create these errors' web page, linked from the Output window when this error occurs? Self-help will help the Ninja Team save a lot of time.

          Anyway, thanks for answering and I hope my question, your answers, and my resolve will help others as well...I wish all just able to sleep well

          Comment


            #6
            Having same issue. Didnt have this until latest NT release. A few of the indicators dont load. When I hit F5 they load. Also, very strange, when I right click on chart then properties then select "Allow the selection or drag/drop chart series" and select it. If I then save the preset of the chart and the workspace it doesnt save.

            Comment


              #7
              Hello SpartanGR77,

              Thanks for your notes.

              This forum thread is about the error message There was an error reflecting type 'NinjaTrader.NinjaScript.Indicators.<indicator name> when trying to save an indicator to a template.

              To clarify, are you seeing this error message appear in the Log tab of the Control Center when trying to save an indicator to a template?

              If so, is the indicator one that you programmed yourself, is it an indicator from a third-party developer, or is it a NinjaTrader system indicator (such as SMA)?

              If you are not seeing this error message, please write in to platformsupport[at]ninjatrader[dot]com with a brief description of your question and a NinjaTrader Support technician will be happy to assist you.
              <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

              Comment


                #8
                Hi Brandon, thanks for reacting, and as you have seen in my response, I did find the issue. Sometimes the error is so small that the program still runs, but it is not clean and this will prohibit the saving to a template.

                So, for each that is having this issue, start with simple debugging by excluding parts of the program, or even better, when you do source control and you have your previous version on GitHub, create a new indicator as a template with a similar name, copy the bad into there, get your old, and take it from there.

                It is tedious work, but can save you days of headaches. Just take baby steps....

                Comment


                  #9
                  Originally posted by tullips View Post
                  The issue was simple; I was stating a private var as a public var
                  Uh, yeah ... sorry about that ...

                  I should have said public properties and public variables.

                  Because, when it comes to Xml serialization, by definition, all
                  public properties and public variables will be serialized.

                  As your case shows, variables inadvertently marked as public
                  can cause problems -- esp if these variables are of a complex
                  type that doesn't have builtin serializers.

                  The solution (when you really need a variable to be public)
                  is to adorn that public variable with the [XmlIgnore] attribute.

                  Otherwise, the easier solution is to make the variable private.

                  -=o=-

                  Pro Tip: Always check the log/trace files -- sometimes the
                  trace file provides more detail to the error message. You
                  should make it a habit to always look inside the trace file
                  when trying to solve runtime errors.



                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  85 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  47 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  29 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  32 views
                  0 likes
                  Last Post TheRealMorford  
                  Started by Mindset, 02-28-2026, 06:16 AM
                  0 responses
                  67 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Working...
                  X