Salve,
avendo questo sistema che lavora sul Dow Jones:
MMlungo= Average[200]
MMcorto= Average[5]
MyAdx = ADX[5]
// posizione Long
If close > mmlungo and close < mmcorto and myadx > 35 then
buy at lowest[2](low) LIMIT
endif
if close > mmcorto then
sell at market
endif
// posizione Short
If close < mmlungo and close > mmcorto and myadx > 35 then
sellshort at highest[2](high) LIMIT
endif
if close < mmcorto then
exitshort at market
endif
sarebbe possibile aggiungere un filtro di volatilità tramite l’ATR?
Nel dettaglio, si richiede che il filtro faccia attivare il sistema principale quando si caratterizza un valore dell’ATR a 5 periodi inferiore al valore dell’ATR a 10 periodi (valori ovviamente cambiabili a piacimento).
Grazie in anticipo.
Prova il TS con queste aggiunte:
MMlungo= Average[200]
MMcorto= Average[5]
MyAdx = ADX[5]
MyAtr5 = AverageTrueRange[5](close)
MyAtr10 = AverageTrueRange[10](close)
MyAtr = MyAtr5 < MyAtr10
// posizione Long
If close > mmlungo and close < mmcorto and myadx > 35 AND MyAtr then
buy at lowest[2](low) LIMIT
endif
if close > mmcorto then
sell at market
endif
// posizione Short
If close < mmlungo and close > mmcorto and myadx > 35 AND MyAtr then
sellshort at highest[2](high) LIMIT
endif
if close < mmcorto then
exitshort at market
endif
Ho inserito i due ATR ed ho aggiunto un AND MyAtr alle righe dove entri Long e Short.
Roberto
Grazie Roberto, ti chiedo un’ultima cosa:
è possibile inserire dei parametri orari, da poter modificare a piacimento, in cui far funzionare il ts?
Si, vedi come l’ho modificato:
IF time >= 090000 OR time <= 180000 THEN //Attivo solo dalle 9 alle 18
Operativita = 1
ELSE
Operativita = 0
ENDIF
MMlungo= Average[200]
MMcorto= Average[5]
MyAdx = ADX[5]
MyAtr5 = AverageTrueRange[5](close)
MyAtr10 = AverageTrueRange[10](close)
MyAtr = MyAtr5 < MyAtr10
// posizione Long
If close > mmlungo and close < mmcorto and myadx > 35 AND MyAtr AND Operativita then
buy at lowest[2](low) LIMIT
endif
if close > mmcorto then
sell at market
endif
// posizione Short
If close < mmlungo and close > mmcorto and myadx > 35 AND MyAtr AND Operativita then
sellshort at highest[2](high) LIMIT
endif
if close < mmcorto then
exitshort at market
endif