I’m trying to prevent my system from taking a trade prior to 8pm Sunday night for a system in the US.. to avoid the ASX open. I have added this code however it does not prevent the trade entry.
I have then included ‘noTradeTimeBlock’ in the buy order requirements. I understand this to say to remain false if the time is between 4pm & 8pm of a Sunday. Is there something incorrect here?
When backtesting the system, a trade is still taken at 19:10 of a Sunday night, which I’m trying to avoid. I do also have the PRT time settings set to New York UTC +04:00.
Hi @robertogozzi, thanks for the reply. I tried the code you suggested using ‘OpenTime’ or ‘Time’ and it works but begins to fail when I include the ‘CurrentDayOfWeek=0’. I am trying to avoid the opening of a trade in the hours before the markets open in New York time (8pm).
So, this works to exclude the trade within the time as below
So in plain terms, if it is a Sunday and between 2pm and 8pm I want the strategy not to open any trade. So ‘noTradeTimeBlock’ will positive or true only when it is not a Sunday & between 2pm & 8pm.
I don’t believe the syntax is incorrect but have I then used the ‘CurrentDayOfWeek’ function incorrectly?
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue