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

Accessing User Parameters

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

    Accessing User Parameters

    I want to color price bars based on the value of the RSI. How should I construct the test to see if the value of the RSI is above or below the parameters the user selected for the upper and lower values? What variables hold the user selections for upper and lower parameters?

    #2
    Hello,

    These are found if you click on the grey Variables near the top of the code or the Properties box near the bottom. They are light grey.
    DenNinjaTrader Customer Service

    Comment


      #3
      Which Variable to Reference?

      This is the variables section -

      Code:
       
      #region Variables
      private DataSeries avgUp;
      private DataSeries avgDown;
      private DataSeries down;
      private int period = 14;
      private int smooth = 3;
      private DataSeries up;
      #endregion

      This is the properties section -

      Code:
       
      #region Properties
      /// <summary>
      /// </summary>
      [Browsable(false)]
      [XmlIgnore()]
      public DataSeries Avg
      {
      get { return Values[1]; }
      }
      /// <summary>
      /// </summary>
      [Browsable(false)]
      [XmlIgnore()]
      public DataSeries Default
      {
      get { return Values[0]; }
      }
      
      /// <summary>
      /// </summary>
      [Description("Numbers of bars used for calculations")]
      [Category("Parameters")]
      public int Period
      {
      get { return period; }
      set { period = Math.Max(2, value); }
      }
      /// <summary>
      /// </summary>
      [Description("Number of bars for smoothing")]
      [Category("Parameters")]
      public int Smooth
      {
      get { return smooth; }
      set { smooth = Math.Max(1, value); }
      }
      #endregion


      The RSI has two lines being drawn. The user can specify values for both the upper and lower lines. A gif of the settings that can be specifed by the user is attached.

      What variables would hold the value specified by the user for the upper and lower lines? What code would I use to test if the value of the RSI was above or below each of those two user specfied values.

      if RSI > ????????

      or if RSI <= ??????????

      Thanks
      Attached Files

      Comment


        #4
        drumholz, you could access those for example with this snippet call -

        Code:
         
        if (rsi > Lines[1].Value) ...
        This would access the second line's value, as the index is zero based...
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by PaulMohn, Today, 03:49 AM
        0 responses
        3 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        10 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        2 views
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Working...
        X