Max Drawdown Monetario e %

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #174877 quote
    Wolf TradesWolf Trades
    Participant
    Average

    Salve a tutti, qualcuno ha a disposizione un codice che calcoli il drawdown monetario ed un codice che calcoli il drawdown in %? così che dopo io possa inserire una condizione nella quale si stoppa il sistema se il drawdown monetario o % calcolato da questo codice supera quello dei backtest? Grazie

    #174878 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Se vuoi trovare qualcosa devi usare la casella di ricerca che si apre quando passi col mouse sopra il tuo avatar, sulla destra in alto della barra Blu.

    Qui trovi il codice https://www.prorealcode.com/topic/richiesta-creazione-indicatore-runup-drawdown/#post-166654.

    #174882 quote
    Wolf TradesWolf Trades
    Participant
    Average

    Ciao Roberto, credo questo codice sia molto più articolato di quello che serve a me. Non ho capito come funziona. Potresti fare un esempio di calcolo di drawdown monetario o %? Cin condizione di quit se il drawdown calcolato supera un certo valore monetario o percentuale?

    #174908 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    E’ articolato perché c’è anche il RunUP, per il solo DD bastano le righje da 1 a 15, ma sono 6 righe effettive.

    La variabile MaxDD contiene il DD. Puoi usarla come vuoi.

    Per avere la percentuale sul capitale basta scrivere:

    DDperc        = MaxDD * 100 / Capital  //% DrawDown
    RUperc        = MaxRU * 100 / Capital  //% RunUP

    Dopodiché usi DDperc (e/o RUperc) come vuoi.

    Per fare una verifica con i risultati del backtest (non identici, come ho scritto nel post) devi fare il backtest ed usare GRAPH per visualizzare i dati.
    Non è possibile confontare questi valori con quelli del backtest, perché quet’ultimi non possono essere conosciuti dal codice.

    #175012 quote
    LittefridoLittefrido
    Participant
    Master

    Ciao io uso questo, hai il massimo drawdown, il massimi N° trade perdenti consecutivi e la data di scadenza del TS

    Semplice semplice ed efficace.

    //************************************************************************
    // Max DRAWDOWN
    // Max Trade Lossconsecutivi
    // Data Scadenza TS
    
    MaxDrowdown =3000*positionsize      // Massimo drawdown 
    MaxTradeLoss =30                    // Massimo trade perdenti consecutivi
    Scadenza = date >= 20211231         // Data scadenza TS
    // Max Drawdown
    
    if longonmarket then
    floatingProfit = (((low - positionprice ) * pointvalue) *countofposition) / pipsize
    endif
     
    if shortonmarket then
    floatingProfit = (((high - positionprice) * pointvalue) * abs(countofposition)) / pipsize
    endif
     
    floatingEquity = StrategyProfit + floatingProfit
    maxequity = max(maxequity, StrategyProfit + floatingProfit)
    ddvalue =  MIN(0,floatingequity - maxequity)
     
    // Max Trade Loss
    
    if StrategyProfit < StrategyProfit[1]  then
    Perdo = Perdo+1
    else
    if StrategyProfit > StrategyProfit[1] then
    Perdo=0
    endif
    endif
    
    if (abs(ddvalue) >= MaxDrowdown) or (perdo >= MaxTradeLoss ) or Scadenza then
    quit
    endif
    
    Wolf Trades thanked this post
Viewing 5 posts - 1 through 5 (of 5 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

Max Drawdown Monetario e %


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Wolf Trades @lupo32 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by LittefridoLittefrido
5 years, 1 month ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 08/07/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...