Maurizio-Ciullo

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

Mar 4th, 2025 (edited)
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © Maurizio-Ciullo
  3.  
  4.                                     // Versione con uscita chiusura sotto la baseline //
  5.                                     // Versione 2 Dell'originale //
  6.                                     // *** Questa versione a differenza dell'originale Over The Clouds, {In ingresso non ha: and conversionLine>baseLine} *** //
  7.  
  8. // Il trading system completo - Over The Clouds 2 ETH/USDT.P BYBIT 4H LONG E SHORT (Trend Following)
  9. // (Sviluppo Dati Exchange = BINANCE + BYBIT) (BINANCE Dal=18/08/2017 Al 21/10/2020) (BYBIT Dal=21/10/2020 Al 20/05/2023)
  10. // (Exchange= BYBIT) (Sottostante ETH-USDT.P) (Timeframe= 4H) (Direzione= LONG E SHORT) (Swing Posizione= SI) (Esclusione Ore=NO) (Esclusione Giorni=NO) (Esclusione Mesi=NO)
  11. // (Take Profit Long/Short Market = NO) (Take Profit Limit Long/Short= NO)
  12. // (Stop Loss Limit Long= NO) (Stop Loss Limit Short= NO) (Stop Loss Market Long/Short= SI) (Trailing Stop Market=SI) (Stop Emergenza= NO)
  13. // (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)
  14. // (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
  15. // (In Sample Dal=18/08/17 Al 12/07/22) (Out Of Sample Dal=12/07/22 Al 20/05/23)
  16. // (Money Management = 25% Del Capitale Tradestation)  
  17. // (Money Management = 17% Del Capitale Tradingview) Preso Dal 15% Media Max Drawdown 2°nda Deviazione Standard Simulazione Montecarlo Python
  18. // (Progettatta Il=07/07/23)
  19.  
  20. // Caricamento Dati Bybit Su Tradestation: Exchange Time, Regular Session, 7x7 23:00 23:00, Session Hour.
  21. // Auentare il Max Bars Back A 75 Su Tradestation Altrimenti Non Funziona E Cliccare Su Enable Strategy Altrimenti Non Parte
  22.  
  23.                                                     // ATTENZIONE //
  24. // 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
  25. // impostare gli altri su false. Commentare anche i BUY COMMAND che non utilizziamo.
  26.  
  27. //@version=5
  28. strategy(title='Bot Over-The-Clouds-2 ETH/USDT.P BYBIT 4H LONG E SHORT', overlay=true,
  29.          //max_bars_back=5000, // Serve Per Caricare Più Storico Per Il Trailing Stop
  30.          pyramiding=0,
  31.          initial_capital=500,
  32.          commission_type=strategy.commission.percent,
  33.          commission_value=0.1,
  34.          slippage=3,
  35.          default_qty_type=strategy.percent_of_equity,
  36.          precision=2,
  37.          default_qty_value=17)
  38.  
  39.  
  40. // Inputs
  41. onlyLong = input.bool(title='Solo long', defval=false, inline='1', group='Direction')
  42. onlyShort = input.bool(title='Solo short', defval=false, inline='1', group='Direction')
  43. in_normal = input.bool(title="normal entry mode", defval=true, tooltip = "Entry Conditions Choice", inline='1', group='Aggresivity Entries Noraml')
  44. in_more_aggressive = input.bool(title="more aggressive entry mode", defval=false, tooltip = "Entry Conditions Choice", inline='1', group='Aggresivity Entries Aggresive')
  45. in_less_aggressive = input.bool(title="less aggressive entry mode", defval=false, tooltip = "Entry Conditions Choicee", inline='1', group='Aggresivity Entries Less Aggressive')
  46. in_ema_long = input.int(title='in_ema_long', defval=84, minval=0, maxval=300, step=1, inline='1', group='Ema Lenght')
  47. in_ema_short = input.int(title='in_ema_short', defval=83, minval=0, maxval=300, step=1, inline='1', group='Ema Lenght')
  48.  
  49.  
  50. // Calcolo del range del backtest
  51. startDate = input.int(title='Start Date', defval=17, minval=1, maxval=31, group='Time Window')
  52. startMonth = input.int(title='Start Month', defval=08, minval=1, maxval=12, group='Time Window')
  53. startYear = input.int(title='Start Year', defval=2000, minval=1800, maxval=2100, group='Time Window')
  54.  
  55. endDate = input.int(title='End Date', defval=01, minval=1, maxval=31, group='Time Window')
  56. endMonth = input.int(title='End Month', defval=01, minval=1, maxval=12, group='Time Window')
  57. endYear = input.int(title='End Year', defval=2121, minval=1800, maxval=2150, group='Time Window')
  58.  
  59.  
  60. inDateRange = time >= timestamp(syminfo.timezone, startYear, startMonth, startDate, 0, 0) and time < timestamp(syminfo.timezone, endYear, endMonth, endDate, 0, 0)
  61.  
  62.  
  63. // Start Hour Range Trading Non Attivo /////////////////////
  64. //hourTrading = input(title='sessione valida di trading', defval='0600-2300:23456')
  65. //hourRangeTrading = time(timeframe.period, hourTrading)
  66.  
  67.  
  68. // Start Detecting Ichimoku Cloud //
  69. conversionPeriods = input.int(9, minval=1, title="Conversion Line Periods", group='Ichomoku'),
  70. basePeriods = input.int(26, minval=1, title="Base Line Periods", group='Ichomoku')
  71. laggingSpan2Periods = input.int(52, minval=1, title="Lagging Span 2 Periods", group='Ichomoku'),
  72. displacement = input.int(26, minval=1, title="Displacement", group='Ichomoku')
  73.  
  74. donchian(len) => math.avg(ta.lowest(len), ta.highest(len))
  75.  
  76. conversionLine = donchian(conversionPeriods)
  77. baseLine = donchian(basePeriods)
  78. spanA = math.avg(conversionLine, baseLine)
  79. spanB = donchian(laggingSpan2Periods)
  80. StdLine = (ta.highest(high, 52) + ta.lowest(low, 52)) / 2
  81. plot(conversionLine, title="Conversion Line", color=#0496ff)
  82. plot(baseLine, color=#991515, title="Base Line")
  83. plot(close, title="Lagging Span", offset = -displacement + 1, color=#459915)
  84.  
  85. p1 = plot(spanA, offset = displacement - 1, color=color.green,
  86.  title="Plot Span A")
  87. p2 = plot(spanB, offset = displacement - 1, color=color.red,
  88.  title="Plot Span B")
  89. fill(p1, p2, color = spanA > spanB ? color.green : color.red)
  90. // plot(spanA[25], title="Span A", color=color.orange)
  91. // plot(spanB[25],  title="Span B",color=color.yellow)
  92. // plot(spanA, title="Span A No 25 Offset", color=color.rgb(218, 16, 253))
  93. // plot(spanB, title="Span B No 25 Offset", color=color.rgb(218, 16, 253))
  94. // End Detecting Ichimoku Cloud //
  95.  
  96.  
  97. // Start Detecting ATR Long Normal //
  98. in_length_atr_long_normal = input.int(title="Atr Length_long_normal", defval=11, minval=0, group='Atr Long Normal')
  99. in_smoothing_atr_long_normal = input.string(title="Smoothing_atr_long_normal", defval="SMA", options=["RMA", "SMA", "EMA", "WMA"], group='Atr Long Normal')
  100. ma_function_long(source, in_length_atr_long_normal) =>
  101.     switch in_smoothing_atr_long_normal
  102.         "RMA" => ta.rma(source, in_length_atr_long_normal)
  103.         "SMA" => ta.sma(source, in_length_atr_long_normal)
  104.         "EMA" => ta.ema(source, in_length_atr_long_normal)
  105.         => ta.wma(source, in_length_atr_long_normal)
  106. plot(ma_function_long(ta.tr(true), in_length_atr_long_normal), title = "ATR_long_normal", color=color.new(#ca5555, 0))
  107. // End Detecting ATR Long Normal //
  108.  
  109. // Start Detecting ATR Long More Aggressive //
  110. in_length_atr_long_more_aggressive = input.int(title="Atr Length_long_more_aggressive", defval=7, minval=0, group='Atr Long More Aggresive')
  111. in_smoothing_atr_long_more_aggressive = input.string(title="Smoothing_atr_long_more_aggressive", defval="SMA", options=["RMA", "SMA", "EMA", "WMA"], group='Atr Long More Aggresive')
  112. ma_function_long_more_aggressive(source, in_length_atr_long_more_aggressive) =>
  113.     switch in_smoothing_atr_long_more_aggressive
  114.         "RMA" => ta.rma(source, in_length_atr_long_more_aggressive)
  115.         "SMA" => ta.sma(source, in_length_atr_long_more_aggressive)
  116.         "EMA" => ta.ema(source, in_length_atr_long_more_aggressive)
  117.         => ta.wma(source, in_length_atr_long_more_aggressive)
  118. plot(ma_function_long_more_aggressive(ta.tr(true), in_length_atr_long_more_aggressive), title = "ATR_long_more_aggressive", color=color.new(#ff4646, 0))
  119. // End Detecting ATR Long More Aggressive //
  120.  
  121. // Start Detecting ATR Long Less Aggressive //
  122. in_length_atr_long_less_aggressive = input.int(title="Atr Length_long_less_aggressive", defval=12, minval=0, group='Atr Long Less Aggresive')
  123. in_smoothing_atr_long_less_aggressive = input.string(title="Smoothing_atr_long_less_aggressive", defval="SMA", options=["RMA", "SMA", "EMA", "WMA"], group='Atr Long Less Aggresive')
  124. ma_function_long_less_aggressive(source, in_length_atr_long_less_aggressive) =>
  125.     switch in_smoothing_atr_long_less_aggressive
  126.         "RMA" => ta.rma(source, in_length_atr_long_less_aggressive)
  127.         "SMA" => ta.sma(source, in_length_atr_long_less_aggressive)
  128.         "EMA" => ta.ema(source, in_length_atr_long_less_aggressive)
  129.         => ta.wma(source, in_length_atr_long_less_aggressive)
  130. plot(ma_function_long_less_aggressive(ta.tr(true), in_length_atr_long_less_aggressive), title = "ATR_long_less__aggressive", color=color.new(#ff4646, 0))
  131. // End Detecting ATR Long Less Aggressive //
  132.  
  133.  
  134. // Start Detecting ATR Short //
  135. in_length_atr_short = input.int(title="Atr Length_short", defval=11, minval=0, group='Atr Short')
  136. in_smoothing_atr_short = input.string(title="Smoothing_atr_short", defval="SMA", options=["RMA", "SMA", "EMA", "WMA"], group='Atr Short')
  137. ma_function_short(source, in_length_atr_short) =>
  138.     switch in_smoothing_atr_short
  139.         "RMA" => ta.rma(source, in_length_atr_short)
  140.         "SMA" => ta.sma(source, in_length_atr_short)
  141.         "EMA" => ta.ema(source, in_length_atr_short)
  142.         => ta.wma(source, in_length_atr_short)
  143. plot(ma_function_short(ta.tr(true), in_length_atr_short), title = "ATR_short", color=color.new(#B71C1C, 0))
  144. // End Detecting ATR Short //
  145.  
  146.  
  147. // Start Detecting Boom Bar Long (Normal-Aggressive-Less_aggressive//
  148. atr_long_normal = ma_function_long(ta.tr(true), in_length_atr_long_normal)
  149. atr_long_more_aggressive = ma_function_long_more_aggressive(ta.tr(true), in_length_atr_long_more_aggressive)
  150. atr_long_less_aggressive = ma_function_long_less_aggressive(ta.tr(true), in_length_atr_long_less_aggressive)
  151. in_atr_Mult_long_normal = input.float(title='atr_Mult_long_normal', minval=0, maxval=5, defval=1.2, step=0.1, group='Atr Long Normal')
  152. in_atr_Mult_long_more_aggressive = input.float(title='atr_Mult_long_more_aggressive', minval=0, maxval=5, defval=1.2, step=0.1, group='Atr Long More Aggresive')
  153. in_atr_Mult_long_less_aggressive = input.float(title='atr_Mult_long_less_aggressive', minval=0, maxval=5, defval=1.2, step=0.1, group='Atr Long Less Aggresive')
  154. boom_bar_long_normal = math.abs(open - close) > atr_long_normal * in_atr_Mult_long_normal
  155. boom_bar_long_more_aggressive = math.abs(open - close) > atr_long_more_aggressive * in_atr_Mult_long_more_aggressive
  156. boom_bar_long_less_aggressive = math.abs(open - close) > atr_long_less_aggressive * in_atr_Mult_long_less_aggressive
  157. // End Detecting Boom Bar Long //
  158.  
  159.  
  160. // Start Detecting Boom Bar Short //
  161. atr_short = ma_function_short(ta.tr(true), in_length_atr_short)
  162. in_atr_Mult_short = input.float(title='atr_Mult_short', minval=0, maxval=5, defval=1.2, step=0.1, group='Atr Short')
  163. boom_bar_short = math.abs(open - close) > atr_short * in_atr_Mult_short
  164. // End Detecting Boom Bar Short //
  165.  
  166. barcolor(boom_bar_long_normal and in_normal and not in_more_aggressive and not in_less_aggressive ? color.lime : boom_bar_short and in_normal and not in_more_aggressive and not in_less_aggressive ? color.lime : na)
  167. barcolor(boom_bar_long_more_aggressive and in_more_aggressive and not in_normal and not in_less_aggressive ? color.lime : boom_bar_short and in_more_aggressive and not in_normal and not in_less_aggressive ? color.lime : na)
  168. barcolor(boom_bar_long_less_aggressive and in_less_aggressive and not in_normal and not in_more_aggressive ? color.lime : boom_bar_short and in_less_aggressive and not in_normal and not in_more_aggressive ? color.lime : na)
  169.  
  170.  
  171. // Start Detecting Ema Long And Short //
  172. ema_long = ta.ema(close, in_ema_long)
  173. plot(ema_long, title="ema_long", color=color.green, linewidth = 2)
  174.  
  175. ema_short = ta.ema(close, in_ema_short)
  176. plot(ema_short, title="ema_short", color=color.red, linewidth = 2)
  177. // End Detecting Ema Long And Short //
  178.  
  179.  
  180. plot(strategy.position_size != 0 ? strategy.opentrades.entry_price(0) : na , color=strategy.position_size > 0 ? color.blue : strategy.position_size < 0 ? color.red : na, style=plot.style_linebr, title="entry_price") // stampa l'entry price in rosso se short in blu se long
  181. //plot(strategy.position_size > 0 ?  take_profit_long_price : strategy.position_size < 0 ? take_profit_short_price: na, color=color.green, style=plot.style_cross, linewidth=2, title="tk_limit")
  182. //plot(strategy.position_size > 0 ?  stop_loss_long_price : strategy.position_size < 0 ? stop_loss_short_price: na, color=color.red, style=plot.style_cross, linewidth=2, title="sl_limit")
  183.  
  184. bgcolor(strategy.position_size > 0 ? color.green : strategy.position_size < 0 ? color.red : na, transp=90)// sfondo verde quando siamo long, sfondo rosso quando siamo short, no sfondo quando non siamo in posizione //color.new(color.red, 99): na)
  185.  
  186.  
  187. // Plot No Trading Allowed giorni da 1 a 7 1 è domenica. Mesi da 1 a 12 1 è Gennaio. //
  188.  
  189. // giorni_esclusi = dayofweek(time)
  190. // plotshape(giorni_esclusi[1] == 2 ? giorni_esclusi : na, color=color.green, title="giorni_esclusi")
  191. // mesi_esclusi = month(time)
  192. // plotshape(mesi_esclusi[1] == 9 ? mesi_esclusi : na, color=color.yellow, title="mesi_esclusi")
  193.  
  194.  
  195. // Stringhe esecuzione ordini 3rze parti TV-HUB.ORG
  196. buy_command = 'BUY COMMAND'
  197. sell_command = 'SELL COMMAND'
  198. close_command = 'CLOSE COMMAND'
  199. //cancel_command = 'CANCEL COMMAND'
  200.  
  201.  
  202. // // ============== Email Protection ===============
  203.  
  204. // L'email protection invia ordini senza webhook oppure se gli webhook sono abilitati ma per qualche motivo l'ordine non viene eseguito per errore verrà inviato un ordine di backup dopo 5 secondi da TV-Hub.org
  205.  
  206. // Documentazione: https://www.tv-hub.org/Home/Documentation#email-signals
  207. // Quando settiamo l'email di tradingview per abilitare l'email protection mettere temporaneamente la lingua in inglese su tradingview e poi riportarla in italiano altrimenti il codice di verifica su tv-hub non arriva.
  208. // Email Protection da aggiungere a tutte le stringe se utilizzata l'email protection "alertTimestamp":"{{ticker}}-{{time}}"
  209. // Esempio Email Protection buy = '{"pair":"ETHUSDT","unitsPercent":"8.5","unitsType":"percentBalance","exchange":"Bybit","apiKey":"OverTheClouds","token":"e6d67d6e-1a5f-4e53-a9fd-6276dfa2a34b","isBuy":true,"isMarket":true,"leverage":"1","marginType":"ISOLATED","closeCurrentPosition":true,"preventPyramiding":true,"cancelAllOrders":true,"alertTimestamp":"{{ticker}}-{{time}}}'
  210. // Abilitare pulsante invia testo normale "Invia testo normale ad un indirizzo e-mail alternativo" quando si crea alert in notifiche dell'alert oltre al solito webook
  211.  
  212.  
  213. // Start Entry Conditions Long And Short //
  214. entry_long = close > baseLine and close>spanB  and close > ema_long  and boom_bar_long_normal and inDateRange and not onlyShort and in_normal and not in_more_aggressive and not in_less_aggressive
  215. entry_long_more_aggressive = close > baseLine and close>spanB  and close > ema_long  and boom_bar_long_more_aggressive and inDateRange and not onlyShort and in_more_aggressive and not in_normal and not in_less_aggressive
  216. entry_long_less_aggressive = close > baseLine and close>spanB  and close > ema_long  and boom_bar_long_less_aggressive and inDateRange and not onlyShort and in_less_aggressive and not in_normal and not in_more_aggressive
  217. entry_short = close < baseLine and close<spanB  and close < ema_short and boom_bar_short and inDateRange and not onlyLong and ((in_normal and not in_more_aggressive and not in_less_aggressive) or (in_more_aggressive and not in_normal and not in_less_aggressive) or (in_less_aggressive and not in_normal and not in_more_aggressive))
  218. //  End Entry Conditions Long And Short //
  219.  
  220.  
  221. // Start Exit Conditions Long And Short //
  222. exit_long = close < baseLine
  223. exit_short = close > baseLine
  224. // End Exit Conditions Long And Short //
  225.  
  226. plot(strategy.opentrades)
  227.  
  228.  
  229. // Entry Exit Long / Short
  230. if entry_long // and strategy.opentrades == 0
  231.     strategy.entry('long', strategy.long, alert_message = "Open Long Position", comment = buy_command)
  232. if entry_long_more_aggressive
  233.     strategy.entry('long', strategy.long, alert_message = "Open Long Position More Aggressive")//, comment = buy_command)
  234. if entry_long_less_aggressive
  235.     strategy.entry('long', strategy.long, alert_message = "Open Long Position Less Aggressive")//, comment = buy_command)
  236. if exit_long
  237.     strategy.close(id='long', alert_message = "Close Long Position", comment = close_command)
  238.  
  239. if entry_short // and strategy.opentrades == 0
  240.     strategy.entry('short', strategy.short, alert_message = "Open Short Position", comment = sell_command)
  241. if exit_short
  242.     strategy.close(id='short', alert_message = "Close Short Position", comment = close_command)
  243.  
  244.  
  245. // Nome Alert: Over-The-Clouds-2 ETH/USDT.P BYBIT 4H
  246. // Commento Alert: {{strategy.order.comment}}
  247. // Webhook Classico Più Sicuro Ma Più Lento: https://alerts.tv-hub.org  
  248. // Webhook Nuovo Meno Sicuro Ma Più Veloce: https://alerts.tv-hub.org/api/ExecuteTradeSignalClassic
  249.  
  250.  
  251. // ------- Inizio Calcolatore Size Posizioni Aperte E Size Posizioni Residue E Segna Con Una Croce Se Abbiamo Realizzato Un Profitto ------- //
  252.                                    // Il Segno Croce Profitto Realizzato Non Funziona Sullo Swing Posizione //
  253.  
  254. // bought = strategy.position_size[0]> strategy.position_size[1]
  255. // Close_TP = false    
  256. // Close_TP := strategy.position_size[1] - strategy.position_size[0] and strategy.position_size[1] != 0 and strategy.position_size[0] != 0
  257.    
  258. // plotshape(Close_TP,title="Close_TP", style=shape.xcross, color=color.blue, size =size.small, editable = true)
  259. // plot(strategy.position_size[1],"Position Old")
  260. // plot(strategy.position_size,"Position")
  261.  
  262. // ------- Fine Calcolatore Size Posizioni Aperte E Size Posizioni Residue E Segna Con Una Croce Se Abbiamo Realizzato Un Profitto ------- //
  263.  
  264.  
  265. // ----------------- Inizio Tabella risultati mensili. Per visualizzare andare nelle impostazioni proprietà e spuntare ad ogni tick -----------------
  266.  
  267. // new_month = month(time) != month(time[1])
  268. // new_year  = year(time)  != year(time[1])
  269.  
  270. // eq = strategy.equity
  271.  
  272. // bar_pnl = eq / eq[1] - 1
  273.  
  274. // cur_month_pnl = 0.0
  275. // cur_year_pnl  = 0.0
  276.  
  277. // // Current Monthly P&L
  278. // cur_month_pnl := new_month ? 0.0 :
  279. //                  (1 + cur_month_pnl[1]) * (1 + bar_pnl) - 1
  280.  
  281. // // Current Yearly P&L
  282. // cur_year_pnl := new_year ? 0.0 :
  283. //                  (1 + cur_year_pnl[1]) * (1 + bar_pnl) - 1  
  284.  
  285. // // Arrays to store Yearly and Monthly P&Ls
  286. // var month_pnl  = array.new_float(0)
  287. // var month_time = array.new_int(0)
  288.  
  289. // var year_pnl  = array.new_float(0)
  290. // var year_time = array.new_int(0)
  291.  
  292. // last_computed = false
  293.  
  294. // if (not na(cur_month_pnl[1]) and (new_month or barstate.islast))
  295. //     if (last_computed[1])
  296. //         array.pop(month_pnl)
  297. //         array.pop(month_time)
  298.  
  299. //     array.push(month_pnl , cur_month_pnl[1])
  300. //     array.push(month_time, time[1])
  301.  
  302. // if (not na(cur_year_pnl[1]) and (new_year or barstate.islast))
  303. //     if (last_computed[1])
  304. //         array.pop(year_pnl)
  305. //         array.pop(year_time)
  306.  
  307. //     array.push(year_pnl , cur_year_pnl[1])
  308. //     array.push(year_time, time[1])
  309.  
  310. // last_computed := barstate.islast ? true : nz(last_computed[1])
  311.  
  312. // // Monthly P&L Table    
  313. // var monthly_table = table(na)
  314. // prec      = input(2, title = "Return Precision")
  315.  
  316. // if (barstate.islast)
  317. //     monthly_table := table.new(position.bottom_right, columns = 14, rows = array.size(year_pnl) + 1, bgcolor=#0F0F0F,border_width=1,border_color=#000000)
  318.  
  319. //     table.cell(monthly_table, 0,  0, "",     text_color=#D3D3D3, bgcolor=#0F0F0F)
  320. //     table.cell(monthly_table, 1,  0, "Jan",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  321. //     table.cell(monthly_table, 2,  0, "Feb",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  322. //     table.cell(monthly_table, 3,  0, "Mar",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  323. //     table.cell(monthly_table, 4,  0, "Apr",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  324. //     table.cell(monthly_table, 5,  0, "May",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  325. //     table.cell(monthly_table, 6,  0, "Jun",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  326. //     table.cell(monthly_table, 7,  0, "Jul",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  327. //     table.cell(monthly_table, 8,  0, "Aug",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  328. //     table.cell(monthly_table, 9,  0, "Sep",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  329. //     table.cell(monthly_table, 10, 0, "Oct",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  330. //     table.cell(monthly_table, 11, 0, "Nov",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  331. //     table.cell(monthly_table, 12, 0, "Dec",  text_color=#D3D3D3, bgcolor=#0F0F0F)
  332. //     table.cell(monthly_table, 13, 0, "Year", text_color=#D3D3D3, bgcolor=#0F0F0F)
  333.  
  334.  
  335. //     for yi = 0 to array.size(year_pnl) - 1
  336. //         table.cell(monthly_table, 0,  yi + 1, str.tostring(year(array.get(year_time, yi))), text_color=#D3D3D3, bgcolor=#0F0F0F)
  337.  
  338. //         y_color = array.get(year_pnl, yi) > 0 ? color.lime : color.red
  339. //         table.cell(monthly_table, 13, yi + 1, str.tostring(math.round(array.get(year_pnl, yi) * 100, prec)), bgcolor = y_color)
  340.  
  341. //     for mi = 0 to array.size(month_time) - 1
  342. //         m_row   = year(array.get(month_time, mi))  - year(array.get(year_time, 0)) + 1
  343. //         m_col   = month(array.get(month_time, mi))
  344. //         m_color = array.get(month_pnl, mi) > 0 ? color.lime : color.red
  345.  
  346. //         table.cell(monthly_table, m_col, m_row, str.tostring(math.round(array.get(month_pnl, mi) * 100, prec)), bgcolor = m_color)
  347.  
  348. // ----------------- Fine Tabella risultati mensili. Per visualizzare andare nelle impostazioni proprietà e spuntare ad ogni tick -----------------
Add Comment
Please, Sign In to add comment