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
Start/End of day plot
Collapse
X
-
I just want to ask about the time filter. I have set a strategy to starts at 8:30 am and ends at 2:15pm and the other strategy is being set to starts at 8:30am also but it will ends at 3:30 pm. Now, I am just confused because when strategy 1 shuts off at 2:15pm and what will happen is that the strategy 2 will also shuts off at 2:15 while I have set it to shut off at 3:30. Any idea on this? Thanks in advance.
-
I placed the code like this:
if(Time[0] >= startTime)
{
Print("do something");
}
else if(Time[0] <= endTime )
{
print("-------------------------------------------");
print("strategy 1");
print("time:" +Time[0]);
print("-------------------------------------------");
return;
}
that is inside in the onbarupdate() and the strategy 2 is also the same code.
if(Time[0] >= startTime)
{
Print("do something");
}
else if(Time[0] <= endTime )
{
print("-------------------------------------------");
print("strategy 2");
print("time:" +Time[0]);
print("-------------------------------------------");
return;
}
Comment
-
Hello,
I'm not sure if that code alone will completely filter for the trading times you had set. I'd suggest putting the conditions that the strategy is running in side a time filter/wrapper so that these conditions are only true between your start time and end time.
For an example of this, please see our SampleTimeFilter reference:
MatthewNinjaTrader Product Management
Comment
-
Hello I just want to know the overall function of Disable(); code. If I have two strategies running or enabled and my 1st strategy have the Disable(); code at 2:15 pm. Does the Disable(); code will disable all my enabled strategies at 2:15 pm? Or it will only disable the 1st strategy which have the Disable(); code.
Comment
-
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by zstheorist, Today, 07:52 PM
|
0 responses
6 views
0 likes
|
Last Post
by zstheorist
Today, 07:52 PM
|
||
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
150 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
||
Started by mattbsea, Today, 05:44 PM
|
0 responses
6 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
33 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
6 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
Comment