Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to trade SPY by putting orders on ES? (MultiInstrument trading)

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

    How to trade SPY by putting orders on ES? (MultiInstrument trading)

    Is it possible in Ninja Trader to put orders on chart trader on ES chart and then, when this order is triggered, it simultaneously executes market order on SPY. I would put this first order on ES manually, but I need it to execute market order on SPY automatically.

    For example, I put buy stop order ES at 1250.25. This order is triggered and then market order buys SPY at 125.04.

    Can it be done with some indicator or strategy? I would like to have it so I could trade ETFs, while doing analysis on futures charts.

    As I see it, indicator should have two inputs - first is the ticker of the other instrument (in this case SPY) and quantity for the other instrument. Maybe someone already made something like that for pair trading.

    I think it should be simple, but I don't have that kind of programming skills, so please help.

    #2
    zoki.rb, you could custom code this with a MultiSeries strategy in NinjaTrader, for an example see please the SampleMultiInstrument we install with every NT per default.

    The complete framwork used is documented here -

    Comment


      #3
      And how to get this strategy buy ES on simulation account and SPY on real account?

      I see how I could make automated strategy, but I want to trade discretionary and put this discretionary trades for ES on the simulated acc and then, somehow, this trades should trigger market orders on SPY.
      Last edited by zoki.rb; 01-16-2012, 11:18 AM.

      Comment


        #4
        Yes, you would need to change the instruments it would execute in the code directly, for example for the current ES try ES 03-12 as instrument, the account would be whatever you set the strategy to run on as you start it up from the chart or strategies tab.

        Comment


          #5
          Ok, I think I figured that out, thanks.

          But I have another problem, when I add another instrument on the chart equidistant bar spacing turns false. Since I trade on volume chart I need to view ES with equidist. bars. Is there a way to make this strategy buy SPY while it is not added on the same chart as ES?

          Comment


            #6
            Yes, you don't have to add any series to the chart running the strategy, the data needed is internally added by NT, so it's not taken only from the chart, so explained another way: a single series chart could run a MultiSeries strategy - or you run them on separate charts so you're ES chart continues to use Equidistance bars spacing as you desire.

            Comment


              #7
              ok, I got to this point... it seems to execute something when strategy is running and I buy primary instrument.

              I tried it with CL and ES.

              here is what I got in strategies tab in attachment.

              and here is the code

              Code:
                  public class ESTrader : Strategy
                  {
                      #region Variables
                      // Wizard generated variables
                      private string secondInstrument = "ES 03-12"; // Default setting for SeconInsturment
                      private int quantity = 1; // Default setting for Quantity
                      // User defined variables (add any user defined variables below)
                      #endregion
              
                      /// <summary>
                      /// This method is used to configure the strategy and is called once before any strategy method is called.
                      /// </summary>
                      protected override void Initialize()
                      {
              			Add(secondInstrument, PeriodType.Volume, 200);
                          CalculateOnBarClose = true;
              		}
              
                      /// <summary>
                      /// Called on each bar update event (incoming tick)
                      /// </summary>
                      protected override void OnBarUpdate()
                      {
              			
              		if (BarsInProgress == 1 && Positions[0].MarketPosition != MarketPosition.Flat)
                  {
                       
                       EnterLong();
                  }
                      }
              but even if this strategy would work, how could I still use chart trader to put my trades for primary intrument when adding this strategy disables it?!
              Attached Files

              Comment


                #8
                If you have the strategy running from the strategies tab, the ChartTrader would not be disabled, keep in mind when run from the strategies tab, the resulting trades are not visualized on any chart.

                Comment


                  #9
                  I forgot that it is holiday in USA so ES is not trading atm. But I changed to QM 02-12 and still the same result

                  Comment


                    #10
                    All markets are likely to be pretty slow from this point onwards until the US goes back to more regular business hours. I don't see how this would work, as you never enter any trades for the primary instrument via the strategy, hence the position check would never result in any trade being triggered for the second instrument. The strategy does not recognize your manual trades, it would work independently from them.

                    Comment


                      #11
                      Can I make it to recognise my manual trades?

                      Comment


                        #12
                        Hello,

                        Thanks for the note.

                        Unfortunately a strategy would not be aware of any manual trades. Strategies always work as a black box unaware of its surroundings and simply sending the roders its programmed to send.

                        -Brett
                        BrettNinjaTrader Product Management

                        Comment


                          #13
                          ok. thanks!

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          648 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          369 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          108 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          572 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          574 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X