Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
The "Exit on close" time
Collapse
X
-
The "Exit on close" time
In NT, Is there a setting for "Exit on close" for each commodity. I was experiementing with backtesting and the times set happened to be 12 to 12. And i saw that the "exit on close" trades were being placed at 12, instead of the market closing time. Do you set the closing time for each commodity in NT? How?Tags: None
-
Hi ju1234,
This cannot be set individually for each symbol.
Please look into this link http://www.ninjatrader-support.com/H...itOnClose.html
and use the 'ExitOnClose = True' command in your Initialize section, this will allow to use the session endling times then to flatten your positions.
Please also review this link here - http://www.ninjatrader-support2.com/...ead.php?t=3226
Comment
-
Hi ju1234,
Have you reviewed my second link? It details how TimeFilters can be used to limit trading hours of a strategy - http://www.ninjatrader-support2.com/...ead.php?t=3226
You could add this snippet to your strategy to close out positions at 15:59 for example -
Code:[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][SIZE=2][SIZE=2] ((ToTime(Time[[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]]) >= [/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]155900[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2])) { ExitLong(); ExitShort(); } [/SIZE][/SIZE]
You can also use one chart for your strategy and use another for your charting (this would then include 24hr data if you like)
Comment
-
Hi guys,
Seemingly I am not the only one with ExitOnClose-related problems. My problem;
I want to close all open positions 60 seconds before the end of trading. I have the following settings:
ExitOnClose = true;
ExitOnCloseSeconds = 60;
I am paper trading 6E (Sim account). My computer is in the Finnish time (= CST + 8 hours) so when trading stops at 16 CST on Globex, it's midnight in Finland.
Everything seems to work fine when backtesting ('Exit on closes' plotted on charts), but when I run my strategies with real-time data, open positions remain open after midnight. What's the problem and what's the recommended way of fixing it? Can I use 'ExitOnClose' (how?) or should I resort to 'ToTime(Time[0]) >= 235900'? Cheers...
Comment
-
thanks for thisOriginally posted by NinjaTrader_Bertrand View PostHi ju1234,
Have you reviewed my second link? It details how TimeFilters can be used to limit trading hours of a strategy - http://www.ninjatrader-support2.com/...ead.php?t=3226
You could add this snippet to your strategy to close out positions at 15:59 for example -
Code:[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][SIZE=2][SIZE=2] ((ToTime(Time[[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]]) >= [/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]155900[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2])) { ExitLong(); ExitShort(); } [/SIZE][/SIZE]
You can also use one chart for your strategy and use another for your charting (this would then include 24hr data if you like)
Comment
-
Thanks,
My PC clock is in time - cannot figure out how sync with Internet time could help. But that 'ToTime' thing appears to work as expected, so I'll use it.
Comment
-
Exit On Close problem.
In my strategy I have session start time 0:02 and end 0:00
I am using multi time frame strategy. And its closes my session 8:02pm.
I don't have any ExitonCLose settings.
I want to close end of session. But it closes ealier.
Thanks
I also tried to use your example. ExitOnClose=false;
and then add manual exit, still its exits 8:02 pm.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment