Q. I want to build a trading strategy that decides which day of the week to go long or go short. If I go long on some day (say Monday), I never want to go short on Monday. I tried putting the Dayofweek indicator in as both long entry and short entry rules, but the optimizer came up with the same day for both the long and short rules.
A. If you just want one long entry day and one short entry day per week,
then you could setup the following rules:
Long Entry (all must be true)
DayofWeek()=X
Not DayofWeek()=Y
Long Condition1
Long Condition2
…
Short Entry (all must be true)
DayofWeek()=Y
Not DayofWeek()=X
Short Condition1
Short Condition2
…
Where the X and Y are linked optimization parameters
If you want more than one long entry day and short entry day per week,
then you’ll need to put the above logic into some OR statements:
Long Entry (all must be true)
OR3(DayOfWeek()=X,DayofWeek()=Y, DayofWeek()=Z)
Not(OR3(DayofWeek()=A, DayofWeek()=B, DayofWeek()=C)
Long Condition1
Long Condition2
…
Short Entry (all must be true)
OR3(DayOfWeek()=A,DayofWeek()=B, DayofWeek()=C)
Not(OR3(DayofWeek()=X, DayofWeek()=Y, DayofWeek()=Z)
Short Condition1
Short Condition2
…
Where the X, Y, Z, A, B, and C are linked optimization parameters