protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time) { if (execution.Order.Name.StartsWith("EnterLong")) { if (orderState == OrderState.Filled || orderState == OrderState.PartFilled) { //long position open } } else if (execution.Order.Name.StartsWith("ExitLong")) { if (orderState == OrderState.Filled || orderState == OrderState.PartFilled) { //long position closed } } else if (execution.Order.Name.StartsWith("ExitLongLimit")) { if (orderState == OrderState.Accepted) { //ExitLongLimit accepted } else if (orderState == OrderState.Cancelled) { //ExtLongLimit cancelled e.g. CancelOrder() } else if (orderState == OrderState.Filled || orderState == OrderState.PartFilled) { //ExitLongLimit filled, long position closed } } }
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
OnExecutionUpdate
Collapse
X
-
OnExecutionUpdate
could someone check that I have this right ..
Code:Last edited by delTik; 04-27-2016, 10:13 AM.Tags: None
-
Hello delTik,
I would not be able to say if this is correct as the code that places the entry orders is not included. The names you are looking for would need to match the signal names used for the order.
Using string.StartsWith is fine to use.
You can also use IOrders to match orders.
For the most part this looks fine.
The question is, when you test the code does it do what you are expecting?Chelsea B.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,279 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
||
Started by WHICKED, Today, 12:45 PM
|
2 responses
19 views
0 likes
|
Last Post
by WHICKED
Today, 03:36 PM
|
||
Started by Tim-c, Today, 02:10 PM
|
1 response
8 views
0 likes
|
Last Post Today, 02:52 PM | ||
Started by Taddypole, Today, 02:47 PM
|
0 responses
5 views
0 likes
|
Last Post
by Taddypole
Today, 02:47 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
4 responses
51 views
0 likes
|
Last Post
by chbruno
Today, 02:38 PM
|
Comment