Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Lost Entry Signal
Collapse
X
-
Lost Entry Signal
I have a strategy that enters x number of days before a set date. Yet, if the entry day falls on a Saturday or Sunday the trade does not execute. Is there any type of code I can use so that when this happens the strategy will fall on either the Friday before hand or the the following Monday?Tags: None
-
Hi cboat,
Perhaps you can build a filter to see if check if the entry will occur on a certain day of the week, then resubmit accordingly using Time[0].DayOfWeek
More info at - http://www.ninjatrader-support.com/H...html?DayOfWeek
Creating a custom time filter example at - http://www.ninjatrader.com/support/f...ead.php?t=3226Last edited by NinjaTrader_Tim; 06-09-2010, 02:21 PM.TimNinjaTrader Customer Service
-
Hi cboat,
A few options...
You can return out, something like...
or, you can set a bool flag, something like...Code:if(Time[0].DayOfWeek == DayOfWeek.Saturday || Time[0].DayOfWeek == DayOfWeek.Sunday) return;
Code:if (Time[0].DayOfWeek == DayOfWeek.Saturday) weekendBool = true; if (Time[0].DayOfWeek == DayOfWeek.Monday) weekendBool = false; if(entry conditions && weekendBool ==false) do something;
TimNinjaTrader Customer Service
Comment
-
The strategy is designed to enter "x" amount of days before a given date. Now if x amount of days happens to fall on a saturday or sunday the trade is skipped. I would like to find a way that if the entry signal falls onto one of these days that it would enter on that following monday.
today = Time[0];
entryDate1 = XXXX.AddDays(XXX);
if (entryDate1 == today)
{
}
The strategy works for everything except if the entryDate falls on a saturday or sunday
Comment
-
OK this is what i have at the moment.
if( entryDate1 == DayOfWeek.Saturday)
{
entryDate1 = entryDate1.AddDays(2);
}
When I compile I get the error that "Operator '==' cannot be applied to operands of type 'System.DateTime' and 'System.DayOfWeek'
Is there something simple i am missing?
Comment
-
Excellent Thank you very much. My last question although it isn't that important at the moment is:
Is there anyway that when using the adddays function that it would not count saturday or sunday?
I am just worried that during backtesting I will be getting unreliable data.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
579 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 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
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment