Rimbalzi su false rotture supertrend

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #197603 quote
    albespo
    Participant
    New

    Buonasera,

    sto provando a impostare un sistema basato sulle “false” rotture del supertrend, cioè quando il prezzo rompe il supertrend ma alla chiusura della candela tale rottura non è confermata.

    Girovagando per i forum ho trovato il codice adatto:

    ca1=low <= Supertrend[3,10]
    ca2=close > Supertrend[3,10]
    

    ma, se imposto il trading system, mi ritrovo operazioni eseguite anche al cambio di colore del supertrend.

    Allora ho provato inserendo come condizioni rispettivamente per il long e lo short:

    L1 = close > MyST
    S1 = close < MyST

    ma il risultato non cambia, il sistema entra a mercato non solo sulle false rotture, ma anche al cambio di colore del supertrend e, tra l’altro, contro il trend.

    Come posso indicare al sistema di non entrare a mercato se c’è un cambio di colore del supertrend?

     

    Di seguito il codice che sto testando sul Dax a 3 min:

    defparam FLATAFTER = 220300
    defparam FLATbefore = 000000
    DEFPARAM CumulateOrders = false
    MyST= Supertrend[3,10]
    L1 = close > MyST
    S1 = close < MyST
    ca1=low <= Supertrend[3,10]
    ca2=close > Supertrend[3,10]
    ca3=low => Supertrend[3,10]
    ca4=close < Supertrend[3,10]
    Lcond = ca1 and ca2 and l1
    Scond = ca3 and ca4 and s1
    IF Lcond AND Not LongOnMarket THEN
    BUY 1 CONTRACT AT MARKET
    endif
    IF Scond AND Not ShortOnMarket THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    If DayOfWeek = 5 and Time = 215930 Then
    Sell at market
    Exitshort at market
    Endif
    Set stop ploss x
    Set target pprofit y
    #197604 quote
    robertogozzi
    Moderator
    Master

    Questo dovrebbe funzionare (non l’ho provato):

    defparam FLATAFTER = 220300
    defparam FLATbefore = 000000
    DEFPARAM CumulateOrders = false
    MyST= Supertrend[3,10]
    ca1=low <= MyST
    ca2=close > MyST
    ca3=low => MyST
    ca4=close < MyST
    Cambio = (ca2 and ca4[1]) OR (ca2[1] and ca4)
    Lcond = ca1 and ca2 and not Cambio
    Scond = ca3 and ca4 and not Cambio
    IF Lcond AND Not LongOnMarket THEN
    BUY 1 CONTRACT AT MARKET
    endif
    IF Scond AND Not ShortOnMarket THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    If DayOfWeek = 5 and Time = 215930 Then
    Sell at market
    Exitshort at market
    Endif
    Set stop ploss x
    Set target pprofit y
    albespo thanked this post
    #197754 quote
    albespo
    Participant
    New

    Grazie Roberto,

    ho provato il tuo codice ma nulla da fare, gli ordini vengono eseguiti anche al cambio colore del supertrend

    #197792 quote
    MauroPro
    Participant
    Veteran

    Penso che le condizioni ca… non possono essre sulla stessa barra, in quanto poi il TS trovando il segnale ed entrando comunque all’apertura della barra seguente non può sapere se questa è sotto-sopra il myST.

    Prova, ad esempio per il long: low[1] <= myST and close > myST

    #197793 quote
    MauroPro
    Participant
    Veteran

    Anche con il mio suggerimento ho visto che il problema rimane in quanto in ogni caso entri sempre alla barra seguente, dove il ST può sempre cambiare.

    Puoi comunque inserire una condizione aggiuntiva di uscita immediata se, dopo che si è entrati, il ST cambia subito colore.

    #197826 quote
    robertogozzi
    Moderator
    Master

    Il codice che ho postato NON entra al cambio.

    Può accadere che ci sia un cambio immediatamente DOPO l’entrata, ma non ho soluzioni per questo.

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

Rimbalzi su false rotture supertrend


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
albespo @albespo Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by robertogozzi
3 years, 6 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 07/21/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...