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 rhyminkevin, Today, 04:58 PM
        3 responses
        47 views
        0 likes
        Last Post Anfedport  
        Started by iceman2018, Today, 05:07 PM
        0 responses
        5 views
        0 likes
        Last Post iceman2018  
        Started by lightsun47, Today, 03:51 PM
        0 responses
        7 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        14 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        50 views
        0 likes
        Last Post futtrader  
        Working...
        X