Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Partial fills help

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

    Partial fills help

    Hi,

    I am having an issue during partial fills where I am missing the confirmation in OnExecutionUpdate.

    Background: I enter a position using 3 separate brackets (Bracket 1, 2, 3). In OnExecutionUpdate, I wait until all are filled and then set profits/target.

    The issue is that sometimes on partial orders, I will get confirmation that 1 or 2 of the brackets were filled, but never on the last bracket - so my target/stops never get set.

    Any advice on what I might be doing wrong?

    Code:
    protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
    		{
    			if (execution.Order != null && execution.Order.Name == "Long Entry 1")
    			{
    				if (execution.Order.OrderState == OrderState.Filled)
    				{
    					order1Filled = true;
    					orderTime = execution.Order.Time;
    					logEntry(Instrument.MasterInstrument.Name+"\t"+"Bracket 1 Filled - Quantity: "+execution.Order.Quantity+"\t"+"Price: "+execution.Order.AverageFillPrice);
    				}
    			}
    			if (execution.Order != null && execution.Order.Name == "Long Entry 2")
    			{
    				if (execution.Order.OrderState == OrderState.Filled)
    				{
    					order2Filled = true;
    					orderTime = execution.Order.Time;				
    					logEntry(Instrument.MasterInstrument.Name+"\t"+"Bracket 2 Filled - Quantity: "+execution.Order.Quantity+"\t"+"Price: "+execution.Order.AverageFillPrice);
    				}
    			}
    			if (execution.Order != null && execution.Order.Name == "Long Entry 3")
    			{
    				if (execution.Order.OrderState == OrderState.Filled)
    				{
    					order3Filled = true;
    					orderTime = execution.Order.Time;
    					logEntry(Instrument.MasterInstrument.Name+"\t"+"Bracket 3 Filled - Quantity: "+execution.Order.Quantity+"\t"+"Price: "+execution.Order.AverageFillPrice);
    				}
    			}
    			
    			
    			if (bracketUnits == 1 && order1Filled)
    				orderFilled = true;
    			if (bracketUnits == 2 && order1Filled && order2Filled)
    				orderFilled = true;
    			if (bracketUnits == 3 && order1Filled && order2Filled && order3Filled)
    				orderFilled = true;
    			
    			if (orderFilled)
    				logEntry(Instrument.MasterInstrument.Name+"\t"+"Order Complete - Quantity: "+Position.Quantity+"\t"+"Price: "+Position.AveragePrice);
    
    			
    			// set stop and profit targets
    			if (orderFilled && !setTargetsFlag)
    				setTargets();
    			}
    Thanks,
    Alex

Latest Posts

Collapse

Topics Statistics Last Post
Started by argusthome, 03-08-2026, 10:06 AM
0 responses
77 views
0 likes
Last Post argusthome  
Started by NabilKhattabi, 03-06-2026, 11:18 AM
0 responses
45 views
0 likes
Last Post NabilKhattabi  
Started by Deep42, 03-06-2026, 12:28 AM
0 responses
27 views
0 likes
Last Post Deep42
by Deep42
 
Started by TheRealMorford, 03-05-2026, 06:15 PM
0 responses
32 views
0 likes
Last Post TheRealMorford  
Started by Mindset, 02-28-2026, 06:16 AM
0 responses
63 views
0 likes
Last Post Mindset
by Mindset
 
Working...
X