protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
{
...
WriteTradeExecutionToFile(execution, firstEntry);
...
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Writing execution to file, when executing CloseStrategy()
Collapse
X
-
Writing execution to file, when executing CloseStrategy()
Hi, each time an order is executed, it is written to a file. unfortunately, the OnExecutionUpdate() method is no longer executed when CloseStrategy() is used. how can i have this last order execution also written to the file? does anyone have any ideas?
Code:Tags: None
-
Hello sidlercom80,
Thanks for your post.
The CloseStrategy() order wouldn't be seen with OnExecutionUpdate, but you could consider creating a listener AddOn/indicator that subscribes to account level Execution events.
From the account level ExecutionUpdate event method, you can check the undocumented GetOwnerStrategy() method from the executing order to identify the owning strategy. This won't pass for the CloseStrategy order, but you can give the CloseStrategy order it's own signal name/order name so you can identify it in your listener AddOn. (You could pass the Strategy Name with the CloseStrategy call so the listener can identify and associate that order as you need.)
Account.ExecutionUpdate - https://ninjatrader.com/support/help...tionupdate.htmCode:private void OnExecutionUpdate(object sender, ExecutionEventArgs e) { if (e.Execution.Order.GetOwnerStrategy() != null) Print(e.Execution.Order.GetOwnerStrategy().ToStrin g()); else if (e.Execution.Order.Name == "CloseStrategyOrder") Print(e.Execution.Order.Name); }
Note: GetOwnerStrategy() is not a documented/supported item, but you may find it useful through your testing.
We look forward to assisting.Attached Files
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
30 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
64 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
41 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment