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

Strategy Template

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

    Strategy Template

    Hello!

    Help me please. I have the Strategy with some default parameters. This parameters I can change in the Settings.

    Part of the code with this parameters:

    [Range(0, 100),NinjaScriptProperty]
    [Display(Name = "Quantity", Order = 10, GroupName = "MA")]
    public int Qty1 { get; set; }

    [NinjaScriptProperty]
    [Display(Name = "MA Type 1", Order = 20, GroupName = "MA")]
    public MAType MAType1_1 { get; set; }

    [Range(1, int.MaxValue),NinjaScriptProperty]
    [Display(Name = "Fast MA", Order = 30, GroupName = "MA")]
    public int Period1_1 { get; set; }

    [NinjaScriptProperty]
    [Display(Name = "Color Fast MA", Order = 32, GroupName = "MA")]
    public Brush BrushMA1_1 { get; set; }

    [NinjaScriptProperty]
    [Display(Name = "Width Fast MA", Order = 35, GroupName = "MA")]
    public int WidthMA1_1 { get; set; }


    BUT when I saved some random other parameters in Template - I don't see this parameters when I read it from this Template.

    When I open XML file with this template - I see only default parameters and don't see default parameter for color MA (Brush BrushMA1_1)

    what i don't see?

    Thanks​

    #2
    Hello vitaly_p,

    A Brush cant be saved, you need to make a helper property to save a brush.

    You can generate that code using the new indicator wizard or also see the following guide on working with brushes: https://ninjatrader.com/support/help...definedbrushes
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you Jesse.

      What about Parameter "Quantity"? I have 1 by default and if I change it to 10 (for example) and save to Template - after reading from Template I have 1, not 10.

      and with bool parameter the same problem

      [NinjaScriptProperty]
      [Display(Name = "Eastern Standard Time", Order = 140, GroupName = " 03. Time")]
      public bool IsET { get; set; }

      default parameter is "true", but when I change it to "false" in the Settings and save to Template - the same result... default state... not from Template..​

      Comment


        #4
        Hello vitaly_p,

        What about Parameter "Quantity"?
        The name you use wont be saved it would be the property name Qty1.

        Simple properties can be saved in a template. If you are not seeing a change that would indicate the template was either not saved or if you had the template open in an external text editor that may not be updated or it may have blocked it from being saved. Make sure you have external text editor which reads the template file closed before trying to save it and always re open the file after saving it.


        JesseNinjaTrader Customer Service

        Comment


          #5
          I changed Brush parameter to:

          [XmlIgnore()]
          [Display(Name = "Color Fast MA", Order = 32, GroupName = "MA")]
          public Brush BrushMA1_1 { get; set; }

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

          and nothing...

          and YES, I use name "Qty1""

          [Range(0, 100),NinjaScriptProperty]
          [Display(Name = "Quantity", Order = 10, GroupName = "MA")]
          public int Qty1 { get; set; }​

          and nothing too....

          I saved 3 Template with different names... without positive result...​

          Comment


            #6
            after loading Template I see default Settings...

            Comment


              #7
              Hello vitaly_p,

              If there is an error in saving the template that would be another reason why its not changing, are you checking the Log tab after trying to save the template?

              You mentioned you saved it 3 different times with different names, are those showing up in the folder? If so and if they are showing defaults that indicates you have something incorrect in the script. Please try using the Indicator wizard to generate your inputs and then test saving that empty indicator with different defaults for the inputs.
              JesseNinjaTrader Customer Service

              Comment


                #8
                yes, I see all three files.

                Ok, I will try it.

                Thank you Jesse

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by quantismo, 04-17-2024, 05:13 PM
                5 responses
                32 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by proptrade13, Today, 11:06 AM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by love2code2trade, 04-17-2024, 01:45 PM
                4 responses
                34 views
                0 likes
                Last Post love2code2trade  
                Started by cls71, Today, 04:45 AM
                2 responses
                10 views
                0 likes
                Last Post eDanny
                by eDanny
                 
                Started by kulwinder73, Today, 10:31 AM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Erick  
                Working...
                X