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

Live stop/target order behavior different than sim behavior

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

    Live stop/target order behavior different than sim behavior

    I'm developing a strategy that keeps track of 3 private orders, an entry order, stop order, and target order. When using a sim account, submission, cancellation, fills, and OCO all work as expected. However, when I use this same strategy on a live account, the stop and target orders only submit in the quantity of the first order fill (one full fill or first partial fill). For example, if the entry quantity is 10 and one order fills all 10, the stop and target will submit for 10. If the entry quantity is 10 and I receive partial fills of 3, 5, and 2, the stop and target only submit for 3. I have the strategy code and log output from an example execution...looking for someone at NT to take a look. Again, everything works as designed when using a sim account, the issue only appears when using a live account.

    Thanks - Brandon

    #2
    Hello brohnhdon,

    Thank you for the post.

    By the description it sounds like in realtime, it is working as expected except for when a partial fill occurs is this correct?

    If so, you will very likely need to add additional checking into OnExecutionUpdate to handle Partial fills instead of just submitting the targets immediately.

    You could check the "Filled" property to get the quantity that was actually filled and check it against the Total target quantity to ensure a full fill had happened before submitting the targets. You can also check if the OrderState was PartFilled to do other logic besides submitting the targets.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Yes that is correct. However I don't understand why the exact same logic works when I receive partial fills in sim. Am I able to email you my OnOrderUpdate(), OnExecutionUpdate() methods and log file for a closer look?

      Comment


        #4
        Hello brohnhdon,

        Thank you for the reply.

        Yes, you can send in specific samples to our platform support [at] ninjatrader.com address or attach them to your forum posts. I would like to note that we are unable to directly debug your script so you would need to make a reduced sample that demonstrates the problem directly. If you have a large strategy currently, please ensure to make a sample of only the logic surrounding the failing situation for clarity.

        Most likely you would need to further debug the situation further to find what specifically is happening differently between the two tests. I would suggest also adding Prints into the OnExecutionUpdate override and surrounding the logic controlling the targets to see if it is happening identically in both tests.

        This could additionally be caused by the StopTargetHandling property, this property would also affect the outcome in this situation. There is a note about partial fills and this property here: https://ninjatrader.com/support/help...partial%2Bfill



        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I'll go ahead and change the StopTargetHandling property and see if that resolves the issue. If not, I'll trim down the code and send it to platform support.

          I appreciate the help, thank you - Brandon

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by GLFX005, Today, 03:23 AM
          0 responses
          1 view
          0 likes
          Last Post GLFX005
          by GLFX005
           
          Started by XXtrader, Yesterday, 11:30 PM
          2 responses
          11 views
          0 likes
          Last Post XXtrader  
          Started by Waxavi, Today, 02:10 AM
          0 responses
          6 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by TradeForge, Today, 02:09 AM
          0 responses
          13 views
          0 likes
          Last Post TradeForge  
          Started by Waxavi, Today, 02:00 AM
          0 responses
          3 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Working...
          X