Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order fill issue (double fills) in real-time simulation mode

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

    Order fill issue (double fills) in real-time simulation mode

    Hi,

    I have a simple strategy that follows an indicator and enters long/exits short if the indicator crosses above, while it would exit long and enter short when the indicator crosses below. The strategy was put together by the wizard and works as expected on historical backtest.
    I tried it with the real-time simulation account, too (connecting to IB) and observed the following flaw in order execution:
    - entered long with 222 shares at the signal. Order quantity is set by account size in the strategy.
    - at the turn of the signal, I had a Close position for 222 alright, but my short wasn't 222, it was 445 instead. Looks like the quantity was calculated with double the account size or something.
    - this happens at every turn, so my position size is ever increasing until the entire account is exhausted.

    What am I doing wrong?

    #2
    Welcome to our forums - from the description it sounds to me like you may have duplicate order entry calls in your script - as the Enter() methods would reverse automatically for you, there would not be an extra exit / close position call needed, just specifying the new Entry would be enough. Can you please check your conditions if that may be the case when you're reversing?

    Comment


      #3
      Thank you Bertrand, that was the issue indeed, I had both Exit and Entry methods in the strategy. After removing the Exit method, everything works as expected.
      Just out of curiosity, why doesn't this problem occur in backtesting?

      Comment


        #4
        Glad to hear mic414, backtest processings would trap this from occurring, while in realtime this would not be the case so you would need to be mindful of the Enter() methods behavior to do the reverse.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        666 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        376 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        110 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        580 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X