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

Startegy run on one instrument but trade another

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

    Startegy run on one instrument but trade another

    Example - How can one run startegy on ES but trade MES? Strategy runs on ES data but trades MES.
    Last edited by rocketstock; 02-06-2022, 09:25 PM.

    #2
    Hello rocketstock,

    Add the MES data series with AddDataSeries().


    Place the orders using BarsInProgress 1 as the index.
    EnterLong(1, 1, "entry on secondary instrument");
    EnterLong(int barsInProgressIndex, int quantity, string signalName)


    Below is a link to an example that places orders to a secondary series.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks I'll research this. meanwhile can this be done without unlocking startegy script?

      Comment


        #4
        Hello rocketstock,

        Unfortunately, the Strategy Builder is limited and cannot place orders to an added series.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Could this be added as a feature request? Trading data on MES especially some volume formulas get screwed up as it not as organized as ES. Retail causing trouble on MES. Additionally ES could be used for other things like stocks. Hence my thinking.

          Comment


            #6
            i tired adding ES on this screen in strategy builder but like you said its not working even if I select this as primary.
            Attached Files

            Comment


              #7
              Hello rocketstock,

              I will submit a request on your behalf for the development to consider.

              Once I have a tracking ID for this request I will post in this thread for future reference.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thank you.

                Comment


                  #9
                  Sorry to bother on this topic again. But what is the use of the secondary or primary data series in strategy builder in picture i posted above. Can I not use that secondary data series to act on the primary. Like is ES was the secondary data series in strategy builder and MES was the primary in strategy on chart. Just trying to understand the purpose of the data series in startegy builder. Is there a video or link to that please?

                  Comment


                    #10
                    Hello rocketstock,

                    The use would be, that a secondary series can be used for an indicator input series, or if you wanted to compare the primary series with data from the secondary series.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Got it thanks. I am hesitant to unlock my script. Perhaps I could create a version for each instrument. Is there a sample file that does the whole things in one script? -looking at one instrument and trading another. I looked at links above and not able to me make it work.

                      Comment


                        #12
                        Hello rocketstock,

                        Make a copy of the script and unlock the copy.


                        The SampleIntrabarBacktest_NT8 demonstrates placing orders to BarsInProgress 1. If this is another instrument the orders will be placed to that instrument.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Yes like both your ideas. I will try. Thank you so much. The volume patterns in MES are different from ES. Doesn't show on normal volume indicators. Most look similar. Head fakes detection etc are not caught on MES charts. I highly recommend NT consider adding this feature to strategy builder :-)

                          Comment


                            #14
                            Originally posted by NinjaTrader_ChelseaB View Post
                            Hello rocketstock,

                            Make a copy of the script and unlock the copy.
                            https://youtu.be/H7aDpWoWUQs?t=355&l...We0Nf&index=14

                            The SampleIntrabarBacktest_NT8 demonstrates placing orders to BarsInProgress 1. If this is another instrument the orders will be placed to that instrument.
                            Hi Chelsea,

                            I created an unlocked version and tried this. Running this on ES chart 3 min. Execute trade on MES using ES data. Not working.

                            else if (State == State.Configure)
                            {

                            AddDataSeries("MES 03-22", BarsPeriodType.Minute, 3);

                            }

                            And

                            EnterShort(1, 1, "entry on secondary instrument");



                            Something is wrong in my coding. When I enter ES instead of MES in ( AddDataSeries("MES 03-22", BarsPeriodType.Minute, 3)

                            It works. Any other symbol it doesn't. MES above is the secondary data series per the documentation you sent.

                            These are the only two lines I added to unlocked script.
                            Last edited by rocketstock; 02-09-2022, 04:33 AM.

                            Comment


                              #15
                              Hello rocketstock,

                              Is there an error occurring with other instruments?

                              Are you seeing prints for BarsInProgress 1 appear in the output window?

                              This would let us know if the data is being processed to focus on the connection or the logic within the script.
                              Last edited by NinjaTrader_ChelseaB; 02-14-2022, 02:50 PM.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by inanazsocial, Today, 01:15 AM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Jason  
                              Started by rocketman7, Today, 02:12 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post rocketman7  
                              Started by dustydbayer, Today, 01:59 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post dustydbayer  
                              Started by trilliantrader, 04-18-2024, 08:16 AM
                              5 responses
                              23 views
                              0 likes
                              Last Post trilliantrader  
                              Started by Davidtowleii, Today, 12:15 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post Davidtowleii  
                              Working...
                              X