Maurizio-Ciullo

Study Swing-Trend-Trailing ETH/PERP FTX 4H LONG E SHORT

May 7th, 2022 (edited)
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Il trading system completo - Study Swing-Trend-Trailing (Strategia Trend Following Con Swing Di Posizione) - parte 2
  2. // (Exchange= FTX) (Sottostante ETH-PERP) (Timeframe= 4H) (Direzione= LONG E SHORT) (Swing Posizione= SI) (Esclusione Ore=NO) (Esclusione Giorni=NO') (Esclusione Mesi=NO)
  3. // (Take Profit Long/Short Market = Trailing) (Take Profit Limit Long/Short= NO) (Stop Loss Limit Long/Short= -10%) (Stop Loss Market Long/Short= SI) (Trailing Stop=SI) (Stop Emergenza= NO)
  4. // (Rischio Operazione 2% Perdita Media)
  5. // (In Sample Dal=17/08/2017 Al 17/10/2020) (Out Of Sample Dal=18/10/2020 Al 15/03/2021)
  6.  
  7. Inputs:
  8.  
  9. input_stop_loss_percent(10),
  10. lunghezza_ema(90),
  11. perc_apertura_minima(2),
  12. perc_apertura_massima(4),
  13. perc_chiusura_minima(0),
  14. input_trailing_stop_trigger_long(12),
  15. input_trailing_stop_close_long(6),
  16. input_trailing_stop_trigger_short(12),
  17. input_trailing_stop_close_short(6);
  18.  
  19.  
  20.  
  21. vars:
  22. media_ema(0),
  23. apertura_minima(0),
  24. apertura_massima(0),
  25. chiusura_minima(0),
  26. stop_loss(0),
  27. trailing_stop_trigger_long(0),
  28. trailing_stop_close_long(0),
  29. trailing_stop_trigger_short(0),
  30. trailing_stop_close_short(0);
  31.  
  32. // Calcololo degli indicatori
  33.      
  34.  
  35.  
  36. media_ema = XAverage(Close, lunghezza_ema);
  37. apertura_minima   = media_ema +(media_ema / 100) * perc_apertura_minima;
  38. apertura_massima  = media_ema +(media_ema / 100) * perc_apertura_massima;
  39. chiusura_minima   = media_ema -(media_ema / 100) * perc_chiusura_minima;
  40. stop_loss= close - ((close /100) * input_stop_loss_percent);
  41. trailing_stop_trigger_long = close + (close * input_trailing_stop_trigger_long)/100;
  42. trailing_stop_close_long = close + (close * input_trailing_stop_close_long)/100;
  43. trailing_stop_trigger_short = close - (close * input_trailing_stop_trigger_short)/100;
  44. trailing_stop_close_short = close - (close * input_trailing_stop_close_short)/100;
  45.  
  46. // Plot
  47.  
  48. plot1(stop_loss, "stop_loss_long");
  49. plot2(apertura_minima, "apertura_minima");
  50. plot3(apertura_massima, "apertura_massima");
  51. //plot4(chiusura_minima, "chiusura_minima");
  52. plot5(trailing_stop_trigger_long, "trailing_stop_trigger_long");
  53. plot6(trailing_stop_close_long, "trailing_stop_close_long");
  54. plot7(trailing_stop_trigger_short, "trailing_stop_trigger_short");
  55. plot8(trailing_stop_close_short, "trailing_stop_close_short");
  56. plot9(media_ema, "media_ema");
  57.  
  58.  
  59.  
  60.  
Add Comment
Please, Sign In to add comment