2 SUPERTREND E ADX

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #144717 quote
    Gaspare
    Participant
    Veteran

    Buonasera, ciao Roberto

    vorrei modificare solo la chiusura della posizione, eliminando il target profit

    se sono long si chiude quando il prezzo incrocia al ribasso il secondo supertrend

    se sono short si chiude quando il prezzo incrocia al rialzo il secondo supertrend

    Grazie

     

     

    DEFPARAM CumulateOrders = false
    St1   = Supertrend[50,2]
    St2   = Supertrend[10,1]
    L1    = close > St1
    L2    = close CROSSES OVER  St2
    S1    = close < St1
    S2    = close CROSSES UNDER St2
    MyADX = ADX[14] > 25
    Lcond = L1 AND L2 AND MyADX AND Not OnMarket
    Scond = S1 AND S2 AND MyADX AND Not OnMarket
    IF Lcond THEN
       BUY 1 CONTRACT AT MARKET
    ENDIF
    IF Scond THEN
       SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    SET TARGET pPROFIT 100
    SET STOP   pLOSS   50
    
    
    #144798 quote
    robertogozzi
    Moderator
    Master

    Eccolo (non l’ho provato):

    DEFPARAM CumulateOrders = false
    St1   = Supertrend[50,2]
    St2   = Supertrend[10,1]
    L1    = close > St1
    L2    = close CROSSES OVER  St2
    S1    = close < St1
    S2    = close CROSSES UNDER St2
    MyADX = ADX[14] > 25
    Lcond = L1 AND L2 AND MyADX AND Not OnMarket
    Scond = S1 AND S2 AND MyADX AND Not OnMarket
    IF Lcond THEN
       BUY 1 CONTRACT AT MARKET
    ENDIF
    IF Scond THEN
       SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    IF LongOnMarket AND S2 THEN
       SELL AT MARKET
    ENDIF
    IF ShortOnMarket AND L2 THEN
       EXITSHORT AT MARKET
    ENDIF
    SET STOP   pLOSS  50
    #149920 quote
    Gaspare
    Participant
    Veteran

    Ciao Roberto

    un chiarimento , per cortesia

    posso usare la funzione      SET STOP pTRAILING 50

    al posto della      SET STOP   pLOSS  50  ?

    dovrei cmq avere sempre lo stop loss a 50, vero?

    ma in piu’ il profitto segue il trend, a favore, e puo’ chiudere la posizione

    prima che il prezzo incrocia il secondo supertrend, con un guadagno maggiore,

    in caso di ritracciamento.

    Grazie

    #149921 quote
    robertogozzi
    Moderator
    Master

    No, solo uno dei due è consentito.

    Ad ogni modo al posto di SET STOP pTRAILING è consigliabile usare un trailing stop creato con il codice, un esempio è alle righe da 17 a 56 a questo link https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/.

    Se cerchi TRAILING STOP sul forum troverai un sacco di esempi e discussioni in merito.

    #171671 quote
    Gaspare
    Participant
    Veteran
    DEFPARAM CumulateOrders = false
    
    MyAdx = Adx [5] >= 40
    St1   = Supertrend[5,10]
    St2   = Supertrend[2.5,20]
    L1    = close > St1
    L2    = close CROSSES OVER St2
    
    S1    = close < St1
    S2    = close CROSSES UNDER St2
    
    Lcond =  L1 AND L2  AND Not OnMarket
    Scond =  S1 AND S2  AND Not OnMarket
    IF Lcond and MyAdx THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    IF Scond and MyAdx THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    SET STOP   pLOSS   50
    SET TARGET pPROFIT 100
    

    Ciao Roberto

    ho attivato questo TS sul Dax con TF 1 minuto su 200 k, ma ci sono troppi eseguiti al giorno;

    allora vorrei collegarlo al grafico orario h1 in modo tale che apra posizioni

    long se su h1 siamo long

    short se su h1 siamo short

    Grazie

    #171678 quote
    robertogozzi
    Moderator
    Master

    Basta che lo esegui dal grafico impostato con il TF di tua scelta, h1, h4, Daily, ecc…

    #171679 quote
    Gaspare
    Participant
    Veteran

    Non sono stato chiaro, scusa

    io chiedo che i due TF siano legati insieme, in multi TF,

    in modo che vengano aperte posizioni dal TF 1 minuto in funzione del TF h1

    se in h1 siamo long il m1 deve aprire solo posizioni long

    se in h1 siamo short il m1 apre solo short

    #171680 quote
    robertogozzi
    Moderator
    Master

    Ok, vuoi usare il supporto MTF (Multi Time Frame).

    Devi:

    • aggiungere Timeframe(1 hour,UpdateOnClose) alla riga 2
    • aggiungere Timeframe(default) tra le righe 13 e 14.
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

2 SUPERTREND E ADX


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Gaspare @gaspare Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 09/18/2020
Status: Active
Attachments: No files
Logo Logo
Loading...