Announcement

Collapse
No announcement yet.

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

    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.


        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.

              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 NullPointStrategies, Yesterday, 05:17 AM
                0 responses
                56 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                133 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                73 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                45 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                49 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X