Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue with setting certain time to trade

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    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.

    Comment


      #3
      Hi Jesse,

      Thank you for the quick response. Does it matter what set number I do these in? Also, there are a couple of different times that I would like to block off trading. How do I add another time frame to this strategy as well?

      Thanks for your help

      Comment


        #4
        Also I would like to be able to do it this way but for some reason I still do not get any entries. See attached photo.

        Comment


          #5
          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


            #6
            Thank you for the help. I got the time period from 6-7 to block off but say I want to have 6-7 and also 9:00-10:00 blocked off how do I go about doing that?

            Comment


              #7
              Hello TDHarris5,

              You could define any number of conditions groups with timespans into set 2 and then use the "if any" option for that set.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              55 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              132 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              73 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              45 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              49 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X