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

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?
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ETFVoyageur, Today, 04:00 PM
        0 responses
        5 views
        0 likes
        Last Post ETFVoyageur  
        Started by AaronKTradingForum, Today, 03:44 PM
        1 response
        6 views
        0 likes
        Last Post AaronKTradingForum  
        Started by Felix Reichert, 04-26-2024, 02:12 PM
        11 responses
        77 views
        0 likes
        Last Post Felix Reichert  
        Started by junkone, 04-28-2024, 02:19 PM
        7 responses
        82 views
        1 like
        Last Post junkone
        by junkone
         
        Started by pechtri, 06-22-2023, 02:31 AM
        11 responses
        136 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Working...
        X