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 NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
55 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
132 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
73 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|
Comment