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

OnExecutionUpdate Callback Called before SubmitOrderUnmanaged Returns

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

    OnExecutionUpdate Callback Called before SubmitOrderUnmanaged Returns

    Posted this in the NT7 Section by Mistake.

    When the attached strategy is run on a Playback Connection, the OnExecutionUpdate Callback fires before the SubmitOrderUnmanaged Method returns a reference to the order.

    I've added Trace output lines to illustrate this.

    Connected to Playback the output is:
    Code:
    ***OnExecutionUpdate method called, long stop entry is: null
    Assigned the longStopEntry order reference in OnBarUpdate
    and on the simulation feed the output is....

    Code:
    Assigned the longStopEntry order reference in OnBarUpdate
    ***OnExecutionUpdate method called, long stop entry is: orderId='b7f5181a0082428bbf62832870ad183f' account='Sim101' name='longStopEntry' orderState=Filled instrument='GBPNZD' orderAction=Buy orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='5a947726-1531-4bad-84bd-335676a9007e' filled=1 averageFillPrice=1.73219 onBehalfOf='' id=783 time='2017-02-12 21:25:50' gtd='2099-12-01' statementDate='2017-02-12'
    Hopefully you can reproduce this, because I've literally wasted 2 days trying to figure out why my strategy wasn't working right. Before stripping it right back to this and realising that the playback connection was the issue.
    Attached Files

    #2
    Hello reach4thelasers,

    I was able to replicate and have passed this on to development.

    Thank you for bringing this to our attention.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hello reach4thelasers,

      To follow up on this ticket, order objects should be assigned in OnOrderUpdate and not in OnBarUpdate.

      Please see OnOrderUpdate section of our helpguide as well as the the attached revised strategy.


      Please let us know if you need further assistance.
      Attached Files
      Alan P.NinjaTrader Customer Service

      Comment


        #4
        Hey Alan,

        this is contrary to all the advice and examples on these forums; as well as the docs.

        ninjatrader.com/support/helpGuides/nt8/en-us/onexecutionupdate.htm?zoom_highlightsub=ExecutionU pdate

        Its also impossible to have multiple positions per strategy using the example you posted. The main reason people want to use Unmanaged orders is to enable us to have multiple entry orders - possibly in opposing directions for breakouts.

        Therefore when each entry order is submitted, we need to get a reference to the order- so that we can manage changes to that order (submitting brackets etc) at a later date. Otherwise there's no way to know which order was filled.

        Regardless of this.... The issue I originally reported was only evident on the SimFeed - live and replay were fine. There's clearly a problem here if the Simulated feed behaves differently to the others....

        Comment


          #5
          Hello reach4thelasers,

          The link you provided assigns an order object in OnExecutionUpdate, which could be done, but it would be best practice to assign in OnOrderUpdate.

          It would not be impossible to have multiple entry orders in the example I provided. You would need to uniquely name another signal name for which you could assign an order object to in OnOrderUpdate and use that order object to manage changes.

          Regarding the original issue, did you correctly assign the order object in OnOrderUpdate?

          I look forward to your reply.
          Alan P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CortexZenUSA, Today, 12:53 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by CortexZenUSA, Today, 12:46 AM
          0 responses
          0 views
          0 likes
          Last Post CortexZenUSA  
          Started by usazencortex, Today, 12:43 AM
          0 responses
          2 views
          0 likes
          Last Post usazencortex  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          168 responses
          2,262 views
          0 likes
          Last Post sidlercom80  
          Started by Barry Milan, Yesterday, 10:35 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X