Any ideas?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
A possible bug with exit on close?
Collapse
X
-
A possible bug with exit on close?
I run a strategy that does exit on close. Last night it exited before the close. This morning I stopped my strategy and reran it. Before the open it had a "virtual" open position which never got closed. Now my strategy thinks it has an open position so it won't enter any new positions. I have wait until flat set to be true but I'm not sure that matters. It seems I'm stuck until my strategy will stop out.
Any ideas?Tags: None
-
Hi cunparis, thanks for your post - at which time was the exit order submitted? To debug this it would be best to use TraceOrders = true in the Initialize() - http://www.ninjatrader-support.com/H...aceOrders.html
-
The order was exited yesterday 30 seconds before close. That works.Originally posted by NinjaTrader_Bertrand View PostHi cunparis, thanks for your post - at which time was the exit order submitted? To debug this it would be best to use TraceOrders = true in the Initialize() - http://www.ninjatrader-support.com/H...aceOrders.html
The problem is the strategy thinks it hasn't exited when I rerun it. I presume this is because the last bar of yesterday isn't closed until the first bar of today. Something like that.
Comment
-
Thanks, I also suspect you see this because as you restarted this morning the last bar from yesterday was still open, thus leaving you with a virtual position if the Mar****nClose did not trigger. So to debug this you would need to rerun this with the TradeOrders enabled and check the output window if it triggered again as you did the reload.
Comment
-
I'm not sure what you mean by rerun, this happened with live trading with real money.Originally posted by NinjaTrader_Bertrand View PostThanks, I also suspect you see this because as you restarted this morning the last bar from yesterday was still open, thus leaving you with a virtual position if the Mar****nClose did not trigger. So to debug this you would need to rerun this with the TradeOrders enabled and check the output window if it triggered again as you did the reload.
Fortunately my strategy didn't trigger today so I didn't miss a trade but I'm quite sure this is a bug.
Comment
-
cunparis,
You need to reproduce this with TraceOrders or else we have no information to advise you on.
As you rerun your strategy in the you will likely not receive an Exit on Close order because your closing bar has not closed. Only TraceOrders will reveal what is happening.Josh P.NinjaTrader Customer Service
Comment
-
It didn't close tonight either. It's never going to close. The only solution I can think of is to save the strategy to a new name and run it.Originally posted by NinjaTrader_Josh View Postcunparis,
You need to reproduce this with TraceOrders or else we have no information to advise you on.
As you rerun your strategy in the you will likely not receive an Exit on Close order because your closing bar has not closed. Only TraceOrders will reveal what is happening.
Have you tried reproducing it? It should be pretty easy. Just enter on open and let it close on exit. Then stop the strategy after hours and run it again and see it has the virtual position that doesn't close.
You don't even have to wait until 4pm just use a session time from 9:30 to 10:00.
Comment
-
cunparis,
Please run with TraceOrders = true. As stated, when you stop your strategy and restart you are now in backtest mode. This is NOT the same as real-time. The last bar has not closed and as such you will likely NOT receive any Exit on Close till that bar closes. Only with TraceOrders = true will you know what is going on. Please use it.Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
648 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 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
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment