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

Multi-Instrument using Strategy builder

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

    Multi-Instrument using Strategy builder

    Hello,
    I have created a strategy with NQ (primary symbol), and ES in additional data, and entered NQ as series (in misc for signal condition) for all my set of conditions 1, and ES as series (in misc for signal condition) for all my set of conditions 2.

    I tried to optimize my strategy in strategy tester and it only opens NQ.
    It never opened ES.
    Am I doing something wrong?

    Please note that I am using NQ as instrument in data series in strategy tester.

    Please help.

    Thanks in advance.

    #2
    Hello markkm,
    Thanks for your post.


    Does this happen on the SIM101 account too?

    Have you confirmed conditions are being met with Print() statements?


    What is your condition?

    What parameter are you trying to optimize?

    Are you checking for the appropriate BarsInProgress?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Does this happen on the SIM101 account too?
      It's on a simulated account.

      Have you confirmed conditions are being met with Print() statements?
      I am sorry, but I have no knowledge on programming.

      What is your condition?
      Stochastic, numerical value less than 20 for BUY entries on set #1 for NQ
      Stochastic, numerical value less than 20 for BUY entries on set #2 for ES

      What parameter are you trying to optimize?
      I am trying exit conditions, Target profit, stop loss.

      Are you checking for the appropriate BarsInProgress?
      I am not sure what you mean with this, but I am using each tick, and not at close bar.

      Comment


        #4
        The first thing I want you to do requires unlocking the code. Once the code is unlocked it will no longer be able to be edited with the Strategy Builder. If you want to go this route than I suggest removing
        Code:
        if (BarsInProgress != 0) 
        	return;
        from the top of OnBarUpdate() and trying to optimize again after compiling. I suspect that if your conditions are becoming true for order entry that you will now see results for both instruments.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          It works!
          Thank you very much for your help

          Comment


            #6
            If I have multi-instruments, is there a way to assign a symbol in actions e.g. "enter long" on ES?

            Here's an example of what I am trying to do:
            -In set 1, condition: entry based on stochastic for ES, action: "enter long" on ES
            -In set 2, condition: entry based on RSI for NQ, action: "enter long" on NQ
            my problem is: If conditions of set 1 are met, then it opens ES, and NQ. I'd like it to open only NQ.

            Thanks!

            Comment


              #7
              I am sorry, I meant - I'd like it to open only ES -

              Comment


                #8
                There will be no way to specify a certain BIP value in the Strategy Builder. You would need to unlock the code to do anything other than calculations with the additional Data Series'

                Are you trying to enter in to multiple positions at a time?

                Do you want to place an order to go long one ES contract and then want to increase your position size based on the RSI for the NQ?
                Josh G.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks for you prompt response!
                  I am trying to go long on ES and go short on NQ, and yes have the ability to increase the size on NQ, and all based on indicators entries
                  I unlocked the code and I'm sorry but I really don't know any programming.
                  I was able to remove theBarsInProgress != 0 from my code though which worked

                  Comment


                    #10
                    Unfortunately I am limited by the amount of support I can provide on this as we do not offer programming services. What you could do though is unlock the code, reference the correct BarsInProgress(BIP) index as a condition for the RSI calculation and then use the EnterLong() variation below to place your entries on different BIP indexes
                    Code:
                    EnterLong(int barsInProgressIndex, int quantity, string signalName)
                    The 'multi time frame' link below as well as the rest of the links below will help to accomplish this task.

                    Help Guide - Multi-Time frame & Instruments

                    Help Guide- BarsInProgress

                    Help Guide - EnterLong()

                    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development team to follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
                    Last edited by NinjaTrader_JoshG; 07-31-2018, 12:26 PM.
                    Josh G.NinjaTrader Customer Service

                    Comment


                      #11
                      Ok, thank you.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by gravdigaz6, Today, 11:40 PM
                      1 response
                      7 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by MarianApalaghiei, Today, 10:49 PM
                      3 responses
                      10 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by XXtrader, Today, 11:30 PM
                      0 responses
                      4 views
                      0 likes
                      Last Post XXtrader  
                      Started by love2code2trade, Yesterday, 01:45 PM
                      4 responses
                      28 views
                      0 likes
                      Last Post love2code2trade  
                      Started by funk10101, Today, 09:43 PM
                      0 responses
                      9 views
                      0 likes
                      Last Post funk10101  
                      Working...
                      X