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

NT7 conversion

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

    #16
    Hello 2Look4me,

    Thanks for the reply.

    You must have that decorator for the property to show up in the property grid of the user interface. You can still have public properties that can be called from the script, they just won't be included in the constructor.

    For the protection level, that means you are trying to access a private property of the indicator and you must either make a public property that returns the private properties value, or make the property itself public.

    Please let me know if I can assist further.
    Chris L.NinjaTrader Customer Service

    Comment


      #17
      Thanks for the explanation.
      In Properties I have:
      Code:
      [Description("Color price bars mirrored from histogram data.")]
              [Category("Sound and Display")]
              [Gui.Design.DisplayName("Color Price Bars?")]
              public bool ColorBars
              {
                  get { return colorBars; }
                  set { colorBars = value; }
              }
      In the help guide I didn't come across the NT8 equivalent for: "Gui.Design.DisplayName" and "colorBars"

      Comment


        #18
        Hello 2look4me,

        Thank you for your response.

        In the properties do the following:
        Code:
                [Range(1, int.MaxValue), NinjaScriptProperty]
                [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptStrategyParameters", Order = 0)]
                public int Period
                {
                    get; set;
                }
        
                [Range(0, double.MaxValue), NinjaScriptProperty]
                [Display(ResourceType = typeof(Custom.Resource), Name = "Multi", GroupName = "NinjaScriptStrategyParameters", Order = 1)]
                public double Multi
                {
                    get; set;
                }
        Code:
        Then you can remove the following:
        private int period = 3;
        private double multi = 4;
        And add the following in OnStateChange():
        Code:
                protected override void OnStateChange()
                {
                    if (State == State.SetDefaults)
                    {
                        Description                    = @"ATR = 3.0 and multi 2.7";
                        Name                        = "ATRTrailingStop";
                        IsAutoScale                    = false;
                        IsOverlay                    = true;
                        IsSuspendedWhileInactive    = true;
                        DrawOnPricePanel            = false;
                        Calculate                   = Calculate.OnPriceChange;
        
        [B]Period = 3;
                        Multi = 4;[/B]
        
                        AddPlot(new Stroke(Brushes.Black,2),    PlotStyle.Line, "ATRTrailingStop");
                    }
                }
        Attached is a version of the indicator with these changes.

        Please let me know if you have any questions.
        Attached Files

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,789 views
        0 likes
        Last Post aligator  
        Started by Jimmyk, 01-26-2018, 05:19 AM
        6 responses
        837 views
        0 likes
        Last Post emuns
        by emuns
         
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,293 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        13 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        63 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X