Ho impostato una strategia short e vorrei che se il trade va in stop mi faccia lo stop e reverse UNA SOLA VOLTA. Riporto il codice che ho utilizzato. Il problema è che il trade (long) di stop and reverse continua a entrare di nuovo se anche il trade stop&reverse è andato in stop. Come posso fare per fare in modo che faccia SOLO un trade di stop e reverse e non continui a farne altri long indipendentemente dal profitto o stop di quest’ultimo? Grazie
//strategia short
if condizioni short then
sellshort 1 contract at market
mystop=20
Myprofit=30
endif
Set stop loss mystop
Set target profit myprofit
//strategia di stop&reverse
if strategyprofit<>strategyprofit[1] then
if positionperf(1)<0 then
if close>tradeprice(1) then
gain=-1
elsif close>tradeprice(1) then
gain=1
endif
else
gain=0
endif
endif
IF gain=-1 then
buy 1 contracts at market
mystopb= 20
Myprofitb=40
Set stop loss mystopb
Set target profit myprofitb
endif