Announcement

Collapse
No announcement yet.

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.



    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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      79 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X