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

Confusion on Event Driven OnBarUpdate Mechanism for Multiple Instrument Strategy

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

    Confusion on Event Driven OnBarUpdate Mechanism for Multiple Instrument Strategy

    Hi,

    When I tried to develop a multiple instrument strategy. I noticed the following problem.

    The strategy involves two instruments, one for trading and the other for reference only. Lets refer them as "Pri" and "Ref".

    Here are the settings:
    CalculateOnBarClose=true;
    Bar period is set to 1-minute;


    Then comes my confusion:

    Suppose Time[0] is now 11:00 AM. In function OnBarUpdate, if BarsInProgress==0 then this event is driven by "Pri". But at this moment, all the data series for "Ref" are still at 10:59 AM. I.e., Closes[0][0] is the close price of Pri at 11:00 however Closes[1][0] is the close price of Ref at 10:59!

    How could I access the synchronized data series of Ref correctly?



    I'd appreciate any ideas or suggestions. Thx.

    #2
    We'll work out a sample shortly.

    Comment


      #3
      You could try driving your logic on BarsInProgress == 1. Based on the order you have the series, different bar series will fire first. If you want both to be on 11am before you run any logic you will want to wait till the last bar series fires.

      Are you using two 1-min series? On different instruments? Or a different setup?
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        I thought about this. But how to Open/Close a position of another instrument? The EnterLong*/EnterShort*/Exit* functions all defaults to *current* instrument.

        Comment


          #5
          Hi shliang,

          You will be pleased with the new feature in NT6.5 which allows you to specify which barsInProgress your order will be executed on.

          EnterLong(int barsInProgressIndex, int quantity, string signalName)
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Sounds great

            When will NT6.5 be released? I can't wait!

            Comment


              #7
              NT6.5 is in beta right now. Release should be available sooner than later. No fixed ETA yet.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Carolscogginsi, Yesterday, 10:45 PM
              0 responses
              6 views
              0 likes
              Last Post Carolscogginsi  
              Started by RaddiFX, Yesterday, 10:15 AM
              2 responses
              15 views
              0 likes
              Last Post RaddiFX
              by RaddiFX
               
              Started by patrickmlee007, Yesterday, 09:33 AM
              2 responses
              18 views
              0 likes
              Last Post patrickmlee007  
              Started by magnatauren, 08-15-2020, 02:12 PM
              5 responses
              208 views
              0 likes
              Last Post RaddiFX
              by RaddiFX
               
              Started by rene69851, 05-02-2024, 03:25 PM
              1 response
              23 views
              0 likes
              Last Post rene69851  
              Working...
              X