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 sidlercom80, 10-28-2023, 08:49 AM
        167 responses
        2,260 views
        0 likes
        Last Post jeronymite  
        Started by warreng86, 11-10-2020, 02:04 PM
        7 responses
        1,362 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Perr0Grande, Today, 08:16 PM
        0 responses
        5 views
        0 likes
        Last Post Perr0Grande  
        Started by elderan, Today, 08:03 PM
        0 responses
        9 views
        0 likes
        Last Post elderan
        by elderan
         
        Started by algospoke, Today, 06:40 PM
        0 responses
        10 views
        0 likes
        Last Post algospoke  
        Working...
        X