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 cmoran13, Yesterday, 01:02 PM
            0 responses
            29 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            21 views
            0 likes
            Last Post PaulMohn  
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            160 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            95 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            148 views
            2 likes
            Last Post CaptainJack  
            Working...
            X