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

Newbie Help! WMA of RSI. RSI uses average price

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

    Newbie Help! WMA of RSI. RSI uses average price

    I'm trying to create a new indicator based on Weighted Moving Average (WMA) of RSI. RSI uses average price (O+H+L+C)/4

    #region Variables
    private int length = 14;
    private WMA RSIWAvg;
    private SMA RSIAvg;
    private RSI _RSI;
    #endregion



    protected override void OnBarUpdate()
    {
    price = (Open[0] + Close[0] + High[0] + Low[0]) / 4;
    _RSI = RSI((int)Price, Length);
    RSIAvg = SMA(_RSI, 100);
    RSIWAvg = WMA(RSI((int)Price, Length), 3);

    ...



    Does this make sense? For some reason I am not able to adjust the "length" setting in the indicator once it plots.

    Thanks much in advance!

    #2
    How does your Properties region look like here? You would need to create user defined inputs linked to your internal variables to be able to adjust the period length used 'on the fly' -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      I should clarify. I am able to change the Length parameter when the indicator is loaded, but changing the RSI Length parameter has no effect on the actual indicator. It seems "hardcoded" in some way. All of the code is this:

      price = (Open[0] + Close[0] + High[0] + Low[0]) / 4;
      _RSI = RSI((int)Price, Length);
      RSIAvg = SMA(_RSI, 100);
      RSIWAvg = WMA(RSI((int)Price, Length), 3);

      Then I'm simply plotting it.

      Here is the Properties Region FYI:


      [Description("")]
      [GridCategory("Parameters")]
      public int Length
      {
      get { return length; }
      set { length = Math.Max(1, value); }
      }




      Does the following make sense? I'm not sure because RSI(int period, int smooth). I'm looking for RSI to be calculated based on the average price of the bar, so I'm using this: _RSI = RSI((int)Price, Length);
      Last edited by naked; 04-14-2011, 05:38 AM.

      Comment


        #4
        I forgot to mention that I stated "price" to be a variable:

        private double price = 1;


        So in total it looks like this:

        #region Variables
        private int length = 14;
        private double price = 1;
        private WMA RSIWAvg;
        private SMA RSIAvg;
        private RSI _RSI;
        #endregion



        protected override void OnBarUpdate()
        {
        price = (Open[0] + Close[0] + High[0] + Low[0]) / 4;
        _RSI = RSI((int)Price, Length);
        RSIAvg = SMA(_RSI, 100);
        RSIWAvg = WMA(RSI((int)Price, Length), 3);

        Comment


          #5
          I'm not sure which RSI formula you're using here, but I would give _RSI = RSI(Typical, Length, 1); or _RSI = RSI(Weigthed, Length, 1); a try as it does include the needed smooth paramter in the RSI, though set to be always one in my example snippet above.
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by kempotrader, Today, 08:56 AM
          0 responses
          6 views
          0 likes
          Last Post kempotrader  
          Started by kempotrader, Today, 08:54 AM
          0 responses
          4 views
          0 likes
          Last Post kempotrader  
          Started by mmenigma, Today, 08:54 AM
          0 responses
          2 views
          0 likes
          Last Post mmenigma  
          Started by halgo_boulder, Today, 08:44 AM
          0 responses
          1 view
          0 likes
          Last Post halgo_boulder  
          Started by drewski1980, Today, 08:24 AM
          0 responses
          4 views
          0 likes
          Last Post drewski1980  
          Working...
          X