Can someone show me how to do this, step by step? Thank you in advance!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
multiple Time Series in strategy builder.
Collapse
X
-
multiple Time Series in strategy builder.
Hello. I cannot find a good answer. I'm trying to add multiple Time Series in my strategy using Strategy Builder. i.e., I want my strategy to be active from 4:00-6:00 am. Then 7:00-9:00 am. Then 12:00 to 1:00 pm.
Can someone show me how to do this, step by step? Thank you in advance!Tags: None
-
Hello,
Thank you for your post.
Here are two approaches to set up your desired time filtering:
1. Using a Custom Trading Hours Template
You can apply a custom trading hours template to your strategy.
Keep in mind that this method alters the underlying data, which in turn affects indicator values.
For more details, please review the NinjaTrader documentation here:2. Using a Boolean Variable and Condition Groups in the Conditions and Actions Screen
Within the Strategy Builder, you can create a Boolean variable in the Inputs and Variables time filter (set to false).
Then, in the Conditions and Actions screen, configure two sets. The first set would have 3 conditions groups which set the Boolean to 'True' if any of the conditions groups are true.
The second set would trigger your entry order if the Boolean is True.
Each conditions group should use "If all" logic with two conditions:- Group 1: Time Series is greater than or equal to Time Value 4 AM and less than 6 AM.
- Group 2: Time Series is greater than or equal to Time Value 7 AM and less than 9 AM.
- Group 3: Time Series is greater than or equal to Time Value 12 PM and less than 1 PM.
- The explanation for Inputs and Variables starts at 24:21 - https://www.youtube.com/watch?v=HCyt90GAs9k&t=1461s
- Conditions and Actions starts at 32:04 - https://www.youtube.com/watch?v=HCyt90GAs9k&t=1924s
- Time Filters start at the 43:30 mark - https://www.youtube.com/watch?v=HCyt...tu.be&t=43m30s
If you choose to unlock your strategy for manual coding, please note that it will no longer be editable using the Strategy Builder.
To help with coding a time filter in an unlocked script, here’s an example reference:Please let me know if you need any further assistance.
-
Eduardo - thank you so much for your response!! Much appreciated! I was on the right track. Another question - can that setup that you explained be used with another Bool variable. I had the strategy set up to trade as a "One and done for the day" trade with a bool. I did have the strategy working with this "one and done for the day" Bool. Will this setup work after adding the Time Filter Bool? I have added 3 screenshots, of Set 1, Set 2, and Set 3 in the strategy builder.
Comment
-
Hello tar26991,
In the set containing your entry, actions are executed only "if all" conditions are met. I noticed that you have two CCI conditions along with the Boolean conditions.
If one or more of the conditions in this set are not being met, your script would not place your entry order as expected.
To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.
In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order.
The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.
The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.
Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).
Furthermore, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.
After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.
I am happy to assist you with analyzing the output from the output window.
Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.
Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
57 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
37 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
18 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
20 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
49 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment