test fill partial order

 
I need a way to test partial fill of an order, for instance place a pending order which is triggered but opens only part of the position. Any idea how to do that? Thanks
 
Amir Yacoby:
I need a way to test partial fill of an order, for instance place a pending order which is triggered but opens only part of the position. Any idea how to do that? Thanks

No way to do in demo or tester. What i did was code a function that would simulate everything that can happen. So for example if the normal order would be a 1 lot BUY_LIMIT at a certain price, this function would open random fractions of 1 lot with the possibility of a part of the limit order hanging.

Code sample 

            double PseudoLots = 0; 
            double TotalLots = 0;
            
            if (Type==OP_SELL && Snap.TotalLotsOPSELL==0) 
            {
              {
                int LimitsSent = 0;
                while (SYNC_NETTING_TO_HEDGE::LotInt(TotalLots)!=SYNC_NETTING_TO_HEDGE::LotInt(Lots))
                {
                  PseudoLots = (MathRand()%(int)(Lots*100) + 1);
                  PseudoLots = NormalizeDouble(PseudoLots / 100,2);      
     
                  if ((SYNC_NETTING_TO_HEDGE::LotInt(PseudoLots+TotalLots)<=SYNC_NETTING_TO_HEDGE::LotInt(Lots))) 
                  {
                    if ( (MathRand()%100 + 1)<50)
                    {
                      OrderSend(_Symbol, OP_SELL, PseudoLots, OrderOpenPrice(), 100, 0, 0, "", magic);
                      TotalLots += PseudoLots;    
                    }
                    else if (LimitsSent<1 && PseudoLots<Lots/2) 
                    {
                      double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);
                      OrderSend(_Symbol, OP_SELLLIMIT, PseudoLots, bid, 100, 0, 0, "", magic, 0); 
                      LimitsSent++;
                      TotalLots += PseudoLots;    
                    }
                  }
                } 
              }   

            } 

Not pretty but the code is not needed in production setting.

Reason: