Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Overfill at crossover

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

    Overfill at crossover

    Hello,
    When I am trading crossovers, there are times when the strategy enters double the number of contracts at crossover. This happens when my trailing stop is within + or - 1 tick from the crossover price.
    Since I am using market orders, I.e enterlong and entershort, is there an order type that could help avoid the double fill?
    Thanks,
    Kiriru

    #2
    Originally posted by kiriru View Post
    Hello,
    When I am trading crossovers, there are times when the strategy enters double the number of contracts at crossover. This happens when my trailing stop is within + or - 1 tick from the crossover price.
    Since I am using market orders, I.e enterlong and entershort, is there an order type that could help avoid the double fill?
    Thanks,
    Kiriru
    Kiriru, unfortunately this is one of the risk of electronic trading you're running into : inflight executions as your working orders are very close to the inside market.



    You could work with the advanced order handling concepts and thus be able to check current states explicitly, thus cancel your trails, wait for a confirmed cancellation and then issue the market orders to reverse.

    Comment


      #3
      Got it!
      Thanks!

      Comment


        #4
        Betrand,
        I am trying to use the below to solve the overfill problem:
        protected override void OnOrderUpdate(IOrder order)


        {

        {
        if(order.OrderType == OrderType.Stop && (order.OrderState == OrderState.PendingSubmit || order.OrderState == OrderState.PendingCancel))
        {
        pendingStopOrder = order;
        }
        if(pendingStopOrder != null && order.OrderType == OrderType.Stop && order.OrderState == OrderState.Filled)
        {
        pendingStopOrder = null;
        }

        I have declared pendingstopoder under variables. I have placed : if(pendingStopOrder == null)
        before my entry conditions.
        Now, I get very few trades when I backtest with the above. Also, when I ran this in realtime, some event seems to stop my strategy from taking anymore trades.
        Do you have any ideas as to what could be populating the variable when its not supposed to?

        Comment


          #5
          kiriru, I would suggest you print the value of the variable from the OnOrderUpdate and also print the states your stop would have, for example a cancelled stop or partial fill is not covered in your code.

          For the 'event' stopping your strategy, please see the log tab at this time and work with TraceOrder = true in the Initialize() so helpful order debug info can be reviewed in the output window to assist.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X