• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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;
        
        Period = 3;
                        Multi = 4;
        
                        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
        Patrick H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by gngmpwdws, Today, 09:58 PM
        0 responses
        1 view
        0 likes
        Last Post gngmpwdws  
        Started by darkgreen, Today, 03:35 PM
        1 response
        12 views
        0 likes
        Last Post lmatiukas  
        Started by imalil, Today, 09:46 PM
        0 responses
        6 views
        0 likes
        Last Post imalil
        by imalil
         
        Started by SAITON, Today, 09:03 PM
        0 responses
        5 views
        0 likes
        Last Post SAITON
        by SAITON
         
        Started by suprsnipes, Today, 08:26 PM
        0 responses
        5 views
        0 likes
        Last Post suprsnipes  
        Working...
        X