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

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 Christopher_R, Today, 12:29 AM
          0 responses
          6 views
          0 likes
          Last Post Christopher_R  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          166 responses
          2,235 views
          0 likes
          Last Post sidlercom80  
          Started by thread, Yesterday, 11:58 PM
          0 responses
          3 views
          0 likes
          Last Post thread
          by thread
           
          Started by jclose, Yesterday, 09:37 PM
          0 responses
          7 views
          0 likes
          Last Post jclose
          by jclose
           
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          10 responses
          1,415 views
          0 likes
          Last Post Traderontheroad  
          Working...
          X