I know about the normal "exit on close" that exits on every end of day. I am trading currencies - and would like to keep open trades open except on Fridays.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
exit on friday or last day of week
Collapse
X
-
exit on friday or last day of week
Is there a simple way to that I can code my strategy to exit on Fridays?
I know about the normal "exit on close" that exits on every end of day. I am trading currencies - and would like to keep open trades open except on Fridays.Tags: None
-
Thank you but
Thank you Bertrand but I may have not been descriptive enough. I think the code will result in my trades being exited at the beginning of Friday - while I want it to exit at the end of the session of Friday. I assume I have to include time as well - in addition to day of week? If correct please provide a snippet of that includes time pleaseOriginally posted by NinjaTrader_Bertrand View PostHi verge, you can for example work with this snippet below -
Code:if (Time[0].DayOfWeek == DayOfWeek.Friday) { ExitLong(); ExitShort(); }
Comment
-
You could simply add your time to exit then to this condition -
This would fire an ExitLong / ExitShort on Friday and local time being equal or greater then 1200, you can adapt to your needs.Code:if (Time[0].DayOfWeek == DayOfWeek.Friday && ToTime(Time[0]) >= 120000) { ExitLong(); ExitShort(); }
Comment
-
Hi
i'm reading this really interesting answer from Bertrand... i put this code on my script with a hour of 180000... so my trade close Friday at 18:00 but (sorry there is always a but) if there is a signal after Friday 18:00... my script take a position and close it on the next bar (i'm running my script in 15minutes)
so my question is: how to say
if (Time[0].DayOfWeek == DayOfWeek.Friday && ToTime(Time[0]) >= 180000)
{
ExitLong();
ExitShort();
AND DO NOT TAKE ANY POSITION BETWEEN FRIDAY 18:00 AND 22:00 (the real close of the market)
}
Can you help ?
Thx
Comment
-
Hi
do you have a code example
because i put
if (Time[0].DayOfWeek != DayOfWeek.Friday && ToTime(Time[0]) < 180000)
enterlong...
and the problem is than it doesn't not take position every day after 18:00... i want than the strategy doesn't take a position after 18:00 but only on friday, not every day...
how to say friday after 18:00 ?
Comment
-
Thomas,
Could you perhaps send this strategy to me? You can either attach it here or send to [email protected] with attn : adam in the message.Adam P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
664 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
376 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
110 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
575 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
580 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment