Advertisement
Maurizio-Ciullo

Indicatore Test Equity Control Drawdown

Dec 20th, 2023
919
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.                                                                         // Indicatore Test Equity Control Drawdown //
  3.                                                         // Su questo indicatore bisogna caricare i dati Equity Compresi di Capitale Iniziale Su Data 1 //
  4.  
  5. // Mettere input % di Drawdown !!!!
  6.  
  7.  Vars:
  8.     FirstBar(0), // Variabile per salvare l'indice della prima barra // da cancelare
  9.     balance(0),
  10.     highestRelativeEquity(0),
  11.     relativeDrawdownMonetary(0),
  12.     lowestRelativeEquity(0),
  13.     relativeDrawdownPercent(0);
  14.  
  15.                                                                                                                                                                                                                                        
  16.               //////////////////////////////////// Inizio a utilizzare una percentuale del massimo drawdown relativo per stoppare l'operatività  BUONO FUNZIONA !!! ////////////////////////////////////
  17.              
  18.  // Balance
  19. balance = (close);
  20.  
  21. // Highest Relative Equity
  22. highestRelativeEquity = MaxList(balance, highestRelativeEquity);
  23.  
  24.  
  25. // LowestRelativeEquity E RelativeDrawdownMonetary E RelativeDrawdownPercent
  26. if balance <= highestRelativeEquity then
  27.     lowestRelativeEquity = minlist(highestRelativeEquity, balance);
  28.     relativeDrawdownMonetary = (highestRelativeEquity - balance);
  29.     relativeDrawdownPercent = (relativeDrawdownMonetary / highestRelativeEquity) * 100;
  30.  
  31.  
  32. // Clear the print log when the strategy first applyed or refreshed
  33. Once Clearprintlog;
  34. print(Formatdate("dd/MM/yy", ElDateToDateTime( Date )), ", ", BarDateTime.Format( "%H%M.%S" ), ", ", " HighestRelativeEQ= " ,highestRelativeEquity, ", ", " LowestRelativeEQ= " ,lowestRelativeEquity, ", ", " RelativeDrawdownMonetary= ", relativeDrawdownMonetary, ", ", " RelativeDrawdownPercent= ", relativeDrawdownPercent , " %", ", ", " BarNum= ", BarNumber);
  35.  
  36.             ///////////////////////////////////// Fine Provo a utilizzare una percentuale del massimo drawdown relativo per stoppare l'operatività  BUONO FUNZIONA !!! ////////////////////////////////////
  37.  
  38.  
  39.             //////////////////////////////////// Inizio Provo Start Stop Equity Trading Con una percentuale del massimo drawdown relativo Solo Per Prova ////////////////////////////////////
  40.  
  41. // Condizioni Entrata/Uscita
  42. If relativeDrawdownPercent >= 0 and relativeDrawdownPercent <= 7 Then
  43.     buy("Start") 1 Contract next bar at Market;
  44.  
  45. If relativeDrawdownPercent > 7 Then
  46.     Sell("Stop") 1 Contract next bar at Market;
  47.  
  48.                  //////////////////////////////////// Fine Provo Start Stop Equity Trading Con una percentuale del massimo drawdown relativo Solo Per Prova ////////////////////////////////////
  49.  
  50.  
  51.                 //////////////////////////////////// Inizio Equity Filtered "Non ha il pezzo di equity escluso dal equity control //////////////////////////////////// 
  52. // Sul file .csv carico: Date/Time/Open/High/Low /Equity/Volume Per una questione di caricamento su tradestatio... . Apro il grafico, clicco su una candela 2 volte e nelle impostazioni style clicco su line on close.        
  53.  
  54. {Vars:
  55.     mp(0),
  56.     formattedDate(""),
  57.     formattedTime(""),
  58.     dateTimeString("");
  59.  
  60. mp = marketposition;
  61.  
  62. If relativeDrawdownPercent >= 0 and relativeDrawdownPercent <= 7 Then Begin
  63.     // Formatta la data nel formato "MM-dd-yyyy"
  64.     formattedDate = FormatDate("dd-MM-yyyy", ElDateToDateTime(Date));
  65.    
  66.     // Formatta l'ora nel formato "00:00:00"
  67.     formattedTime = BarDateTime.Format("%H:%M:%S");
  68.    
  69.     // Combina data e ora nel formato richiesto
  70.     dateTimeString = formattedDate + "," + formattedTime;
  71.    
  72.     // Stampa nel file CSV
  73.     Print(File("C:\Users\Utente\Desktop\Equity Control\Tradestation\Swing Trend Trailing\Exports\Export_Equity_Filtered.csv"), dateTimeString, ",", open, ",", high, ",", low, ",", NumToStr(Close, 2) , Volume, ",");
  74. end;}
  75.  
  76. //////////////////////////////////// Fine Equity Filtered "Non ha il pezzo di equity escluso dal equity control ////////////////////////////////////
Advertisement
Comments
  • earnmoney9022
    155 days
    # text 0.12 KB | 0 0
    1. download all types of premium tradingview indicators codes available on telegram - https://t.me/tradingview_premium_indicator
Add Comment
Please, Sign In to add comment
Advertisement