Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Exit on session close only when current open position is negative
Collapse
X
-
Exit on session close only when current open position is negative
Hello, I would like to set a rule in the strategy builder that will close a position at session close, only when it is in minus. Can the team here support me how to do this? Thanks a lot! -
Hello StefanA,
Welcome to the NinjaTrader forums!
This would be too advanced for the Strategy Builder.
You would need to disable the Exit on session close functionality, then write your own custom logic to exit the position at the end of the session.
The PreventEntryAfterExitOnCloseExample_NT8 script below provides a helpful demonstration of using a sessionIterator to get the end time of a session.
NinjaTrader Community, A common inquiry is that the Exit on close didn't work in a NinjaScript Strategy because there is a position after the exit on close should have occurred. When viewing the log we often find that the Exit on close does indeed exit the position shortly before the end of the session (based on the Exit on
To check the open position use Position.GetUnrealizedProfitLoss().
Chelsea B.NinjaTrader Customer Service
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
58 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
34 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
197 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
362 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
282 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
Comment