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 haas88, 03-21-2024, 02:22 AM
        18 responses
        207 views
        0 likes
        Last Post haas88
        by haas88
         
        Started by Board game geek, Today, 02:20 AM
        0 responses
        1 view
        0 likes
        Last Post Board game geek  
        Started by knighty6508, Today, 01:20 AM
        2 responses
        13 views
        0 likes
        Last Post knighty6508  
        Started by franatas, Today, 01:53 AM
        0 responses
        2 views
        0 likes
        Last Post franatas  
        Started by knighty6508, Today, 01:17 AM
        0 responses
        9 views
        0 likes
        Last Post knighty6508  
        Working...
        X