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

Trading micro contracts on a mini contract-based strategy

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

    Trading micro contracts on a mini contract-based strategy

    Hello, I have a strategy that utilizes order flow obtained from the mini contracts chart (nq, es, etc.), however I would like to enter trades using micro contracts with the same strategy. How can I do this?

    #2
    Hello rbeckmann05,

    Thank you for your note.

    Add the data series of the other instrument with AddDataSeries(). (for example AddDataSeries("MES 12-23")


    This added series becomes BarsInProgress index 1. (while the primary series is BarsInProgress index 0)

    Choose the BarsInProgress you want OnBarUpdate() to process logic on.


    Call the order method and supply the BarsInProgressIndex of the instrument you want the order to go to.

    EnterLong(int barsInProgressIndex, int quantity, string signalName)



    Included with NinjaTrader is the SampleMultiInstrument which demonstrates.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Awesome, just what I'm looking for, thank you. Does this mean I need to add (If barsInProgress == 0) to the rest of the code, or should it be all good as is?

      Comment


        #4
        Hello rbeckmann05,

        It's a good idea if you are wanting to evaluate the logic only when the primary series is updating (and not twice).

        Scripts made with the Strategy Builder add that in automatically.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          Is using Strategy Builder, do I add the additional data series using the Additional Data function or the custom series function? If using Additional Data function, do I click the Use primary instrument box? As I am using Renko type of bar, I should choose Tick as Type right and do I leave the value as the default 1? After all these, do I just need to enable the strategy on a Mini chart and it will trade on the Micro contract? Thank you,

          Comment


            #6
            Hello Invest78,

            The Strategy Builder cannot send orders to an added instrument series.

            The Additional Data adds a price series of the same or a different instrument.
            The Custom series is an empty Series<T> that allows you to save your custom values for each bar.

            'Use primary series' will cause the added price series to have the same instrument as the chart.

            In an unlocked script with a price series of a different instrument added, the barsInProgressIndex of that series must be supplied to the order method.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks ChelseaB, adding those code is currently beyond my skillset. But I will keep this in mind.

              Comment


                #8
                Invest78 I completely built out what I was trying to do, are you just trying to do the same thing of basing a strategy off mini data and entering with micro? I can send you the code if you like, just want to be sure it's what you're looking for

                Comment


                  #9
                  Hi rbeckmann05, rbeckmann05 That is so nice of you. Yes, I would like to do the same thing like you, basing a strategy off mini data and entering with micro. Do you happen to know how to modify your code since I am using a custom Renko bar on my chart. Thank you.

                  Comment


                    #10
                    Invest78 I don't think it will matter, as the EnterLong() or EnterShort() is not based off a specific chart, just whatever contract you tell it. Let me grab it for you, give me one moment.

                    Comment


                      #11
                      Invest78 Here you go, hope this helps! Make sure to copy and paste the parameters, the "entryIndex" variable declaration right above OnStateChange(), the additional data series in the State.Configure() section, and those two EnterLong/EnterShort calls in replacement for what you already have for entry and you should be all set. If you have any questions please feel free to let me know!
                      Attached Files

                      Comment


                        #12
                        rbeckmann05 Thank you. I will do this and let you know if I have any issue.

                        Comment


                          #13
                          Invest78 No problem, happy to help

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by AaronKoRn, Today, 09:49 PM
                          0 responses
                          7 views
                          0 likes
                          Last Post AaronKoRn  
                          Started by carnitron, Today, 08:42 PM
                          0 responses
                          9 views
                          0 likes
                          Last Post carnitron  
                          Started by strategist007, Today, 07:51 PM
                          0 responses
                          10 views
                          0 likes
                          Last Post strategist007  
                          Started by StockTrader88, 03-06-2021, 08:58 AM
                          44 responses
                          3,980 views
                          3 likes
                          Last Post jhudas88  
                          Started by rbeckmann05, Today, 06:48 PM
                          0 responses
                          9 views
                          0 likes
                          Last Post rbeckmann05  
                          Working...
                          X