STOP e LIMIT order, Stop Loss e Trailing Stop

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #128640 quote
    stefanokto
    Participant
    New

    Buongiorno,

    non riesco a capire come poter impostare un ordine di tipo stopl limit order ed uno stop loss candela candela in daily.

    Per esempio:

    supponiamo di voler aprire una posizione al superare del livello massimo della candela 0 ma senza che il presso supero l’1% per esempio.

    analogamente non vorrei impostare un trailing stop che mi aggiorna i valori sul minimo della candela. ho provato con i comandi low e dlow ma senza successo (lo stop non viene proprio considerato)

    Grazie

    #128667 quote
    robertogozzi
    Moderator
    Master

    Un’entrata sopra il massimo, con un limite dell’1% si può scrivere:

    Prezzo = high + 1 * pipsize
    Diff   = (Prezzo - Close) * 100 / close
    If Diff <= 1 then
       Buy 1 contract at Prezzo STOP
    Endif
    #128670 quote
    robertogozzi
    Moderator
    Master

    Come deve essere lo stop loss ed il trailing stop?

    #128690 quote
    stefanokto
    Participant
    New

    Vorrei impostare lo stop loss sotto il minimo della candela di progetto ed il trailing sotto i minimi delle candele successive.

    Grazie mille 🙂

    #128697 quote
    robertogozzi
    Moderator
    Master

    Eccolo (è la stessa versione Long di cui sopra):

    Prezzo = high + 1 * pipsize
    Diff   = (Prezzo - Close) * 100 / close
    If Diff <= 1 then
       Buy 1 contract at Prezzo STOP
       Set Stop Loss (Prezzo - (low - 1 * pipsize))
    Endif
    IF OnMarket THEN
       IF close - tradeprice > 0 Then
           Set Stop Loss (close - (low - 1 * pipsize))
       ENDIF
    ENDIF
    #128704 quote
    stefanokto
    Participant
    New

    Stasera lo provo!

    Grazie mille!!

    #128732 quote
    stefanokto
    Participant
    New

    Buonasera Roberto,

    ho provato la codifica da te suggerita ma sembrerebbe che qualcosa non vada. La posizione si apre correttamente ma non chiude in trailing candela-candela. Le allego uno screen fatto sul titolo GILD in data 29/06/2018.

    In teoria l’oscita dovebbre avvenire in data 11/07/2018 dopo la rottura del minimo della candela precedente, invece per qualche motivo lo stop avviene molto più avanti.

    Immagine.jpg Immagine.jpg
    #128745 quote
    robertogozzi
    Moderator
    Master

    Prova questo:

    defparam cumulateorders = false
    ONCE SL = close
    Prezzo = high + 1 * pipsize
    Diff   = (Prezzo - Close) / close * 100
    If Diff <= 1 then
       Buy 1 contract at Prezzo STOP
       SL = (Prezzo - (low - 1 * pipsize))
       Set Stop Loss SL
       SET Target profit  SL * 2
    Endif
    IF OnMarket THEN
       IF PositionPerf > 0 Then
          SL = min(SL[1],(close - (low - 1 * pipsize)))
          Set Stop Loss SL
       ENDIF
    ENDIF
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

STOP e LIMIT order, Stop Loss e Trailing Stop


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
stefanokto @stefanokto Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by robertogozzi
5 years, 9 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 04/28/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...