Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Times for Strategy
Collapse
X
-
Times for Strategy
I have followed other forums on here, but it seems my strategy is having issues implementing on times of day it will trade during. I ideally would like it be off for a certain period of time, but whenever I try to insert those parameters, NinjaTrader views it as the whole day and will ignore the other conditions of my strategy or ignores time altogether. If I could just get a screenshot of the strategy builder having a strategy turned on from 4am to 10:30am or turned off from 10:30am to 4:00pm that would be appreciated.
Tags: None
-
Hello VinnyJalapeno,
Thanks for your post.
Time Filters could be used to limit the times that your strategy will place trades.
In the screenshot you shared, this condition would check if the Time is greater than or equal to 4:00 AM and less than or equal to 10:30 AM. You could set a bool to true within this Set. Then, check if the bool is true in your conditions to place orders. You could create another Time Filter that checks if the Time is greater than 10:30 AM and less than or equal to 4:00 PM and flip the bool to false.
By doing this, trades will only be placed by the script when the bool is true and the bool will only be true during that specific timeframe.
See the attached example script which demonstrates implementing a Time Filter in a Strategy Builder strategy.
And, see this help guide page for more information about creating Time Filters: https://ninjatrader.com/support/help...ateTimeFilters
Let me know if I may assist further.Attached Files<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Thank you for your help so far, not sure if you would be able to assist me with another issue involving WilliamsR. I am trying to potentially implement it into testing for it to only take trades if it's value is less than -80. The issue is that Ninjatrader doesn't recognize it as a value and it still doesn't work as a filter with chop. I had one version where it was taking trades using WilliamsR, but it would take the trades at -20 which is the exact opposite and didn't work as a filter.
I have a different version of the strategy involving a cross of an ema and a stochastic that works fine in live trading, but I was wanting to implement the WilliamsR to cut out tight chop. I can see that a WilliamsR of 6 length will work great for short and long entries if the value is between -80 and -100, but the strategy will either negate the exit of the eventual EMA crossover or it will still take trades at a value of -20. I tried to do initial optimization to test threshold levels, but NinjaTrader wouldn't run trades with set values of 1 due to the indicator giving negative values.
Comment
-
Hello VinnyJalapeno,
Thanks for your note.
If a strategy is not behaving as expected, prints should be added to the script to see exactly how it is evaluating logic.
In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.
Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).
Also, 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.
Below is a link to a forum post that demonstrates how to use prints to understand behavior.
https://ninjatrader.com/support/foru...121#post791121
I have attached a simple example script that you could view demonstrating creating a condition that checks if the Williams R indicator is less than or equal to -80 and draws a dot on the chart above the High of the bar.
Let us know if we may assist further.Attached Files<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
Not exactly sure what it is doing wrong, because it is ignoring the other side of the strategy with only following the WilliamsR signal. It doesn't follow the EMA crossover at all in coordination with. It prints the WilliamsR as an entry, but never even paints the same condition as an exit on the opposite side. It will go an entire trading session based on one entry from WilliamsR and whatever happens happens. It doesn't take the fact that it reaches the same parameters on the short side,
it.
Comment
-
Hello VinnyJalapeno,
Thanks for your note.
" because it is ignoring the other side of the strategy with only following the WilliamsR signal."
What side are you referring to when you mention the above comment?
Generally, if an Entry order is not being placed it is because all of the conditions in the Set required to place that Entry are not becoming true.
To see exactly how the script is behaving you must add prints (outside of the condition) that print out each value being used in your conditions to place your Entry orders. This includes printing out each of the values being used for your crossover conditions, the WilliamsR indicator value, and your custom variable.
Note that when calling an Entry order in the opposite direction, the strategy will reverse positions.
From the Managed Approach help guide page: "Entry() methods will reverse the position automatically. For example if you are in a 1 contract long position and now call EnterShort() -> you will see 2 executions, one to close the prior long position and the other to get you into the desired 1 contract short position."
Managed Approach: https://ninjatrader.com/support/help...d_approach.htm
See this forum thread which demonstrates adding prints to understand behavior and the video in this forum thread demonstrating how to add prints to a strategy created using the Strategy Builder: https://ninjatrader.com/support/foru...121#post791121
Please let me know if I may assist further.Last edited by NinjaTrader_BrandonH; 01-10-2023, 11:35 AM.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
64 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
139 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment