ERRORI RISULTATI DI TAKE PROFIT E STOP LOSS NEI BACKTEST

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #60106 quote
    maximus78maximus78
    Participant
    Senior

    Buonasera a tutti, stavo sperimentando dei trading system quando mi sono imbattuto in alcuni errori con probacktest.

    Quindi ho fatto questi 2 semplici sistemi (di esempio) dove compro a breakout su una resistenza di 20 periodi con stop loss impostato sul minimo della candela di breakout e take profit alla stessa distanza dall’entry.

    Il primo sistema compra at market cioè all’apertura della candela successiva, con stop loss sul minimo della candela che chiude sopra la resistenza a 20 periodi.

    Il secondo compra con un ordine buy stop sul massimo di 20 periodi con stop loss impostato sul più basso minimo delle ultime 2 candele (quella di breakout e quella precedente).

    Ho inserito anche i graph di entry, stop loss e take profit che sono giusti perchè li ho verificati.

    Il problema sono i risultati dei trades simulati: gli entry sono corretti, mentre per stop loss e take profit a volte coincidono con i graphs, mentre altre volte non coincidono di poco o di molto.

    Non riesco a capire perchè il backtest li calcola così e se sbaglio qualcosa io.

    Se qualcuno può verificarli, grazie e buona domenica.

    Maxx

    defparam cumulateorders=false
    SL=(close[0]-low[0])
    
    if close>=highest[20](high)[1]then
    buy 1 shares at market
    set stop loss SL
    set target profit SL
    endif
    
    graph close[0]-SL coloured(255,0,0) as "stoploss"
    graph close[0]+SL coloured(0,0,255) as "takeprofit"
    graph close coloured(0,0,0) as "entry"
    defparam cumulateorders=false
    
    entry=highest[20](high)
    SL=entry[1]-lowest[2](low)
    
    if entry then
    buy 1 shares at entry stop
    set stop loss SL
    set target profit SL
    endif
    
    graph entry[1]-SL coloured(255,0,0) as "stoploss"
    graph entry[1]+SL coloured(0,0,255) as "takeprofit"
    graph entry[1] coloured(0,0,0) as "entry"
    #60130 quote
    NicolasNicolas
    Keymaster
    Legend

    Perché hai effettuato tutti i tuoi calcoli sulla chiusura corrente e gli ordini sono aperti alla prossima apertura, quindi il prezzo potrebbe differire a volte.
    Per il tuo secondo esempio, c’è un errore, perché la registrazione è fatta alla entry[0] e non alla entry[1], quindi il tuo GRAPH non è corretto .. per quanto ho capito il tuo codice.

    #60233 quote
    maximus78maximus78
    Participant
    Senior

    Ciao Nicolas,  i graph sono entrambi giusti, li ho verificati.

    Nel primo esempio, anche quando il close e l’open dell’apertura coincidono molte volte non calcola correttamente il take profit, mentre nel secondo caso

    se metto in graph: entry–SL, non lo calcola correttamente, mentre è giusto entry[1]-SL (corrisponde al prezzo della linea di donchian su cui il prezzo fa breakout)

    Se guardi lo screenshot, come vedi il graph calcola:

    entry: 1,7386 (corretto, infatti entra a quel prezzo)

    take profit: 1,7432 (sbagliato, esce a 1,7417)

    #60234 quote
    maximus78maximus78
    Participant
    Senior

    ho dimenticato lo screenshot!

    esempio-1.jpg esempio-1.jpg
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

ERRORI RISULTATI DI TAKE PROFIT E STOP LOSS NEI BACKTEST


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
maximus78 @maximus78 Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by maximus78maximus78
8 years, 8 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 01/21/2018
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...