Is there a better way to do this? I’ve added
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
but it just opened a position at 21:15 Sunday eve (Eur/USD).
Add this indicator to your chart, to apot what is wrong:
Return OpenDayOfWeek
You mean add that line to the code? it’s giving me a yellow triangle for ‘missing characters’
also tried
Return OpenDayOfWeek COLOURED(210,105,30) AS "tradingdays"
It’s a single line indicator that will return the day of the week, so you can better tell when your condition in your strategy differs, maybe comparing that indicator with the output of GRAPH OpenDayOfWeek.
Adding or removing
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
makes no difference at all, loads of Sunday trades either way. In the UK the Forex restart is 21:00 Sunday, but it looks as if PRC treats it as Monday already.
Both on a 4h and Daily TF, OpenDayOfWeek returns 0 for the sunday bar.
Try this:
daysForbiddenEntry = OpenDayOfWeek > 5 OR OpenDayOfWeek < 1
or you may have misused variable daysForbiddenEntry, in your code.
Have you used NOT with daysForbiddenEntry ?