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 fx.practic, 10-15-2013, 12:53 AM
              5 responses
              5,404 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by Shai Samuel, 07-02-2022, 02:46 PM
              4 responses
              95 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by DJ888, Yesterday, 10:57 PM
              0 responses
              8 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by MacDad, 02-25-2024, 11:48 PM
              7 responses
              159 views
              0 likes
              Last Post loganjarosz123  
              Started by Belfortbucks, Yesterday, 09:29 PM
              0 responses
              8 views
              0 likes
              Last Post Belfortbucks  
              Working...
              X