Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Indicators not Saving to charts on workspaces and chart templates

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

    Indicators not Saving to charts on workspaces and chart templates

    I have two custom indicators that will not save to chart templates or to charts on saved workspaces. Every time I load a workspace, I must manually apply these indicators. When I apply a chart template that containes these indicators, they do not appear on the chart. I have tried rebuilding workspaces with new charts and bui8lding new chart templates without success. When I manually apply these indicators they work correctly. I have several other custom indicators with do not behave this way, just only these two.

    Any suggestions on what I might have coded incorrectly?

    #2
    Hello MarthaClines,

    The most common reason is improperly serialized public objects.

    Are you seeing any errors appear in the Log tab of the Control Center when attempting to save the template or workspace?

    May I test an export of your script?

    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.
    http://ninjatrader.com/support/helpG...-us/export.htm
    Last edited by NinjaTrader_ChelseaB; 04-15-2019, 10:49 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello MarthaClines,

      The most common reason is improperly serialized public objects.

      Are you seeing any errors appear in the Log tab of the Control Center when attempting to save the template or workspace?

      May I test an export of your script?

      o export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
      1. Click Tools -> Export -> NinjaScript...
      2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
      3. Click the 'Export' button
      4. Enter a unique name for the file in the value for 'File name:'
      5. Choose a save location -> click Save
      6. Click OK to clear the export location message
      By default your exported file will be in the following location:
      • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
      Below is a link to the help guide on Exporting NinjaScripts.
      http://ninjatrader.com/support/helpG...-us/export.htm
      I received an email from Patrick that was in response to some questions from Chris on another issues that they are working on. I have attacked my workspaces, and all my custom indicators to that email. The subject of the email to platform support is Re: ATTN CHRIS S 2122296 2127361, and it outlines the two indicators that will not save to workspaces or chart templates. I really don't want to upload these indicators here for public viewing.

      Thanks

      Comment


        #4
        Hello MarthaClines,

        Does this confirm that there are no errors in the Log tab of the Control Center when saving a template?

        If the script cannot be posted publicly, can you copy the script and then remove the logic from OnBarUpdate() to reduce the script and post the reduced version?

        A reduced version of the script that can reproduce is always preferable. Reducing the script will often highlight the code causing the issue.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello MarthaClines,

          Does this confirm that there are no errors in the Log tab of the Control Center when saving a template?

          If the script cannot be posted publicly, can you copy the script and then remove the logic from OnBarUpdate() to reduce the script and post the reduced version?

          A reduced version of the script that can reproduce is always preferable. Reducing the script will often highlight the code causing the issue.
          The attached script is one of two with this problem. They will not have to workspaces or chart templates, but rathe must manually be loaded to each chart on each work station each time NT is started.

          I relay cant post the other. I am hoping the problem will be the same in both.

          Attached Files

          Comment


            #6
            Hello MarthaClines,

            Does this confirm that there are no errors in the Log tab of the Control Center when saving a template?

            I would expect this script you have provided to cause errors.

            This script cannot be serialized in a workspace or template because the attribute tags are not correct.

            If you want public inputs to be in the parameters window these must be using [NinjaScriptProperty].


            You cannot serialize a brush and this must be using the [XmlIgnore()] attribute. You must have a separate input that converts this to a string.

            Below is a public link to the help guide.


            Are you 100% there are no xml errors appearing in the Log?


            I recommend that you create the shell of these scripts with the Strategy Builder so that it constructs the frame and inputs for you so these are properly serialized. Then add the logic after.

            Below is a link to a forum post with helpful information about getting started with NinjaScript.


            The public double values should be using the Range attribute.


            Last, this is not as important, but you are using ResourceType = typeof(Custom.Resource) in the Display attribute. This likely won't hurt anything, but I am doubtful you actually have a resource dictionary that these values are supposed to pull from.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7

              Hello mopa4000,

              I'm not quite sure I understand. Do you have a question I may assist with?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hi - I am also not able to save an indicator to a chart when I save the workspace.
                I get the following error when I check the log file : - Could not save indicator 'NoBS4:' There was an error generating the XML document.

                The indicator compiles with no errors and works properly otherwise.
                Last edited by johnvnwp; 04-11-2021, 02:37 AM.

                Comment


                  #9
                  Hello johnvnwp,

                  Most likely there is an un-serialized public variable that is not an int, double, bool, string, or enum.


                  Check all of the public inputs. Do you see any inputs that are not int, double, bool, string, or enum? Are they using the XmlIgnore() attribute?

                  As a heads up, this will not cause a compile error as this is not a compile error. This is a run-time logic error and will appear on the Log tab of the Control Center.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Perr0Grande, Today, 08:16 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post Perr0Grande  
                  Started by elderan, Today, 08:03 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post elderan
                  by elderan
                   
                  Started by algospoke, Today, 06:40 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post algospoke  
                  Started by maybeimnotrader, Today, 05:46 PM
                  0 responses
                  12 views
                  0 likes
                  Last Post maybeimnotrader  
                  Started by quantismo, Today, 05:13 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post quantismo  
                  Working...
                  X