thanks
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
execution.Order.GetOwnerStrategy(); returns null
Collapse
X
-
execution.Order.GetOwnerStrategy(); returns null
Hello. I am calling static methods from OnExecutionUpdate to handle email notification and db logging. I don't want to pass the strategy as a parameter using "this" so I am using execution.Order.GetOwnerStrategy() but it returns null on exiting a position.
thanksTags: None
-
Hello [email protected], and thank you for your question. I couldn't find any documented method called GetOwnerStrategy in the help guide, is this a method you or another programmer wrote?
If you would like a "this" reference available to static calls, you can use a static member such as
Code:private static Strategy self;
If you would like to do this in another thread (for example, from another strategy), then you will need to use a Dispatcher, publicly available documentation https://msdn.microsoft.com/en-us/lib...ispatcher.aspx .
Please let us know if there are any other ways we can help.Jessica P.NinjaTrader Customer Service
-
This is an example of a method signature I am using:
public static void SendMailonExit(Execution execution)
{
var sgn = (execution.Order.OrderAction == OrderAction.BuyToCover ? 1 : -1);
var strategy = execution.Order.GetOwnerStrategy();
var state = strategy.State;
var account = strategy.Account;
var performance = strategy.SystemPerformance;
Comment
-
Hello [email protected],
Thank you for your response.
GetOwnerStrategy() is not a supported method for Order. Any reason you do not wish to pass through "this" for the strategy?
I look forward to your response.
Comment
-
-
You can define your method signature to support any approach you would prefer. A signature that would accept a "this" reference may be
Code:public static void SendMailonExit(Strategy strategy, Execution execution)
Jessica P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, Today, 12:56 PM
|
2 responses
15 views
0 likes
|
Last Post
by WHICKED
Today, 02:15 PM
|
||
Started by Felix Reichert, Today, 02:12 PM
|
0 responses
1 view
0 likes
|
Last Post Today, 02:12 PM | ||
Started by Tim-c, Today, 02:10 PM
|
0 responses
1 view
0 likes
|
Last Post
by Tim-c
Today, 02:10 PM
|
||
Started by cre8able, Today, 01:16 PM
|
2 responses
9 views
0 likes
|
Last Post
by cre8able
Today, 01:40 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
3 responses
49 views
0 likes
|
Last Post Today, 01:29 PM |
Comment