Good morning, I would like to program an Ts in this way:
Enter long if the price is higher than the last candle last week
Enter short if the price is below the minimum candle last week
I have programmed it as code below but it does not work, can anyone tell me why and how to fix it? Thanks so much
// Definizione dei parametri del codice
DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
// Impedisce al sistema di tradare in giorni specifici della settimana
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Condizioni per entrare su posizioni long
c1 = (close > DHigh(1)[1])
IF c1 AND not daysForbiddenEntry THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Condizioni per entrare su posizioni short
c2 = (close < DLow(1)[1])
IF c2 AND not daysForbiddenEntry THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Stop e target
SET STOP $TRAILING 160