Reverse short

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #61239 quote
    andreag76
    Participant
    Average

    Buongiorno, questa modifica di trailing stop può fare in modo che un ts  progettato per il long, faccia reverse sullo short  nel caso in cui il prezzo finisca ad un valore inferiore alla variabile TGS? Come completarlo? L’ho testato e va short, ma occorre dare un target di guadagno o di trailing anche allo short

     

    TGL =28//28
    
    TGS= 40 //40
    if not onmarket then
    MAXPRICE = 0
    MINPRICE = close
    PREZZOUSCITA = 0
    ENDIF
    
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close)
    if MAXPRICE-tradeprice(1)>=TGL*pointsize then
    PREZZOUSCITA = MAXPRICE-TGL*pointsize
    ENDIF
    ENDIF
    if longonmarket then
    MINPRICE = MIN(MINPRICE,close)
    if tradeprice(1)-MINPRICE>=TGS*pointsize then
    PREZZOSHORT = MINPRICE+TGS*pointsize
    ENDIF
    ENDIF
    if onmarket and PREZZOUSCITA>0 then
    SELLSHORT AT PREZZOSHORT STOP
    SELL AT PREZZOUSCITA STOP
    ENDIF
    #61249 quote
    Nicolas
    Keymaster
    Master

    se non sei mai stato in grado di guadagnare più di TGL o TGS, non c’è modo di uscire in profitto in questo codice.

    #61340 quote
    andreag76
    Participant
    Average

    Ok grazie

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Reverse short


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
andreag76 @andreag76 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by andreag76
8 years ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 02/01/2018
Status: Active
Attachments: No files
Logo Logo
Loading...