TRAILING STOP "SPECIALE"

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41989 quote
    Riccardo Angeletti
    Participant
    New

    Vorrei impostare un trailing stop che mi consenta di uscire quando il prezzo ha ritracciato del 50% dal massimo raggiunto.

    il problema consiste nel fatto che non trovo una funzione che mi consenta di calcolarlo direttamente. Basterebbe anche sapere quante candele sono passate dopo l’apertura della posizione in modo da calcolare il massimo tra queste candele e quindi ricavare il mio dato.

    Qualcuno sa come si fa?

    #42029 quote
    Nicolas
    Keymaster
    Master

    > Inserite il segno di spunta all’interno della casella sul vostro profilo, per aggiornare il vostro paese. <<

    Non ho ancora testato questo codice, basta un rapido cambiamento del MFE trailing stop si possono trovare nella sezione blog del sito web.
    Così, in questa versione del trailing stop, gli ordini saranno usciti a metà strada entre les prezzo di ogni ordini aperti e l’oro massima minima (dipende se si tratta di un acquisto o un ordine di vendita) Prezzo mette hanno già.

    //resetting variables when no trades are on market
    if not onmarket then
     MAXPRICE = 0
     MINPRICE = close
     priceexit = 0
    endif
    
    //case SHORT order
    if shortonmarket then
     MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
     priceexit = TRADEPRICE-(TRADEPRICE-MINPRICE)/2
    endif
    
    //case LONG order
    if longonmarket then
     MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
     priceexit = TRADEPRICE+(MAXPRICE-TRADEPRICE)/2
    endif
    
    //exit on trailing stop price levels
    if onmarket and priceexit>0 then
     EXITSHORT AT priceexit STOP
     SELL AT priceexit STOP
    endif
    #42548 quote
    Roberto S.
    Participant
    Average

    Ciao Nicolas, per caso può funzionare anche un:

    maxPrice = highest[tradeIndex - barIndex](close)

    ?

    Grazie ciao

    R

    #42553 quote
    robertogozzi
    Moderator
    Master

    Roberto S. mi sembra interessante la tua riga di codice, basterà poi calcolare il 50% (o quel che si vuole) di “maxPrice”!

    #42561 quote
    Nicolas
    Keymaster
    Master

    Buona idea, ma dovresti usare “High” invece di “Close”, che è il prezzo massimo che la quota ha raggiunto.

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

TRAILING STOP "SPECIALE"


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by Nicolas
8 years, 6 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 07/30/2017
Status: Active
Attachments: No files
Logo Logo
Loading...