Maurizio-Ciullo

Study Swing-Trend-Trailing-Riot-P1 ETHUSDT.P BYBIT 4H LONG E SHORT

Sep 13th, 2025 (edited)
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                                                                 // Study Swing Trend Trailing Riot Period 1 10-09-2025 ETHUSDT.P BYBIT 4H LONG E SHORT //
  2.                                             // Datafeed Cambiato / Periodi Backtest Cambiati / Inputs Cambiati / Stop Loss Limit Tolto //
  3.                                             // Condizione Long Tolta: and ((close[1] < (media_ema_1 + apertura_minima)) or (low[1] < (media_ema_1 + apertura_minima))) and close > open
  4.                                             // Condizione Short Tolta: and ((close[1] > (media_ema_1 - apertura_minima)) or (high[1] > (media_ema_1 - apertura_minima))) and close < open
  5.  
  6.                     // *** Attezione aclune operazioni potrebbero essere diverse da tradestation perchè tradingview
  7.                     // se esce in trailng stop e allo stesso tempo c'è la condizione di ingresso sulla stessa candela
  8.                     // non effettua uscite ed entrate nella stessa candela in questo caso specifico mentre tradestation si *** !!!
  9.  
  10. // RIOTTIMIZZAZIONE PERIODICA 1 DELLA ORIGINALE SWING TREND TRAILING   
  11. // IL DATAFEED COMPLETO = (18/08/2017 10/08/2025)                                              
  12. // NUOVI DATI DI SVILUPPO DATAFEED ETH/USDT BINANCE + ETH/USDT.P BYBIT 4H  STORICO INIZIALE BINANCE PER POI PROSEGUIRE CON BYBIT                                                                                                                       
  13. // (Sviluppo Dati Exchange = BINANCE + BYBIT) (BINANCE Dal=18/08/2017 Al 10/10/2020) (BYBIT Dal=21/10/2020 Al 10/08/2025)
  14. // SU TRADINGVIEW ORARIO BORSA GMT
  15. // BARSBACK TRADESTATION: 500
  16.  
  17. // NUOVE DATE IN SAMPLE E OUT OF SAMPLE
  18. //Il data feed completo: 18/08/2017 10/08/2025
  19. //In Sample: Inizio 18/08/2017 Fine 12/06/2023
  20. //Out Of Sample: Inizio 13/06/2023 Fine 10/08/2025
  21.  
  22.  
  23. // Il trading system completo - Bot Swing Trend Trailing Riot Period 1 10-09-2025 ETHUSDT.P BYBIT 4H LONG E SHORT
  24. // (Exchange= BYBIT) (Sottostante ETH-USDT.P) (Timeframe= 4H) (Direzione= LONG E SHORT) (Swing Posizione= SI) (Esclusione Ore=NO) (Esclusione Giorni=NO) (Esclusione Mesi=NO)
  25. // (Take Profit Long/Short Market = Trailing) (Take Profit Limit Long/Short= NO)
  26. // (Stop Loss Limit Long/Short= NO) (Stop Loss Market=SI) (Trailing Stop=SI) (Stop Emergenza: NO)
  27. // (Max DD Concesso = 15% Media Max Drawdown 2°nda Deviazione Standard Simulazione Montecalo Python
  28. // (Money Management = 25% Del Capitale Tradestation)  
  29. // (Money Management = 12,00% Del Capitale Tradingview) Preso Dal 15% Media Max Drawdown 2°nda Deviazione Standard Simulazione Montecarlo Python
  30.  
  31. // (In Sample Dal=17/08/2017 12/06/2023) (Out Of Sample Dal13/06/2023 Al 10-08-2025)
  32. // (Progettatta Il=10/09/25)
  33.  
  34. Inputs:
  35.  
  36. input_stop_loss_percent(10),
  37. lunghezza_ema(130), //130 va anche bene ma è meno adatta a questo periodo attuale
  38. lunghezza_ema_prova(90),  // Questa è quella originale prima dell'ottimizzazione Riot P1 // cancellare  
  39. perc_apertura_minima(2),
  40. perc_apertura_massima(3.7),
  41. perc_chiusura_minima(0),
  42. input_trailing_stop_trigger_long(10),
  43. input_trailing_stop_close_long(6),
  44. input_trailing_stop_trigger_short(10),
  45. input_trailing_stop_close_short(6);
  46.  
  47. vars:
  48.  
  49. media_ema(0),
  50. media_ema_prova(0),   // cancellare
  51. apertura_minima_long(0),
  52. apertura_massima_long(0),
  53. apertura_minima_short(0),
  54. apertura_massima_short(0),
  55. chiusura_minima(0),
  56. stop_loss(0),
  57. trailing_stop_trigger_long(0),
  58. trailing_stop_close_long(0),
  59. trailing_stop_trigger_short(0),
  60. trailing_stop_close_short(0);
  61.  
  62. // Calcololo degli indicatori
  63.  
  64. media_ema = XAverage(Close, lunghezza_ema);
  65. media_ema_prova = XAverage(Close, lunghezza_ema_prova); // cancellare
  66. apertura_minima_long   = media_ema +(media_ema / 100) * perc_apertura_minima;
  67. apertura_massima_long  = media_ema +(media_ema / 100) * perc_apertura_massima;
  68. apertura_minima_short   = media_ema -(media_ema / 100) * perc_apertura_minima;
  69. apertura_massima_short  = media_ema -(media_ema / 100) * perc_apertura_massima;
  70. chiusura_minima   = media_ema -(media_ema / 100) * perc_chiusura_minima;
  71. stop_loss= close - ((close /100) * input_stop_loss_percent);
  72. trailing_stop_trigger_long = close + (close * input_trailing_stop_trigger_long)/100;
  73. trailing_stop_close_long = close + (close * input_trailing_stop_close_long)/100;
  74. trailing_stop_trigger_short = close - (close * input_trailing_stop_trigger_short)/100;
  75. trailing_stop_close_short = close - (close * input_trailing_stop_close_short)/100;
  76.  
  77. // Plot
  78.  
  79. //plot1(stop_loss, "stop_loss_long");
  80. plot2(apertura_minima_long, "apertura_minima_long", green);
  81. plot3(apertura_massima_long, "apertura_massima_long", green);
  82. //plot4(chiusura_minima, "chiusura_minima");
  83. plot5(trailing_stop_trigger_long, "trailing_stop_trigger_long", yellow);
  84. plot6(trailing_stop_close_long, "trailing_stop_close_long", Cyan);
  85. plot7(trailing_stop_trigger_short, "trailing_stop_trigger_short", yellow);
  86. plot8(trailing_stop_close_short, "trailing_stop_close_short",Cyan );
  87. plot9(media_ema, "media_ema", yellow);
  88. Plot10(apertura_minima_short, "apertura_minima_short", red);
  89. plot11(apertura_massima_short, "apertura_minima_short", red);
  90. //plot12(media_ema_prova, "media_ema_prova"); // cancellare
Advertisement
Add Comment
Please, Sign In to add comment