Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Pair Trading Strategy

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

    Pair Trading Strategy

    Dear Team,

    i am new to NT and I am struggling with developing a strategy on such conditions:
    1) If stock ABC’s change since opening lagged behind stock XYZ by 1%, then buy ABC and sell XYZ at current price.
    2) if the return of the open position is over 0.5%, close the positions.

    Can I do it in strategy builder?

    Thanks in advance!


    #2
    Hello cp1099a,

    Welcome to the NinjaTrader forums!

    You can use offsets with percent in the Strategy Builder and you can also add multiple instrument series.

    You can compare the Close of one series with an offset applied to the Close of another series.

    The Average position price can also have an offset of a percent applied.

    Below is a public link to the Strategy Builder 301 course.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      can you elaborate a bit on how to do it? I watched the video but still struggling to find a solution,

      Thanks,
      chuan

      Comment


        #4
        Specifically, where to find offset in Strategy Builder and to add multiple instrument and compare their results?

        Comment


          #5
          Hello cp1099a,

          Below is a link to a video that demonstrates adding a secondary series and selecting it in a condition.


          Attached is a screenshot of the offset for a low price of a secondary series that subtracts 3 ticks.
          Attached Files
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            This is really helpful! My additional question is: if I can to compare stock ABC’s price change since 9am today to stock XYZ’s price change since 9am, how can I do that?

            Comment


              #7
              Hello cp1099a,

              Using the same techniques to select a secondary series, you can use a time filter.

              Below is a public link to the help guide on an example of a time filter.


              And a link to a video.
              Understand the fundamentals of basic strategy creation by developing an actual strategy using the NinjaTrader Strategy Builder.2:45 Opening a Strategy Builde...
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hi Chelsea,

                I have played with Strategy Builder unfortunately am still struggling to find a solution. This is a condition I'd like to build:

                IF AAPL's price change in percentage since 9:30am today is higher than that of MSFT's (price change in percentage since 9:30am too) by 0.1%,

                then do something.

                Correct me if I am wrong, I can't build such condition in strategy builder without manually change the code?

                Thanks,
                Chuan


                Comment


                  #9
                  Hello Chuan,

                  The issue would be with the math required which is not possible with the Strategy Builder.

                  It would be necessary to unlock the script to do the math of the net change..

                  It may be possible to modify the Net change display indicator to set the currentValue to a plot so this can be called from the Strategy Builder..
                  Possibly this would allow you to add a series in the Strategy Builder and use this for the input series of the indicator call. If this were producing a percent as the value, this may be possible to use for your condition.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by trilliantrader, 04-18-2024, 08:16 AM
                  5 responses
                  22 views
                  0 likes
                  Last Post trilliantrader  
                  Started by Davidtowleii, Today, 12:15 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Davidtowleii  
                  Started by guillembm, Yesterday, 11:25 AM
                  2 responses
                  9 views
                  0 likes
                  Last Post guillembm  
                  Started by junkone, 04-21-2024, 07:17 AM
                  9 responses
                  69 views
                  0 likes
                  Last Post jeronymite  
                  Started by mgco4you, Yesterday, 09:46 PM
                  1 response
                  13 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X