Advertisement
Maurizio-Ciullo

Bot Over-The-Clouds-2 ETH/USDT.P BYBIT 4H LONG E SHORT

Mar 4th, 2025 (edited)
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.                             // Bot Over-The-Clouds 2 ETH/USDT.P BYBIT 4H LONG E SHORT //
  3.                               // Versione con uscita chiusuare sotto la baseline //
  4.  
  5.                                     // Versione con uscita chiusura sotto la baseline //
  6.                                     // Versione 2 Dell'originale //
  7.                                     // *** Questa versione a differenza dell'originale Over The Clouds, {In ingresso non ha: and conversionLine>baseLine} *** //
  8.  
  9. // Il trading system completo - Over The Clouds 2 ETH/USDT.P BYBIT 4H LONG E SHORT (Trend Following)
  10. // (Sviluppo Dati Exchange = BINANCE + BYBIT) (BINANCE Dal=18/08/2017 Al 21/10/2020) (BYBIT Dal=21/10/2020 Al 20/05/2023)
  11. // (Exchange= BYBIT) (Sottostante ETH-USDT.P) (Timeframe= 4H) (Direzione= LONG E SHORT) (Swing Posizione= SI) (Esclusione Ore=NO) (Esclusione Giorni=NO) (Esclusione Mesi=NO)
  12. // (Take Profit Long/Short Market = NO) (Take Profit Limit Long/Short= NO)
  13. // (Stop Loss Limit Long= NO) (Stop Loss Limit Short= NO) (Stop Loss Market Long/Short= SI) (Trailing Stop Market=SI) (Stop Emergenza= NO)
  14. // (Rischio Operazione 2% Perdita Media Calcolato Sul Ticker: ETHUSDT BINANCE SPOT) (Max Drawdown Permesso 10,03% Calcolato Sul Ticker: ETHUSDT.P BYBIT CHE E' IL PEGGIORE DELLE ENTRIES MODE)
  15. // (ATTENZIONE !!! NON USO PIU' IL RISCHIO OPERAZIONE SOPRA DEL 2% MA LA LASCIO SEMPRE LIVE E QUANDO ARRIVA AL 15% DI MAX DD AGGIUSTATO CON IL PROGRAMMA MONTECARLO PYTHON LA CESTINO
  16. // (In Sample Dal=18/08/17 Al 12/07/22) (Out Of Sample Dal=12/07/22 Al 20/05/23)
  17. // (Money Management = 25% Del Capitale Tradestation)  
  18. // (Money Management = 17% Del Capitale Tradingview) Preso Dal 15% Media Max Drawdown 2°nda Deviazione Standard Simulazione Montecarlo Python
  19. // (Progettatta Il=07/07/23)
  20.  
  21. // Caricamento Dati Bybit Su Tradestation: Exchange Time, Regular Session, 7x7 23:00 23:00, Session Hour.
  22. // Auentare il Max Bars Back A 75 Su Tradestation Altrimenti Non Funziona E Cliccare Su Enable Strategy Altrimenti Non Parte
  23.  
  24.                                                     // ATTENZIONE //
  25. // Quando si mette la strategia live, ricordarsi di impostare 1 solo input "quello che vogliamo utilizzare come normal/ more_aggressive/less_aggressive entries" su true e
  26. // impostare gli altri su false. Commentare anche i BUY COMMAND che non utilizziamo.
  27.  
  28.  
  29. // Auentare il Max Bars Back A 75 Su Tradestation Altrimenti Non Funziona E Cliccare Su Enable Strategy Altrimenti Non Parte
  30.  
  31. // Qui a differenza di tradingview non ho creato lo swith mode per gli ingressi cambiando periodi atr e mopltiplicatore atr, farlo a mano dagli input.
  32.  
  33.  
  34. ////////// Start detecting Ichimoku Cloud //////////                                                                                                  
  35. Inputs: Standard(26), Turning(9), Delayed(52), Uscita(0), mystop(0), myprofit(0);
  36. Variables:StdLine(0), TurnLine(0), Span1(0), Span2(0);
  37. StdLine = (Highest(High, Standard) + Lowest(Low, Standard)) / 2; // "BASE LINE"
  38. TurnLine = (Highest(High, Turning) + Lowest(Low, Turning)) / 2;  // "CONVERSION LINE"
  39. Span1 = (StdLine + TurnLine) / 2;                                // "SPAN A No 25 Offset"
  40. Span2 = (Highest(High, Delayed) + Lowest(Low, Delayed)) / 2;     // "SPAN B No 25 Offset"
  41.  
  42. // Span1 e Span2 non hanno l'offset di 25 candele fa, per ulteriori verifiche vedi Study Ichimoku oppure fare il print qui su Strategy.
  43.  
  44. // Print Debug Ichimoku
  45. {Once Clearprintlog;
  46. print(Getstrategyname, ", ", Symbol, ", ", Formatdate("dd/MM/yy", ElDateToDateTime( Date )), ", ", BarDateTime.Format( "%H%M.%S" ), ", ", Close, ", ", StdLine, ", ", TurnLine, ", ", Span1, ", ",Span2 , ", ",);
  47. print(StdLine);
  48. print(TurnLine);
  49. print(Span1);
  50. print(Span2);}
  51. ////////// End detecting Ichimoku Cloud //////////
  52.                                                
  53.                                                
  54. ////////// Start Detection ATR (Average True Range Long E Short) //////////
  55. // Valori migliori e pi  stabili boom bar long I migliori sono scritti per prima: //7-.1.2//12-1.2 //11-1.2
  56. // La 7-1.2entra pi  facilmente ed entra pi  in basso solo che se il periodo non   buono prende pi  stop
  57. // La 11-1.2 entra meno, operazione leggermente minore ma se il periodo   peggiore prende meno stop
  58. // Preferisco la 7-1.2 Pi  aggressiva e la 11-1.2 pi  stabile
  59. input:
  60.     input_atr_period_long(7),
  61.     input_atr_period_short(33),
  62.     input_atr_Mult_long(1.2),
  63.     input_atr_Mult_short(1.2),
  64.     input_ema_long(84),
  65.     input_ema_short(83),
  66.     InitialCapital(100000),
  67.     percent_risk(100),
  68.     only_long(false),
  69.     only_short(false);
  70.    
  71.    
  72.    
  73. Vars:
  74.      valore_atr_long(0),
  75.      valore_atr_short(0),
  76.      boom_bar_long(false),
  77.      boom_bar_short(false),
  78.      ema_long(0),
  79.      ema_short(0),
  80.      entrata_long(false),
  81.      entrata_short(false),
  82.      uscita_long(false),
  83.      uscita_short(false),
  84.      nr_share(0),
  85.      risk(0);
  86.      
  87.  
  88. ////////// Start Detecting ATR (Average True Range Long E Short) //////////
  89. valore_atr_long      =   AvgTrueRange(input_atr_period_long);
  90. valore_atr_short     =   AvgTrueRange(input_atr_period_short);
  91. ////////// End Detecting ATR (Average True Range Long E Short) //////////
  92.  
  93.  
  94. ////////// Start Detecting Boom Bar Long //////////
  95. boom_bar_long = Absvalue(open - close) > valore_atr_long * input_atr_Mult_long;
  96. If boom_bar_long Then
  97. // Plotshape Boom_Bar_Long
  98. Begin
  99.     Value1 = Text_new(D, T, L, "*");
  100.     Text_setcolor(Value1, Yellow);
  101.     Text_setstyle(Value1, 2, 0);
  102. End;
  103. ////////// End Detecting Boom Bar Long //////////
  104.  
  105.  
  106. ////////// Start Detecting Boom Bar Short //////////
  107. boom_bar_short = Absvalue(open - close) > valore_atr_short * input_atr_Mult_short;
  108. If boom_bar_short Then
  109. // Plotshape Boom_Bar_Short
  110. Begin
  111.     Value2 = Text_new(D, T, L, "*");
  112.     Text_setcolor(Value1, Yellow);
  113.     Text_setstyle(Value1, 2, 0);
  114. End;
  115. ////////// End Detecting Boom Bar Short //////////
  116.  
  117.  
  118. ////////// Start Detecting Media EMA Long //////////
  119. ema_long = XAverage(close, input_ema_long);
  120. ////////// End Detecting Media EMA Long //////////
  121.  
  122.  
  123. ////////// Start Detecting Media EMA Short //////////
  124. ema_short = XAverage(close, input_ema_short);
  125. ////////// End Detecting Media EMA Short //////////
  126.  
  127.  
  128.  
  129.  ////////// Start Money Managment //////////
  130. risk = percent_risk/100;
  131. nr_share = floor((InitialCapital + NetProfit) * risk) / close;
  132.  ////////// End Money Managment //////////
  133.  
  134.  
  135. ////////// Start Condizioni Entrata E Uscita Long E Short //////////
  136. entrata_long = close > StdLine {and TurnLine > StdLine} and close > Span2  and close > ema_long  and boom_bar_long and not only_short;
  137. entrata_short = close < StdLine {and TurnLine  < StdLine} and close < Span2  and close < ema_short and boom_bar_short and not only_long;
  138.  
  139. uscita_long = close < StdLine;
  140. uscita_short = close > StdLine;
  141. ////////// End Condizioni Entrata E Uscita Long E Short //////////
  142.  
  143.  
  144. ////////// Start Entrata E Uscita Long //////////
  145. if marketposition = 0 and entrata_long Then
  146.    Begin;
  147.       Buy("Long") nr_share contracts Next Bar at market;  
  148.    End;
  149.    
  150. if marketposition = 1 and uscita_long Then
  151.     Begin;
  152.         Sell("Exit Market Long") from entry("Long") Next Bar at market;    
  153.     End;
  154. ////////// End Entrata E Uscita Long //////////
  155.  
  156.  
  157.  
  158. ////////// Start Entrata E Uscita Short //////////
  159. if marketposition = 0 and entrata_short Then
  160.    Begin;
  161.       Sellshort("Short") nr_share contracts Next Bar at market;  
  162.    End;
  163.    
  164. if marketposition = -1 and uscita_short Then
  165.     Begin;
  166.         Buytocover("Exit Market Short") from entry("Short") Next Bar at market;    
  167.     End;
  168. ////////// End Entrata E Uscita Short //////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement