Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to Save Chart Template

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

    Unable to Save Chart Template

    I was trying to enable color selection for my MACD crossover signal. I compiled the script with no errors. However, when i try to save a Chart Template (with the custom indicator) i get the error below:

    Error on getting value for property 'MACDColor for Ninjascript'. Object reference not set to an instance of an object.


    Here are the codes related to the object. What I'm I missing?

    MACDColor = Brushes.Blue;

    [NinjaScriptProperty]
    [XmlIgnore]
    [Display(Name="MACDColor", Order=3, GroupName="Parameters")]
    public Brush MACDColor
    { get; set; }

    [Browsable(false)]
    public string MACDColorSerializable
    {
    get { return Serialize.BrushToString(MACDColor); }
    set { MACDColor = Serialize.StringToBrush(value); }
    }

    #2
    Hello cryfgg,

    What is the default value you are setting to the MACDColor property in State.SetDefaults so it is not null?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello cryfgg,

      Where is that code?

      I wouldn't expect an error if it is being set in State.SetDefaults.

      Can you provide an export of the 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
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_ChelseaB View Post
        Hello cryfgg,

        Where is that code?

        I wouldn't expect an error if it is being set in State.SetDefaults.

        Can you provide an export of the 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


        I was able to figure it out. I had to remove and re-insert the indicator back into my chart for it to work.

        Comment


          #5
          Had the same problem on a simple string property. It was not being set in State.SetDefaults.
          The solution is set the field to blanks (or whatever value) in State.SetDefaults
          Recompile and restart the workspace. No need for removing the indicator from the chart.
          Good thing because this particular indicator was used all over the place.

          Code:
                  [NinjaScriptProperty]
                  [Display(Name="Text", Description="Simple text", Order=10, GroupName="Parameters")]
                  public string VerticalText
                  { get; set;}

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          649 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          370 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          574 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          576 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X