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 Mindset, Today, 06:46 AM
0 responses
8 views
0 likes
Last Post Mindset
by Mindset
 
Started by M4ndoo, Yesterday, 05:21 PM
0 responses
14 views
0 likes
Last Post M4ndoo
by M4ndoo
 
Started by M4ndoo, 04-19-2026, 05:54 PM
0 responses
15 views
0 likes
Last Post M4ndoo
by M4ndoo
 
Started by cmoran13, 04-16-2026, 01:02 PM
0 responses
82 views
0 likes
Last Post cmoran13  
Started by PaulMohn, 04-10-2026, 11:11 AM
0 responses
47 views
0 likes
Last Post PaulMohn  
Working...
X