Impostazioni di stop e reverse per un solo trade

Forums ProRealTime forum Italiano Discussioni generiche sul trading Impostazioni di stop e reverse per un solo trade

Viewing 4 posts - 1 through 4 (of 4 total)
  • #245494

    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

     

     

     

    #245498

    Prova questo codice:

    1 user thanked author for this post.
    #245506

    Il codice non legge la performance del sistema. Fa alternativamente short e long. Inoltre quando va in stop in base alla prima strategia non rispetta lo stop ma chiude come gli pare, anche in profitto (Nel mio codice era tutto ok con i valori tranne che continuava a fare a ripetizioni long e si fermava solo al primo trade di nuovo in profit)

    #245522

    Prova questa versione. Ho usato la tua ed ho solo inserito un flag per impedire che ci siano più operazioni LONG senza che prima ce ne sia stata una SHORT:

Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login