Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strange Situation with OnExecutionUpdate & OnOrderUpdate

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

    Strange Situation with OnExecutionUpdate & OnOrderUpdate

    Hello,

    I have a strange situation. I am trying to use the managed approach if the trail is disabled in my strategy.

    What i'm finding is that, when the first order kicks in, when trail is disabled, I see both my stop order as well as my target order. When the stop or target gets executed, the next order when the condition is right, it places the order without my stop and target order. Why is that happening? Also, sometimes I notice that it reverses my position.

    Can you help me to as to what is incorrect in my OnExecutionUpdate and OnOrderUpdate.

    Attached is a portion of my code. Before this, basically i check for a condition with regards to the bars and if the condition is met, then execute a long or short.

    Attached Files

    #2
    Hello priceisking,

    Thanks for your post.

    As we are a small team, we don't have the capacity for debugging everyone's code which can take quite a bit of time. In taking a quick look at your code example I did not see anything that stood out. That said I would add print statements in each of your code blocks to help you see when these blocks are being hit and begin narrowing down the issue. Debugging can be teduiious but using print statements and print out the values will help you see what is happening.

    What we recommend is that you use debugging techniques to see what is happening with your code. Here is a link to our debugging tips in the help guide: https://ninjatrader.com/support/help...script_cod.htm

    Comment


      #3
      Thank you. I completely understand. Just wanted to make sure i didn't miss anything in OnExecutionUpdate as it appears something fishy going on where there is a partial fill.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      56 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      132 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 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