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
Can I create an indicator to start my automated strategies each day?
Collapse
X
-
Regarding IB going offline and that knocking your NinjaTrader offline, you could try as an idea, Tools -> Options -> Strategies -> On connection loss -> Handling = "keep running" or you could increase the threshold amount of time to much more so that IB could reconnect. You could then implement a secondary solution to reconnect IB if needed by restarting TWS such as AutoIT or similar.
-
Originally posted by jaybedreamin View Post
Oh man, this might be just what I was looking for. Seems I have an incorrect understanding of how "Exit on session close" works, however.
I thought this check was needed to ensure that trades are closed by the end of the session if neither a profit target or a stop loss are hit. Are you saying that I can enable my strategies on Sunday, add the timing logic(already have this as it's part of my strategy), and the strategies will still pretty much behave as they are now, until I manually disable on Friday?
I need to correct and clarify... I do use the ExitOnSessionClose:
In State == State.SetDefaults:
IsExitOnSessionCloseStrategy = true;
ExitOnSessionCloseSeconds = (15 * 60) + 20; // 15 min (+20s) before session close to avoid overnight margin requirement
NinjaTrader Brokerage requires all positions to be closed 15 minutes before session ends. Otherwise, you're subject to overnight margins. But, that setting does not shutdown or disable your strategy, it simply ensures all open positions and pending orders are closed/flattened and canceled.
Hope that helps!
Matt
Comment
-
Originally posted by jaybedreamin View PostOh man, this might be just what I was looking for. Seems I have an incorrect understanding of how "Exit on session close" works, however.
I thought this check was needed to ensure that trades are closed by the end of the session if neither a profit target or a stop loss are hit. Are you saying that I can enable my strategies on Sunday, add the timing logic(already have this as it's part of my strategy), and the strategies will still pretty much behave as they are now, until I manually disable on Friday?
and will be reset (aka, re-armed) automatically when a new session is detected
by your strategy.
-=o=-
Btw, a good place to find some strategy code w/logic for start/stop times is here.
The logic also includes 'exclusion' break times, like for an economic report.
Some good points
1. All times are entered as integers, in a 24-Hr format, eg, 0 to 2359.
2. All times are local time, based upon your PC clock.
3. Allows trade for start times < end time, eg, 930 to 1300. (9:30am to 1pm)
4. Allows trade for start times > end time, eg, 2200 to 500. (10pm to 5am)
5. Denies trade for break times, using same logic as 3 & 4.
Enjoy!
Last edited by bltdavid; 03-28-2023, 10:28 PM.
Comment
-
Curious if anyone has figured out, programmatically, how to enable strategies? Seems like there are two threads, 1. Restarting Ninja when it crashes or disconnects (answered) and 2. How to enable a strategy.
Ninja/Apex rules have to close all instruments at 445pm automatically everyday. How do you programmatically enable the strategies at 5 pm everyday?
Thanks for help.
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,406 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
98 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
8 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
160 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
9 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment