quando il sistema entra in funzione non mi ritrovo gli stop inseriti nel backtest funziona benissimo.
NTICK = xxxx
N2TICK =xxxx
X1 =xxxxxxx
X2 =xxxxxxx
c4=barindex-tradeindex=4
//Long entry
if Close < xxxxxxx <= X1 andxxxxxxxxx) >= X2 then
buy 1 shares at xxxxx + xxxxxxx stop
endif
//stop loss massimo in punti dal prezzo ingresso
if LongOnMarket and c4 then
SELL AT MARKET
set stop ploss 85
set target profit 500
endif
//Short entry
if Close > xxxxxxxxxxxx <= X1 xxxxxxxxxxx>= xxxxxxx then
sellshort 1 shares at xxxxxxxxxx – xxxxxxxxxxx stop
endif
//stop loss massimo in punti dal prezzo ingresso
If ShortOnMarket AND c4 THEN
EXITSHORT AT MARKET
set stop ploss 85
set target pprofit 500
endif
Roberto ….mi interessa mettere gli stop loss e lo stop proffit …appena entro a mercato. Perché nel testing è perfetto?
Roberto riesci a correggere i miei errori
Basta spostare le righe dove ci sono SET STOP e SET TARGET dall’IF delle uscite a quello delle entrate, anzi, meglio rimuovere quelle 4 linee e aggiungerle alla fine (o all’inizio, è indifferente):
NTICK = xxxx
N2TICK =xxxx
X1 =xxxxxxx
X2 =xxxxxxx
c4=barindex-tradeindex=4
//Long entry
if Close < xxxxxxx <= X1 andxxxxxxxxx) >= X2 then
buy 1 shares at xxxxx + xxxxxxx stop
endif
//stop loss massimo in punti dal prezzo ingresso
if LongOnMarket and c4 then
SELL AT MARKET
endif
//Short entry
if Close > xxxxxxxxxxxx <= X1 xxxxxxxxxxx>= xxxxxxx then
sellshort 1 shares at xxxxxxxxxx – xxxxxxxxxxx stop
endif
//stop loss massimo in punti dal prezzo ingresso
If ShortOnMarket AND c4 THEN
EXITSHORT AT MARKET
endif
set stop ploss 85
set target pprofit 500