Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy issue placing duplicate exit orders

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

    Strategy issue placing duplicate exit orders

    Hello,

    I created a simple EMA crossover long strategy using the strategy builder.

    It works fine in a sim account, buys on the crossover, and sells on the crossunder. Still, when I connect it to a rithmic account (apex funding), it sometimes generates duplicate exit orders, causing it to go in the opposite direction instead of closing the position.

    To be sure, I have the same strategy running on a sim account and a rithmic account, and the issue is only present in the rithmic account.

    I noticed when I connected the rithmic account this disclaimer is attached below,
    Click image for larger version  Name:	multiple fills issue.png Views:	0 Size:	14.1 KB ID:	1246321

    so I am wondering,


    1. Is this the cause of the issue I am having?

    2. if it is, what is the best way to solve it, considering I am using the condition builder and not the code? And will I have the same issue using a Ninja brokerage account, or is this issue isolated to rithmic?

    3. if it is not the issue, what can I do to figure out how to fix it?

    Thanks in advance for your help
    Last edited by anotherone1; 04-14-2023, 05:03 PM.

    #2
    Hello anotherone1,

    The warning is stating that code should not have code that is depending on the sequence of OnExecutionUpdate() and OnPositionUpdate(). Do you have code in both OnExecutionUpdate() and OnPositionUpdate()? Are you sending exit orders from both methods?

    Debug the script by enabling TraceOrders and adding prints above any conditions that submit the orders, include labels in the prints. Also print the order object in OnOrderUpdate().

    Below is a link to a forum post that demonstrates using Print() to understand behavior.


    Save the output to a text file and include this with your next post if you would like assistance analyzing the print output.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello anotherone1,

      The warning is stating that code should not have code that is depending on the sequence of OnExecutionUpdate() and OnPositionUpdate(). Do you have code in both OnExecutionUpdate() and OnPositionUpdate()? Are you sending exit orders from both methods?

      Debug the script by enabling TraceOrders and adding prints above any conditions that submit the orders, include labels in the prints. Also print the order object in OnOrderUpdate().

      Below is a link to a forum post that demonstrates using Print() to understand behavior.


      Save the output to a text file and include this with your next post if you would like assistance analyzing the print output.
      I am using the strategy builder, so I am not sure if I am using code in both OnExecutionUpdate() and OnPositionUpdate(). I am not even sure if that is the issue.


      what is a good way to avoid this issue?

      Comment


        #4
        Hello anotherone1,

        If you are not overriding OnExecutionUpdate() or OnPositionUpdate() then the warning message would not apply to this strategy.

        The most common reason you will see a position become double in the opposite direction is an exit order and an entry order being submitted on the same bar.

        This forum post discusses.
        https://ninjatrader.com/support/foru...16#post1036616

        To determine if this is what is occurring, enable TraceOrders and provide the output saved to a text file.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello anotherone1,

          If you are not overriding OnExecutionUpdate() or OnPositionUpdate() then the warning message would not apply to this strategy.

          The most common reason you will see a position become double in the opposite direction is an exit order and an entry order being submitted on the same bar.

          This forum post discusses.
          https://ninjatrader.com/support/foru...16#post1036616

          To determine if this is what is occurring, enable TraceOrders and provide the output saved to a text file.
          This only happens in live accounts and not in sim, so it will be hard to reproduce without risking capital. I noticed it places 2 exit orders a few mili seconds apart, possibly not getting confirmation on the first one fast enough so then it submits another one which in fact ends up reversing the position. if that is the issue, what would be a good way to prevent it?

          Comment


            #6
            Hello anotherone1,

            Correcting the behavior would depend on what is sending those orders.

            The TraceOrders information would provide insight.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            50 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            126 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            69 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X