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

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

    Paul H.NinjaTrader Customer Service

    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 llanqui, Today, 03:53 AM
      0 responses
      5 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by burtoninlondon, Today, 12:38 AM
      0 responses
      10 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      15 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Yesterday, 08:42 PM
      0 responses
      11 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Yesterday, 07:51 PM
      0 responses
      14 views
      0 likes
      Last Post strategist007  
      Working...
      X