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

Compute indicator values within a strategy on midpoints rather than bar closes

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

    Compute indicator values within a strategy on midpoints rather than bar closes

    Hello,

    I did a quick search on forums and couldn't find a solution, so apologies if this has been answered before, but I was wondering if there was an easy way to compute indicator values on something other than the closing bar prices.

    Specifically would like to pass in something like: (open + close) / 2 as my series, and compute RSI, or MACD values based on those values.

    Is there a relatively painless way to do that in code (modification to: BarsArray[0].RSI(14,1)[0]) rather than importing an entire unique data set?

    Thanks!


    #2
    Hello slocumtrader,

    Thanks for your post.

    By default, most indicators will use the Close price type series.

    There are other price type series that you can use, here is the list:

    Open
    High
    Low
    Close (default)
    Typical = (High + Low + Close) / 3.
    Median = (High + Low) / 2.
    Weighted = (High + Low + Close + Close) / 4.

    So for your RSI or MACD example, you would choose the "Typical" price type. This is done when you select the indicator in the Indicator panel. Locate the "input series" row and left-click on the current selection. A window titled "Input series" appears, on the left side click the "drop-down" arrow in the "price type" field and choose Typical.



    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul,

      Thanks for the fast response. Running through the strategy wizard I did follow the steps you outlined and generated the code:

      RSIindicator = RSI(Typical, 14, 1);

      For (open+high+low)/3 RSI indicator values.

      Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by inanazsocial, Today, 01:15 AM
      0 responses
      2 views
      0 likes
      Last Post inanazsocial  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      5 responses
      22 views
      0 likes
      Last Post trilliantrader  
      Started by Davidtowleii, Today, 12:15 AM
      0 responses
      3 views
      0 likes
      Last Post Davidtowleii  
      Started by guillembm, Yesterday, 11:25 AM
      2 responses
      9 views
      0 likes
      Last Post guillembm  
      Started by junkone, 04-21-2024, 07:17 AM
      9 responses
      71 views
      0 likes
      Last Post jeronymite  
      Working...
      X