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
Strategy disabled detection
Collapse
X
-
Hello johnman,
Thank you for your post.
You could monitor for State == State.Terminated in OnStateChange and then perform any cleanup actions - what are you needing to accomplish on termination of the strategy?
Thanks in advance; I look forward to assisting you further.Kate W.NinjaTrader Customer Service
-
Hello johnman,
Thank you for your reply.
You wouldn't be able to use Share() while the strategy is in anything other than State.Realtime unfortunately, which is what you'd need to send a text or email. Theoretically, you could use a public static variable that gets updated when the state is Terminated, however. I will work up an example and get that posted for you.
Thanks in advance; I look forward to assisting you further.Kate W.NinjaTrader Customer Service
Comment
-
Hello johnman,
Thank you for your patience.
I'm attaching a file you can import that contains three demonstration scripts. First, there is an addon script in which we create a static bool variable. There is also an indicator that would need to be applied to the chart (StrategyTerminatedAlert), then the actual Strategy itself (ExampleOnTerminatedStrategy). You'll want to open up the indicator and replace my test email address with your actual email, and you would need to set up the email in Tools > Options > General > Share Services if you've not already set that up. Obviously you could replace the method of alert with another alert method of your preference, but for simplicity's sake I chose email for this example.
Once you've imported the attached file and set up the email, you'll want to apply the indicator to the chart first, then the strategy. You can test if the email is working by toggling the strategy on and off from the Strategies tab of the control center - you should get an email each time the strategy is toggled if you've set up the email correctly.
Here's a link to our forums that goes over the necessary setup needed for email:
Below is a list of known e-mail settings and information demonstrating configuring e-mail alerts within NinjaTrader. Included are settings which have been tested with basic accounts. Please ensure that your settings are configured identically to those included, as some only use the beginning of the e-mail address and do not
Please let us know if we may be of further assistance to you.Attached FilesKate W.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by f.saeidi, Today, 05:56 AM
|
1 response
3 views
0 likes
|
Last Post
by Jltarrau
Today, 06:00 AM
|
||
Started by Jltarrau, Today, 05:57 AM
|
0 responses
4 views
0 likes
|
Last Post
by Jltarrau
Today, 05:57 AM
|
||
Started by Stanfillirenfro, Yesterday, 09:19 AM
|
7 responses
51 views
0 likes
|
Last Post Today, 05:31 AM | ||
Started by TraderCro, 04-12-2024, 11:36 AM
|
4 responses
70 views
0 likes
|
Last Post
by Mindset
Today, 05:29 AM
|
||
Started by Mindset, Yesterday, 02:04 AM
|
1 response
15 views
0 likes
|
Last Post
by Mindset
Today, 05:26 AM
|
Comment