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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
152 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
89 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
131 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
127 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment