Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Race condition and/or overfill ?

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

    Race condition and/or overfill ?

    Hello,

    I've been working on an automated strategy, but in demo mode am getting at
    various times overfills (this does not happen in market replay). I do not know if it is a race condition or other issue causing it. I have attached an Excel spreadsheet (uploaded as .txt ... may need to rename to .csv) with an example.

    Note: in my example spreadsheet the overfill occurs at 2:24:55 PM.

    Here is the sequence of events ... all qtys are 1 contract

    Order Entry/Exit Position Order Name
    ------- ---------- ---------------
    Sell Entry 1S Sell Short
    Buy Exit - Buy to cover
    Buy Entry 1L Close Position
    Buy Entry 2L Buy < Overfill

    Regards,

    C Smith
    Attached Files

    #2
    Mr. Smith, does your strategy include a sequence of events like this: ExitLong() -> EnterLong()? If so, that would be causing the overfill. Would you mind attaching your strategy so we can see if anything else is out of place?
    AustinNinjaTrader Customer Service

    Comment


      #3
      Hello Austin,

      Yes, my strategy contains code that would exhibit that type of behavior.

      I'm attaching an edited version of my strategy that contains the offending code (I don't want to post my full strat in a public forum). Note that it won't compile, since the crossing conditions are missing.

      Regards,

      C Smith
      Attached Files

      Comment


        #4
        csmith87,

        I suggest you turn TraceOrders = true and see what is happening with your orders. You should try and not place conflicting/duplicate orders as in-flight executions may already be in place. TraceOrders = true will help you evaluate what exactly is being submitted.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh,

          Thanks for your suggestion. Ok, I've turned TraceOrders on. I am posting the result (myStrategy,zip). 1 Excel spreadsheet and 1 Output file clip. Note that the timestamps for the entry trail the excel timestamps by 1 or 2 sec.

          Summary of Output file clip ...

          15:34:27 Entry Sell 1 @ 10653 PlaceOrder Sell Short
          15:34:28 Execution: Filled Sell Short

          16:14:51 Exit Buy 1 @ 10630 Place Order Buy to Cover
          16:14:51 Entry Buy 1 @ 10657 Place Order Buy
          16:14:55 Execution: Other Buy to Cover
          16:14:59 Execution: Filled Close Position
          16:14:59 Execution: Filled Buy
          Attached Files

          Comment


            #6
            csmith87,

            Here is the problem as seen in your attached DOC. At 4:14:51 you sent in a BuyToCover order. You also sent in a Buy market at that exact same time. This for sure can lead to overfills since you have two competing orders now. Please only submit either an exit or an enter. If your goal was to reverse your position, only submit the enter order. If your goal was to exit, wait until the exit is filled before submitting any new entry orders.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by WHICKED, Today, 02:02 PM
            1 response
            4 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by selu72, Today, 02:01 PM
            0 responses
            3 views
            0 likes
            Last Post selu72
            by selu72
             
            Started by f.saeidi, Today, 12:14 PM
            8 responses
            21 views
            0 likes
            Last Post f.saeidi  
            Started by Mikey_, 03-23-2024, 05:59 PM
            3 responses
            50 views
            0 likes
            Last Post Sam2515
            by Sam2515
             
            Started by Russ Moreland, Today, 12:54 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Erick  
            Working...
            X