Swing Points Long Trading System

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #12713 quote
    Conte Caimano
    Participant
    Master

    Swing Points Long Trading System basato sugli Swing Point di Larry William, usa delle barre daily per identificare particolari patterns che con buona probabilità diano vita a un rally rialzista.

    DEFPARAM CumulateOrders = False
    // ---------------------------------------------------------------------
    // Swing points long
    // ---------------------------------------------------------------------
    // --- calcola Lotti
    Once Lotti = 1
    // ---------------------------------------------------------------------
    // Swing points long type 1
    c1 = (close>close[1] and close[1]<close[2])
    c2 = (close[2]>close[3] and close[3]<close[4])
    c3 = (close>close[2] and close[1]>close[3])
    
    EntryLongType1 = c1 AND c2 AND c3
    
    // Swing points long type 2
    c4=(close>close[1] and close[1]<close[2])
    c5=(close[2]>close[3] and close[3]<close[4])
    c6=(close>close[2] and close[1]<close[3])
    
    EntryLongType2 = c4 AND c5 AND c6
    // ---------------------------------------------------------------------
    // --- Strategia
    Long = EntryLongType1 OR EntryLongType2
    // ---------------------------------------------------------------------
    // Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND Long THEN
    BUY Lotti CONTRACTS AT MARKET NEXTBAROPEN
    ENDIF
    
    // ---------------------------------------------------------------------
    // Stop e target:
    //trailing stop function
    trailingstart = 20 //trailing stop iniziale
    trailingstep = 5 //passo per spostare lo "stoploss"
    
    //reset StopLoss
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //gestione posizione Long
    IF LONGONMARKET THEN
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    IF newSL>0 THEN
    SELL AT newSL STOP
    ENDIF
    // ---------------------------------------------------------------------
    #12717 quote
    Nicolas
    Keymaster
    Master

    Ciao Stefano,
    Grazie per il vostro contributo. Vedo che avete un grande prelievo sulla strategia, perché i vostri commerci non hanno alcuna stoploss (tra il 2002 e il 2004, 2009/2010). Forse si potrebbe fare un tentativo per rendere meno stressante? 🙂

    #12719 quote
    Conte Caimano
    Participant
    Master

    Ciao Nicolas,

     

    in effetti mancava la gestione dello stop loss, quindi , ho rivisto il codice e ti inoltro quello nuovo.

    Che ne pensi ?

    DEFPARAM CumulateOrders = False
    // ---------------------------------------------------------------------
    // Swing points long
    // ---------------------------------------------------------------------
    // --- calcola Lotti
    Once Lotti = 1
    // ---------------------------------------------------------------------
    // Swing points long type 1
    c1 = (close>close[1] and close[1]<close[2])
    c2 = (close[2]>close[3] and close[3]<close[4])
    c3 = (close>close[2] and close[1]>close[3])
    
    EntryLongType1 = c1 AND c2 AND c3
    
    // Swing points long type 2
    c4=(close>close[1] and close[1]<close[2])
    c5=(close[2]>close[3] and close[3]<close[4])
    c6=(close>close[2] and close[1]<close[3])
    
    EntryLongType2 = c4 AND c5 AND c6
    // ---------------------------------------------------------------------
    // --- Strategia
    Long = EntryLongType1 OR EntryLongType2
    // ---------------------------------------------------------------------
    // Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND Long THEN
    BUY Lotti CONTRACTS AT MARKET NEXTBAROPEN
    minimo = lowest[4](Low)
    StopLoss = (High - minimo)
    ENDIF
    
    // ---------------------------------------------------------------------
    // Stop e target:
    //trailing stop
    trailingstop = 20
    
    //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
    if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
    endif
    endif
    
    //case LONG order
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
    if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level
    endif
    endif
    
    //exit on trailing stop price levels
    if onmarket and priceexit>0 then
    EXITSHORT AT priceexit STOP
    SELL AT priceexit STOP
    endif
    
    SET STOP LOSS StopLoss
    
    //Graph StopLoss
    
    // ---------------------------------------------------------------------
    #12722 quote
    Nicolas
    Keymaster
    Master

    Ben fatto, è molto meglio! Avete qualche mestiere che durano solo 1 bar?

    #12726 quote
    Conte Caimano
    Participant
    Master

    scusa Nicolas ma non ho capito bene cosa intendi quando mi chiedi: “Avete qualche mestiere che durano solo 1 bar?”

    #12731 quote
    Nicolas
    Keymaster
    Master

    trade che aprono e chiudono sullo stesso candelabro / bar?

    #12747 quote
    Conte Caimano
    Participant
    Master

    se intendi trading system con time frame da 15 min. o 30 min. e simili … sto testandone alcuni.

    Li potrei postare dopo aver finito le prove così magari potresti consigliarmi alcuni miglioramenti.

    #12758 quote
    Nicolas
    Keymaster
    Master

    Ho backtested la strategia e non vedo alcuna di entrata e uscita sullo stesso quotidiano candelabro / bar, ben fatto.
    Naturalmente 176 trade nel corso degli ultimi 18 anni non è tanto, ma le voci sono corrette e ben identificato. Questa strategia è una buona prova di concetto.

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

Swing Points Long Trading System


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

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

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