Posted 5/19/2009 04:56:04
|
|
|
|
1 * In which situation do we received an OrderCancelled event ? My understanding is we receive this event only:
- when we close a position, we receive it for the stop loss and take profit orders
- unexpectedly when the broker has canceled our order (in that case order.CancelPending would be set to false), in that case we should resubmit the order or do whatever we want, the order is not at the broker anymore.
2 * When we receive an OrderFilled event, can we suppose the order has been filled correctly and fully ? How do you manage orders which are not filled completely ?
3 * Where is the best place to put some code to be executed once at the end of a backtesting ?
Thanks
|
|
Posted 5/19/2009 07:56:45
|
|
|
|
Any time any order is cancelled. The stop loss and profit target orders are cancelled when a position is closed. Are you seeing them unexpectedly?
Shutdown?
FlipFlop (5/19/2009)
1 * In which situation do we received an OrderCancelled event ? My understanding is we receive this event only:
- when we close a position, we receive it for the stop loss and take profit orders
- unexpectedly when the broker has canceled our order (in that case order.CancelPending would be set to false), in that case we should resubmit the order or do whatever we want, the order is not at the broker anymore.
2 * When we receive an OrderFilled event, can we suppose the order has been filled correctly and fully ? How do you manage orders which are not filled completely ?
3 * Where is the best place to put some code to be executed once at the end of a backtesting ?
Thanks
|
|
Posted 5/19/2009 09:14:24
|
|
|
|
Actually, OrderFilled will be called for partial fills of an order as well as when the order has been completely filled. If the order hasn't been completely filled, the order status will be PartiallyFilled instead of Filled.
Daniel
|
|
Posted 5/20/2009 01:15:08
|
|
|
|
How can I access this order status ? The OrderFilled method has two parameters, position and trade.
public override void OrderFilled(Position position, Trade trade)
Besides, if an order is partially filled, what would be the position.state (open or pending ?) ?
dplaisted (5/19/2009) Actually, OrderFilled will be called for partial fills of an order as well as when the order has been completely filled. If the order hasn't been completely filled, the order status will be PartiallyFilled instead of Filled.
Daniel
|
|
Posted 5/20/2009 07:34:35
|
|
|
|
Position.State. It's open until it's completely filled.
FlipFlop (5/20/2009)
How can I access this order status ? The OrderFilled method has two parameters, position and trade.
public override void OrderFilled(Position position, Trade trade)
Besides, if an order is partially filled, what would be the position.state (open or pending ?) ?
dplaisted (5/19/2009) Actually, OrderFilled will be called for partial fills of an order as well as when the order has been completely filled. If the order hasn't been completely filled, the order status will be PartiallyFilled instead of Filled.
Daniel
|
|
Posted 5/23/2009 22:54:26
|
|
|
|
I'm not sure I understand.
When I call OpenPosition, the state will be pending, right ?
Then, upon OrderFilled event, if the order has been partially filled, with the state remain in Pending or change to Open ? And if it changes to Open for a partially filled order, how do we know the order is fully filled or only partially filled ?
billb (5/20/2009) Position.State. It's open until it's completely filled.
FlipFlop (5/20/2009)
How can I access this order status ? The OrderFilled method has two parameters, position and trade.
public override void OrderFilled(Position position, Trade trade)
Besides, if an order is partially filled, what would be the position.state (open or pending ?) ?
dplaisted (5/19/2009) Actually, OrderFilled will be called for partial fills of an order as well as when the order has been completely filled. If the order hasn't been completely filled, the order status will be PartiallyFilled instead of Filled.
Daniel
|
|
Posted 5/24/2009 00:08:24
|
|
|
|
|
|
Posted 5/24/2009 02:05:33
|
|
|
|
great, perfectly clear ! thanks a lot for the prompt support.
is there a way to "simulate" partially filled orders in backtesting ?
|
|
Posted 5/25/2009 15:01:50
|
|
|
|
FlipFlop (5/24/2009) great, perfectly clear ! thanks a lot for the prompt support.
is there a way to "simulate" partially filled orders in backtesting ?
Not with the out-of-the-box paper trader. You could write your own paper trader (which would be very complicated) to simulate this. You might also be able to derive from the existing paper trader to add this functionality, although I'm not sure if we provide all the right hooks for this.
Thanks,
Daniel
|
|
|
|