Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order being submitted by not going to OnExecutionUpdate

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

    Order being submitted by not going to OnExecutionUpdate

    I have a strategy that I have edited the way the entry counts are set and counted. Originally it started at 1 and would count up after the trades were filled, or if I had to split it into two trades. I have changed them to start at 0, and add a count when I hit a button to place a trade down. It still adds another after placing the first trade and before it enters the second. It goes into OnOrderUpdate, but starts to send the 2nd trade at the same time. I see the 2nd get filled and continues on to OnExecutionUpdate but the first one does not. I can't understand why this is happening. It seems to now just forget about the first trade.

    This is what I'm getting from the output
    Creating new entryOrder...
    longEntryCount: 1
    buyPullbackSignal: LongPullback 1
    2/25/2025 11:54:12 AM Strategy 'PullBackStrategy/278923517': Entered internal SubmitOrderManaged() method at 2/25/2025 11:54:12 AM: BarsInProgress=0 Action=Buy OrderType=Market Quantity=6 LimitPrice=0 StopPrice=0 SignalName='LongPullback 1' FromEntrySignal=''
    Entering OnOrderUpdate
    order.Name LongPullback 1
    order.OrderState: Submitted
    orderTypes.Count: 1
    orderTypes.Count is greater than 0
    Checkng if orderTypes contains LongPullback 1
    entryOrder has been assigned
    Removing LongPullback 1 from orderTypes
    longEntryCount: 1
    Entering TP2
    buyPullbackSignal: LongPullback 2
    2/25/2025 11:54:12 AM Strategy 'PullBackStrategy/278923517': Entered internal SubmitOrderManaged() method at 2/25/2025 11:54:12 AM: BarsInProgress=0 Action=Buy OrderType=Market Quantity=2 LimitPrice=0 StopPrice=0 SignalName='LongPullback 2' FromEntrySignal=''
    Entering OnOrderUpdate
    order.Name LongPullback 2
    order.OrderState: Submitted
    orderTypes.Count: 1
    orderTypes.Count is greater than 0
    Checkng if orderTypes contains LongPullback 2
    entryOrder2 has been assigned
    Removing LongPullback 2 from orderTypes
    Entering OnOrderUpdate
    order.Name LongPullback 2
    order.OrderState: Accepted
    orderTypes.Count: 0
    Entering OnOrderUpdate
    order.Name LongPullback 2
    order.OrderState: Working
    orderTypes.Count: 0
    Entering OnOrderUpdate
    order.Name LongPullback 1
    order.OrderState: Accepted
    orderTypes.Count: 0
    Entering OnOrderUpdate
    order.Name LongPullback 2
    order.OrderState: Filled
    orderTypes.Count: 0
    LongPullback 2 is now filled.

    Entering OnExecutionUpdate...
    execution.Name: LongPullback 2​

    It does not seem to be doing this all the time. So far I have tried to a few times in both directions and it is working now. I will keep trying to recreate this error.
    Last edited by rockmanx00; 02-25-2025, 11:12 AM.

    #2
    Hello rockmanx00,

    I can't tell from the output what may have happened in your logic. You may need to add additional prints and run the script so you can use that output for debugging the code. The output is only going to be helpful to you as you are looking directly at the code you made and where you put the prints. Depending on which parts of your logic become true or not could help determine what's happening. OnExecutionUpdate is only fired when an order fills so the order type may also be relevant.

    Comment


      #3
      Thank you for your reply.

      I am trying to wrap my head around the logic:
      It clearly is getting sent into OnOrderUpdate before the second one is sent. It still notices there are both orders. Is there a reason it would not go to OnExecutionUpdate and simply be ignored? I can't think of why it would ignore that? The reason for the orderTypes code is to assign "TP1" or "TP2" to the Signal Name and assign those to entryOrder or entryOrder2 respectively.
      That is primarily the only thing I have in OnOrderUpdate. Once that order gets filled, it also Prints the line that it is now filled.

      It is first assigned when I am taking a trade that I know needs to be split into 2, so it gets assigned before entry and then removed. I'll keep looking. I still have to figure out why it's not being consistent with producing this error.

      I appreciate your patience as I attempt to figure this out.
      Last edited by rockmanx00; 02-25-2025, 11:43 AM.

      Comment


        #4
        Hello rockmanx00,

        Do you hav eentries per direction set to 2 to accommodate 2 entries?

        Comment


          #5
          Hmm, I have that set to 5. So that's not an issue. Also, when this error occurred it was my first entry. I was not in any other trade prior.

          Comment


            #6
            Hello rockmanx00,

            I would suggest trying trace orders to see if the order is being ignored for any reason.

            Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

            Comment


              #7
              I have trace orders already set to true, and didn't see anything. It just never continued to OnExecutionUpdate. Also, I have tried a few times, but have not yet managed to recreate this error. Unless you have any other suggestions you wanted to try, you can go ahead and close this post. I'll post again if it does pop up.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              53 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              130 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              70 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              44 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              49 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X