Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to program a compound instrument (pair trade)

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

    How to program a compound instrument (pair trade)

    Hi,

    How would I go about programming a strategy based on the ratio between two instruments. e.g.:

    SPY/AA

    Ideally, the strategy should be able to plot SPY/AA bars, but failing that, it could just plot them as though it were an indicator.

    I would then like to run standard indicators on the instruments (e.g. RSI, SMA).

    I tried capturing the ratio in a data series and then using Add(RSI(ratio, ...)) on the data series but the indicators were plotted using the first instrument in the strategy.

    Kind regards

    #2
    aomega,

    Strategies only plot the primary instrument. Secondary instruments are "hidden" or running in the background.

    For more information on multi-series strategies please see this article: http://www.ninjatrader-support.com/H...struments.html
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thank you. I know how to add multiple bar series to the strategy, I want to know how to make a bar or data series that's made out of the ratio between two instruments.

      Since I can't add a graph for it, it should be sufficient to make a data series that's derived from the two bar instruments. e.g. the members of the series would be Instrument1 divided by Instrument2. I can do this.

      I'd like to plot that data series and also run indicators on it, such as RSI, SMA etc. and plot those. I can't do this.

      Kind regards

      Comment


        #4
        You can only plot on the primary series. This is a reference sample of plotting from other series that is provided as-is. It has its limitations. http://www.ninjatrader-support2.com/...ead.php?t=6651

        To make a DataSeries, please see the Help Guide article on how to set those up. Then it is just a matter of running your ratio calculations and setting the DataSeries to take those on.

        Running indicators on the DataSeries is no problem. For example:
        Code:
        SMA(myDataSeries, 20)[0];
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          this explanation is good.... but nee much more...

          __________________
          Compound Interest Formula

          Comment


            #6
            Pannoowau, what else would you like explained? You could always create a new thread if you feel the need.
            AustinNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X