Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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...
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 Skifree, Today, 03:41 AM
|
5 responses
13 views
0 likes
|
Last Post
by Skifree
Today, 12:36 PM
|
||
Started by Mongo, Today, 11:05 AM
|
3 responses
13 views
0 likes
|
Last Post Today, 12:32 PM | ||
Started by traderqz, Today, 12:06 AM
|
6 responses
13 views
0 likes
|
Last Post
by traderqz
Today, 12:17 PM
|
||
Started by traderqz, Yesterday, 09:06 AM
|
5 responses
34 views
0 likes
|
Last Post Today, 12:03 PM | ||
Started by guillembm, Today, 11:25 AM
|
1 response
6 views
0 likes
|
Last Post Today, 12:01 PM |
Comment