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

Sample Pair Trading Strategy using Strategy Builder?

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

    Sample Pair Trading Strategy using Strategy Builder?

    I added 2 data series that I want to use
    EURUSD (1min) and GBPUSD (1min)

    Under Strategy Builder's Condition and Action page
    How do I Simultaneously
    Enter Long EUSUD
    Enter Short GBPUSD


    When
    RSI of
    EUSUD
    is <30
    RSI
    of GBPUSD is >70

    I attached the screenshot.





    #2
    Hello johnnybegoode,

    Thanks for your post.

    The Strategy Builder will only send orders to the charts data series.

    To accomplish your goal you would need to unlock your code and work directly in Ninjascript to use the advanced order methods to place orders to different bars in progress.

    Please review https://ninjatrader.com/support/help...nstruments.htm for an understanding of programming multi-series strategies. For the advanced order methods, please see the help guide section here: https://ninjatrader.com/support/help...r_handling.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Does NinjaTrader support trading two different symbols on one chart?

      I asked a programmer to code for me and he could not do it.

      Comment


        #4
        Hello johnnybegoode,

        Thanks for your reply.

        Yes, you can trade each instrument of a multi symbol chart. Please see, "Working with multiple instruments" https://ninjatrader.com/support/help...on_display.htm

        You can trade multiple symbols in a Ninjascript created strategy.
        Last edited by NinjaTrader_PaulH; 11-28-2018, 08:43 AM. Reason: Corrected reply.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello johnnybegoode,

          After further review, I am mistaken in my previous reply and will correct the post.

          Yes, you can trade each instrument of a multi symbol chart. Please see, "Working with multiple instruments" https://ninjatrader.com/support/help...on_display.htm
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Programmer:
            NT can display more than 1 symbol on 1 chart, and you can trade any 1 of those symbols on the chart. But I guess you should ask them how to trade two different symbols at the same time from one strategy scripts.

            Comment


              #7
              Hello johnnybegoode,

              Thanks for your reply.

              Yes, trading multiple symbols can be done through a single ninjascript strategy (not through strategy builder). Please see https://ninjatrader.com/support/help...nstruments.htm


              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Question 1 is from my programmer:
                Interesting, I know NT can trade secondary symbol by calling the Add() method, but it's not the chart symbol.

                Did you ask them to trade secondary symbol based on the chart like the attached photo?
                The strategy scripts can trade all chart symbols without calling the Add() method at all???


                Question 2
                Do you have examples of multi-instrument strategy and pair trading strategy?

                Thank you!

                Comment


                  #9
                  Hello johnnybegoode,

                  Thanks for your reply.

                  The screenshot appears to be from NinjaTrader7. If you are using Ninjatrader7 please let us know as my replies to you have been based on NinjaTrader8 as you posted in the NinjaTrader8 strategy development area and your original post shows Ninjatrader8 type screens.

                  Q1. We've discussed trading on the chart with the chart trader and how manually you can trade the instruments on the chart (which cannot be done in NT7). For a Ninjascript strategy, the strategy will use the charts primary data series as its primary data series and to trade any other instrument, the instrument would need to be added to the strategy through the NT8 method AdddataSeries().

                  Q2. The NT7 or NT8 platform has a strategy called SampleMultiInstrument which demonstrates trading on more than one instrument.
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Programmer's reply:
                    OK, use this pic, same question, is possible to use strategy scripts trade all chart symbols without calling the Add() method at all???

                    Comment


                      #11
                      Hello johnnybegoode,

                      "is possible to use strategy scripts trade all chart symbols without calling the Add() method at all???" There are no ninjascript means to accomplish that. For a Ninjascript strategy, the strategy will use the charts primary data series as its primary data series and to trade any other instrument, the instrument would need to be added to the strategy through the NT8 method AdddataSeries().
                      Paul H.NinjaTrader Customer Service

                      Comment


                        #12
                        Programmer's reply:
                        That's what I told you, it's impossible to trade more than one chart symbol.
                        It can only trade the primary symbol on chart.
                        Now you get the official answer from NinjaTrader.

                        Your SampleMultiInstrument does not work!!!
                        Last edited by johnnybegoode; 12-02-2018, 06:12 PM.

                        Comment


                          #13
                          Hello johnnybegoode,

                          Thanks for your reply.

                          The example SampleMultiInstrument will use a second instrument to calculate the ADX from. I was mistaken that this example shows entering orders on two different instruments as it only uses data from another series to calculate the ADX.

                          I've created a short video example with a simple script that demonstrates filling a strategy order for two instruments in one script: https://Paul-ninjaTrader.tinytake.co...IyM185MzgzOTkz

                          Paul H.NinjaTrader Customer Service

                          Comment


                            #14
                            Hi Paul, can I backtest multiple instrument strategies on historical data? I created a simple strategy which trades 2 instruments, but it doesn't execute any trades against the 2nd instrument when I do a backtest.

                            Comment


                              #15
                              Hello mic414,

                              Thanks for your post.

                              Regarding the generic question, "can I backtest multiple instrument strategies on historical data? ". Yes, you can backtest multiple instruments by selecting an instrument list as the instrument.

                              Regarding, "I created a simple strategy which trades 2 instruments, but it doesn't execute any trades against the 2nd instrument when I do a backtest." If your strategy code uses "addDatasereis(...), then you would need to make sure you are coding with the advanced order methods where the orders are placed relative to BarsInProgress or are bracketing according to BarsInProgress. For further details, please see "Entering, Exiting and Retrieving Position Information" in https://ninjatrader.com/support/help...nstruments.htm (We recommend a review of the entire link for a comprehensive view).
                              Paul H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by FishTrade, Today, 03:42 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post FishTrade  
                              Started by Richozzy38, Today, 01:06 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post Richozzy38  
                              Started by ttrader23, Today, 09:04 AM
                              2 responses
                              12 views
                              0 likes
                              Last Post ttrader23  
                              Started by geotrades1, Today, 07:54 AM
                              10 responses
                              26 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by ninza33, Yesterday, 12:31 PM
                              3 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Working...
                              X