Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pairs trading

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

    Pairs trading

    Hi,

    Im building a multi instrument strategy and am wondering if i can type 'enterlong' (and then the instument i want to enter long) and on the next line also 'enterlong' into a different instrument. So trying to enter MSFT and GOOG at the same time.

    Is this possible or would you need to write the same rules into 2 strategies?

    Thanks for all your help

    Freddy

    #2
    Freddy, you can build a single MultiInstrument strategy to do this, please have a look at the per default installed SampleMultiInstrument example we ship with NT.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      i have looked and apologise but cannot understand how to enter 2 different instruments at the same time as this example only enters one instrument.

      Thanks

      Freddy

      Comment


        #4
        Just add another EnterLong statement then and set the BIP parameter to the instrument you wish to submit to additionally.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks, could you explain a question please. I have tried to read the forum and the user guide as much as possible but am still struggling with the 'barsinprogress' concept.

          I have a system that looks at two instruments and will trade both instruments. Do I need for each 'if' statement a 'barsinprogress' or just one 'barsinprogress' statement at the beginning. I dont understand what the 'barsinprogress' is really doing.

          Thanks for your support.

          Freddy

          Comment


            #6
            Freddy, it would entirely depend on your script and conditions needed - the BarsInProgress is just property that would return you what BarsSeries is calling the OnBarUpdate(), as NT is entirely event based and not time based that would be very advantageous to know when working with multiple series / instruments.

            Please also see the code example for this topic we have in the help guide :

            BertrandNinjaTrader Customer Service

            Comment


              #7
              OK,

              Also, I am trying to use Open [BarsSinceSession( )] [0] to get the price of the open of the trading day, but am not sure if the syntax is correct.

              As I am building a multi instrument system, do I need to change syntax to something like

              Opens[BarsSinceIndex(1,"",0) [0] ??

              Comment


                #8
                It would be easier if you used CurrentDayOHLC.CurrentOpen[0] then for this task :

                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  What statement would I put into the 'barsago' bracket to look up a certain time such as 9.30am without having to put in a date?


                  Opens[1][GetBar(0,DateTime()]


                  This is what I have been trying to use, however it always asks for a date, how can i get around this.

                  Thanks for all your help

                  Freddy

                  Comment


                    #10
                    Hi Freddy,

                    The method expects a date time input, so you must put in a valid date/time input there. There is a lot of flexibility with dot net's built in date time structure. General help for working with date / time objects is available here:


                    If you want to build a date time object using a combination bar time stamps / custom time, you could use something like this:

                    DateTime myDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 9, 30, 0);
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      Thanks for that,

                      Also was wondering how to incorporate bid ask spread into the backtest. Is there a function like the slippage function, where I can quickly apply it?

                      If you'd need to use the NinjaScript, would you use GetCurrentAsk/Bid? If so, would you need to add another bar series?

                      Comment


                        #12
                        If you backtest your strategies, you can enter the slippage for market / stop market orders in ticks -



                        This can be set though from the Strategy Initialize() as well:



                        You could add bid / ask series as well to execute then directly on those using our MultiSeries framework:

                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Thanks!

                          With a free version of ninjatrader can you trade real time with a demo account or do you need to purchase ninjatrader to do this as when i try connecting the message,

                          'login failed, most likely you do not have installed the recommended version of MBT navigator.
                          please download from ninjatrader.com

                          Thanks for all your great support

                          Freddy

                          Comment


                            #14
                            You're welcome, for real time simulation trading on the NT internal Sim101 you can use the free version, however to trade any external account at your broker (be it demo or live) you would need the standard edition license of NT.

                            The needed MBT Nav version is always downloadable from us directly :

                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              Thanks,

                              I have a question about limit orders. I am trading around a number, say $10 and I go long at $10.01 and short at $9.99 and want to have a limit order that gets me in at each direction.

                              I was wondering if I could have a limit long order when I am short and a limit short order when I am long, so that the trades would automatically execute with the change in the market.

                              Also, can you have a rule saying BarsSinceExit?

                              Thanks,
                              Freddy

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by algospoke, Yesterday, 06:40 PM
                              2 responses
                              18 views
                              0 likes
                              Last Post algospoke  
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              44 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              180 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X