Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Issue with setting certain time to trade
Collapse
X
-
Issue with setting certain time to trade
I am trying to set my algo to not take any trades between 6 and 7 pm. However when I tell it to not take any trades during this time it ends up not taking any trades at all. Attached is a photo of my conditions.1 PhotoTags: None
-
Hello TDHarris5,
That is because the time cant be both less than and greater than a given time. It would be easier to use a variable for this type of use and a couple of additional sets
It looks like that is potentially set 1 from the image, if we assume this is set 1 then you need to insert a couple of new sets so you have a new empty set 1 and set 2. You can add a set and drag it to be the new set 1 and do the same so you have empty sets 1 and 2.
Go to the inputs and variables screen and add a new bool variable with a default value of false.
In set 1 add an action of Misc -> Set your variables name and set it to false by leaving the checkbox unchecked.
In set 2 add a condition that checks if the time is greater than or equal to 6pm.
In set 2 add a condition that checks if the time is less than 7pm
in set 2 add an action of Misc -> Set your variables name and set it to true by checking the box.
In set 3 add a condition that User Variables -> your variables name equals Misc -> false
This will set the variable to true when the time is between 6 and 7pm. If the variable is true then that means the conditions in set 3 won't work during that time. Set 1 is used to reset the variable on each bar so that the condition in set 3 can be true when the time is not between 6 and 7 pm.
-
Hello TDHarris5,
Yes you would need to do it in the first couple of sets like I had described so the variables are set before you use it. The image you have shown is still the same as before, that won't work because the time can't be both less or greater than two different times like that. To make time windows you need to make a span of time like between 6 and 7.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
62 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 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