Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Simple-Compounded Returns & Drawdowns Table

A Pine Script v5 strategy built on EMA (close, 12). It has 2 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 11 settings; defaults include Mode Compound Equity, Return Precision 2 and Fast Length 12.

Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.

Does Simple-Compounded Returns & Drawdowns Table repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 22 of 22 trades.
How did Simple-Compounded Returns & Drawdowns Table do on BTCUSDT 1D with default settings?
+9.38%
From 26 Jan 2024 to 21 Oct 2026, over 76 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Simple-Compounded Returns & Drawdowns Table run in Pine Script v6?
No
The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 76 before, 95 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does Simple-Compounded Returns & Drawdowns Table use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Simple-Compounded Returns & Drawdowns Table run in Zeal Terminal?
Yes
It compiles in 59 ms and runs 1,000 bars in 261 ms, in the browser.

BTCUSDT · 1D · default settings

  • EMA
  • EMA
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (5)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$1,080,210$2,025,273Equity from $1,000,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference.
Table drawn by the script, as it stood on the last bar
JanFebMarAprMayJunJulAugSepOctNovDecCompound Equity
202400-2.5612.714.0915.4137.1447.7563.2439.7642.7227.9127.91
20254.829.63-0.81-0.391.83-8.36-0.353.721.91-12.52-3.81-11.16-11.16
2026-0.566.53-0.449.4814.2113.9619.7635.519.438.028.02
Net profit
+9.38%
$93,802.40
Buy and hold
+102.5%
same period
Closed trades
76
27 won · 49 lost
Profitable
35.5%
of closed trades
Profit factor
1.04
gross profit ÷ gross loss
Max drawdown
46.39%
−$727,139.00

One run with the author's default settings, $1,000,000 starting capital, commission as the script sets it. A short position was still open at the last bar. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    3 settings have no label

    In the settings dialog fastLength (line 144), slowlength (line 145), MACDLength (line 146) show an empty name. The labels on this page come from the variable names.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
R & DD Table
ModeCompound Equitystringdisplay_array line 27 line 48 line 67 line 115
Return Precision2intline 128 line 137
Headers Color#D4D4D4colorline 102 line 103 line 104 line 105 line 106 line 107 line 108 line 109 line 110 line 111 line 112 line 113 line 114 line 115 line 118
Headers Text Colorcolor.blackcolorline 102 line 103 line 104 line 105 line 106 line 107 line 108 line 109 line 110 line 111 line 112 line 113 line 114 line 115 line 118
Positive Colorcolor.greencolorm_color y_color
Negative Colorcolor.redcolorm_color y_color
Zero Color#DDDDDDcolorm_color y_color
Cell Text Colorcolor.whitecolorline 128 line 137
Fast Length (no label in the script)12intMACD
Slowlength (no label in the script)26intMACD
MACDLength (no label in the script)9intaMACD

What it calculates

  • EMAclose, Fast Length (12)MACD · line 147
  • EMAMACD, MACDLength (9)aMACD · line 148

Signal flow

How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.

closecloseprice datafastLengthFast Lengthsetting · 12slowlengthSlowlengthsetting · 26MACDLengthMACDLengthsetting · 9i_eq_to_ddModesetting · Compound Equitytimetimeprice dataMACDEMA→ MACDaMACDEMA→ aMACDinitial_monthly_equity, initial_yearly_equity, initial_equity, total_equity, main_table, m_row, m_colinitial_monthly_equity …7 valuescur_month_pnl, cur_year_pnlcur_month_pnl · cur_yea…2 valuescur_month_ddcur_month_ddvaluem_ATH, m_drawdownm_ATH · m_drawdown2 valuescur_year_ddcur_year_ddvaluey_ATH, y_drawdowny_ATH · y_drawdown2 valuesdisplay_arraydisplay_arrayvaluedeltadeltavaluenew_month, new_yearnew_month · new_year2 conditionsm_color, y_colorColourm_color · y_colorentry:MacdLEOpen MacdLEstrategy.entryentry:MacdSEOpen MacdSEstrategy.entry

Order rules

OrderFires whenBy defaultLine
Open MacdLE long(ta.crossover(delta, 0))On151
Open MacdSE short(ta.crossunder(delta, 0))On153

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Does it repaint?

No

No repainting patterns in the source, and the live replay matched history.

22/22trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingprocess_orders_on_close = true: orders fill at the signal bar's close.

The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+9.4%+102.5%7636%1.0446.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+27.2%+5.5%6837%1.3912.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−51.8%+9.8%7232%0.7976.4%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+3.4%+8.4%7629%1.0329.8%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+53.0%+16.7%6349%1.1373.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−5.2%+21.5%7033%0.9635.1%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−55.5%+148.3%6843%0.6262.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+3.5%+17.1%7732%1.0420.5%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market2438%−$172,198.00
Sideways market3639%$130,136.00
Falling market1625%$135,865.00

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

59.8%

The 95th percentile of the worst drawdown when the same 76 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 32.2% to 59.8%; the tick is what actually happened, 46.0%. Order luck alone moves it this much.

0%69%
All 76 trades
SideEntryExitBarsP&L
short15 Mar 2024 69,499.905 May 2024 64,012.0051$78,962.00
long5 May 2024 64,012.0011 May 2024 60,826.006−$53,702.20
short11 May 2024 60,826.0012 May 2024 61,484.001−$11,091.00
long12 May 2024 61,484.0030 May 2024 68,352.2018$113,290.00
short30 May 2024 68,352.205 Jun 2024 71,108.006−$45,457.00
long5 Jun 2024 71,108.008 Jun 2024 69,310.503−$27,351.90
short8 Jun 2024 69,310.5012 Jul 2024 57,889.1034$173,791.00
long12 Jul 2024 57,889.1031 Jul 2024 64,628.0019$143,003.00
short31 Jul 2024 64,628.0019 Aug 2024 59,438.5019$110,124.00
long19 Aug 2024 59,438.5030 Aug 2024 59,124.0011−$7,839.50
short30 Aug 2024 59,124.0012 Sep 2024 58,132.3013$24,718.40
long12 Sep 2024 58,132.301 Oct 2024 60,805.8019$68,912.40
short1 Oct 2024 60,805.8014 Oct 2024 66,084.0013−$136,054.00
long14 Oct 2024 66,084.0026 Oct 2024 67,092.8012$21,848.80
short26 Oct 2024 67,092.8028 Oct 2024 69,962.202−$62,149.10
long28 Oct 2024 69,962.203 Nov 2024 68,776.006−$23,584.70
short3 Nov 2024 68,776.006 Nov 2024 75,572.003−$135,120.00
long6 Nov 2024 75,572.0026 Nov 2024 91,965.2020$267,312.00
short26 Nov 2024 91,965.2016 Dec 2024 106,059.0020−$229,813.00
long16 Dec 2024 106,059.0018 Dec 2024 100,204.002−$70,095.50
short18 Dec 2024 100,204.005 Jan 2025 98,363.6018$22,034.40
long5 Jan 2025 98,363.609 Jan 2025 92,552.504−$72,177.80
short9 Jan 2025 92,552.5015 Jan 2025 100,497.006−$98,680.30
long15 Jan 2025 100,497.0028 Jan 2025 101,336.0013$8,764.58
short28 Jan 2025 101,336.0020 Feb 2025 98,305.0023$31,689.60
long20 Feb 2025 98,305.0024 Feb 2025 91,552.904−$74,958.80
short24 Feb 2025 91,552.906 Mar 2025 89,931.9010$17,995.50
long6 Mar 2025 89,931.908 Mar 2025 86,222.402−$42,665.00
short8 Mar 2025 86,222.4015 Mar 2025 84,338.407$21,669.40
long15 Mar 2025 84,338.406 Apr 2025 78,430.0022−$70,993.40
short6 Apr 2025 78,430.0011 Apr 2025 83,423.805−$60,003.90
long11 Apr 2025 83,423.8017 May 2025 103,127.0036$208,398.00
short17 May 2025 103,127.0018 May 2025 106,454.001−$35,196.30
long18 May 2025 106,454.0019 May 2025 105,574.001−$8,731.07
short19 May 2025 105,574.0021 May 2025 109,644.002−$40,359.80
long21 May 2025 109,644.0024 May 2025 107,762.003−$17,276.80
short24 May 2025 107,762.0010 Jun 2025 110,274.0017−$23,063.60
long10 Jun 2025 110,274.0012 Jun 2025 105,672.002−$40,325.40
short12 Jun 2025 105,672.0026 Jun 2025 106,947.0014−$11,173.60
long26 Jun 2025 106,947.0021 Jul 2025 117,380.0025$89,229.40
short21 Jul 2025 117,380.0022 Jul 2025 119,954.001−$22,014.30
long22 Jul 2025 119,954.0023 Jul 2025 118,756.001−$9,809.53
short23 Jul 2025 118,756.0011 Aug 2025 118,686.0019$572.89
long11 Aug 2025 118,686.0017 Aug 2025 117,405.006−$10,497.70
short17 Aug 2025 117,405.006 Sep 2025 110,188.0020$59,143.40
long6 Sep 2025 110,188.0023 Sep 2025 111,999.0017$16,783.60
short23 Sep 2025 111,999.001 Oct 2025 118,595.008−$61,136.60
long1 Oct 2025 118,595.0010 Oct 2025 112,775.009−$47,946.00
short10 Oct 2025 112,775.0026 Oct 2025 114,559.0016−$14,703.00
long26 Oct 2025 114,559.003 Nov 2025 106,583.008−$63,657.50
short3 Nov 2025 106,583.0027 Nov 2025 91,333.9024$121,699.00
long27 Nov 2025 91,333.9017 Dec 2025 86,243.2020−$54,194.40
short17 Dec 2025 86,243.2020 Dec 2025 88,360.903−$22,544.20
long20 Dec 2025 88,360.9020 Jan 2026 88,427.7031$676.64
short20 Jan 2026 88,427.7015 Feb 2026 68,832.6026$198,605.00
long15 Feb 2026 68,832.6022 Mar 2026 67,859.0035−$15,485.80
short22 Mar 2026 67,859.0025 Mar 2026 71,336.503−$55,313.90
long25 Mar 2026 71,336.5026 Mar 2026 68,820.301−$36,121.10
short26 Mar 2026 68,820.306 Apr 2026 68,853.7011−$478.75
long6 Apr 2026 68,853.7028 Apr 2026 76,342.8022$107,404.00
short28 Apr 2026 76,342.804 May 2026 79,861.006−$50,456.50
long4 May 2026 79,861.0012 May 2026 80,504.508$8,415.03
short12 May 2026 80,504.5013 Jun 2026 64,458.0032$209,852.00
long13 Jun 2026 64,458.0027 Jun 2026 60,029.0014−$86,760.20
short27 Jun 2026 60,029.0029 Jun 2026 60,260.202−$4,529.19
long29 Jun 2026 60,260.2030 Jun 2026 58,624.701−$31,792.10
short30 Jun 2026 58,624.701 Jul 2026 60,024.001−$27,200.40
long1 Jul 2026 60,024.0027 Jul 2026 63,755.9026$69,160.40
short27 Jul 2026 63,755.907 Aug 2026 64,923.2011−$21,633.50
long7 Aug 2026 64,923.2011 Aug 2026 63,600.004−$23,640.10
short11 Aug 2026 63,600.0018 Aug 2026 64,725.407−$20,106.70
long18 Aug 2026 64,725.402 Sep 2026 77,340.0015$217,535.00
short2 Sep 2026 77,340.003 Sep 2026 81,270.401−$67,777.90
long3 Sep 2026 81,270.404 Sep 2026 79,660.801−$25,072.30
short4 Sep 2026 79,660.8021 Sep 2026 86,620.0017−$108,402.00
long21 Sep 2026 86,620.0029 Sep 2026 83,663.708−$38,650.60

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
Simple-Compounded Returns & Drawdowns Table this page—v5 strategy+9.4%7646.4%
EMA Slope AyE by fajardoarelysemav4 strategyNo trades on this market
ROoT by realisticDove62527emav5 strategy−4.7%2259.4%
sachin5986 by mohitesachin78emav4 strategy+32.1%3517.6%
sonu1997 by Sonu1997emav4 strategy+960.7%21,103.8%
Moving Average Crossover by Muh4mm4demav4 strategy+19,990.1%301,274.2%

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • 3 settings use the untyped input() (line 144, 145, 146). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

Same 76 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 144: input() → input.int()
  • Line 145: input() → input.int()
  • Line 146: input() → input.int()
⋯// This is a sample code of a working strategy to show the table in action-fastLength = input(12)+fastLength = input.int(12)-slowlength = input(26)+slowlength = input.int(26)-MACDLength = input(9)+MACDLength = input.int(9)MACD = ta.ema(close, fastLength) - ta.ema(close, slowlength)⋯

Does it run in Pine Script v6?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 76 before, 95 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © antondmt-//@version=5+//@version=6strategy("Returns & Drawdowns Table", "R & DD", true, calc_on_every_tick = false, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, process_orders_on_close = true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 59 msYes 1,000 bars in 261 msNot measured
PineTSNot testedNot testedNot measured

“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.

Source

Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © antondmt//@version=5strategy("Returns & Drawdowns Table", "R & DD", true, calc_on_every_tick = false, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, process_orders_on_close = true)i_eq_to_dd =            input.string("Compound Equity", "Mode", ["Simple Equity", "Compound Equity", "Drawdown"], group = "R & DD Table")i_precision =           input.int(2, "Return Precision", group = "R & DD Table")i_headers_col =         input.color(#D4D4D4, "Headers Color", group = "R & DD Table")i_headers_text_col =    input.color(color.black, "Headers Text Color", group = "R & DD Table")i_pos_col =             input.color(color.green, "Positive Color", group = "R & DD Table")i_neg_col =             input.color(color.red, "Negative Color", group = "R & DD Table")i_zero_col =            input.color(#DDDDDD, "Zero Color", group = "R & DD Table")i_cell_text_col =       input.color(color.white, "Cell Text Color", group = "R & DD Table")// TIME {var month_times = array.new_int(0)                                                              // Array of all month times  new_month = month(time) != month(time[1]) if(new_month or barstate.isfirst)    array.push(month_times, time)var year_times = array.new_int(0)                                                               new_year = year(time) != year(time[1])  if (new_year or barstate.isfirst)    array.push(year_times, time)//}// SIMPLE EQUITY CALCULATIONS {// Simple equity is strictly calculated from start to end of each month/year equity. There is no compoundvar monthly_simp_pnls = array.new_float(0)                                                      // Array of all monthly profits and lossesvar yearly_simp_pnls = array.new_float(0)                                                       if(i_eq_to_dd == "Simple Equity")    var initial_monthly_equity = strategy.equity                                                // Starting equity for each month    cur_month_pnl = nz((strategy.equity - initial_monthly_equity) / initial_monthly_equity)     // Current month's equity change    if(new_month or barstate.isfirst)        initial_monthly_equity := strategy.equity        array.push(monthly_simp_pnls, cur_month_pnl)    else         array.set(monthly_simp_pnls, array.size(monthly_simp_pnls) - 1, cur_month_pnl)        var initial_yearly_equity = strategy.equity    cur_year_pnl = nz((strategy.equity - initial_yearly_equity) / initial_yearly_equity)    if (new_year or barstate.isfirst)        initial_yearly_equity := strategy.equity        array.push(yearly_simp_pnls, cur_year_pnl)    else         array.set(yearly_simp_pnls, array.size(yearly_simp_pnls) - 1, cur_year_pnl)// }// COMPOUND EQUITY CALCULATIONS {// Compound equity is strictly calculated based on equity state from the beginning of time until the end of each month/year equity. It shows the exact equity movement through timevar monthly_comp_pnls = array.new_float(0)                                                      // Array of all monthly profits and lossesvar yearly_comp_pnls = array.new_float(0)                                                       if(i_eq_to_dd == "Compound Equity")    var initial_equity = strategy.equity                                                    cur_month_pnl = nz((strategy.equity - initial_equity) / initial_equity)                     // Current month's equity change    if(new_month or barstate.isfirst)        array.push(monthly_comp_pnls, cur_month_pnl)    else         array.set(monthly_comp_pnls, array.size(monthly_comp_pnls) - 1, cur_month_pnl)        cur_year_pnl = nz((strategy.equity - initial_equity) / initial_equity)    if (new_year or barstate.isfirst)        array.push(yearly_comp_pnls, cur_year_pnl)    else         array.set(yearly_comp_pnls, array.size(yearly_comp_pnls) - 1, cur_year_pnl)// }    // DRAWDOWN CALCULATIONS {// Drawdowns are calculated from highest equity to lowest trough for the month/yearvar monthly_dds = array.new_float(0)                                                            // Array of all monthly drawdownsvar yearly_dds = array.new_float(0)                                                             if (i_eq_to_dd == "Drawdown")    total_equity = strategy.equity - strategy.openprofit                                var cur_month_dd = 0.0      var m_ATH = total_equity                                                                    // Monthly All-Time-High (ATH). It is reset each month    m_ATH := math.max(total_equity, nz(m_ATH[1]))    m_drawdown = -math.abs(total_equity / m_ATH * 100 - 100) / 100                              // Drawdown at current bar    if(m_drawdown < cur_month_dd)        cur_month_dd := m_drawdown    if(new_month or barstate.isfirst)        cur_month_dd := 0.0        m_ATH := strategy.equity - strategy.openprofit        array.push(monthly_dds, 0)    else         array.set(monthly_dds, array.size(monthly_dds) - 1, cur_month_dd)        var cur_year_dd = 0.0    var y_ATH = total_equity    y_ATH := math.max(total_equity, nz(y_ATH[1]))    y_drawdown = -math.abs(total_equity / y_ATH * 100 - 100) / 100    if(y_drawdown < cur_year_dd)        cur_year_dd := y_drawdown    if (new_year or barstate.isfirst)        cur_year_dd := 0.0        y_ATH := strategy.equity - strategy.openprofit        array.push(yearly_dds, 0)    else         array.set(yearly_dds, array.size(yearly_dds) - 1, cur_year_dd) // }// TABLE LOGIC { var main_table = table(na)table.clear(main_table, 0, 0, 13, new_year ? array.size(year_times) - 1 : array.size(year_times))main_table := table.new(position.bottom_right, columns = 14, rows = array.size(year_times) + 1, border_width = 1)t_set_headers() =>                                                                              // Sets time headers of the table    // Set month headers    table.cell(main_table, 0,  0, "",     text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 1,  0, "Jan",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 2,  0, "Feb",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 3,  0, "Mar",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 4,  0, "Apr",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 5,  0, "May",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 6,  0, "Jun",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 7,  0, "Jul",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 8,  0, "Aug",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 9,  0, "Sep",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 10, 0, "Oct",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 11, 0, "Nov",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 12, 0, "Dec",  text_color = i_headers_text_col, bgcolor = i_headers_col)    table.cell(main_table, 13, 0, str.tostring(i_eq_to_dd), text_color = i_headers_text_col, bgcolor = i_headers_col)    // Set year headers    for i = 0 to array.size(year_times) - 1        table.cell(main_table, 0,  i + 1, str.tostring(year(array.get(year_times, i))), text_color = i_headers_text_col, bgcolor = i_headers_col)t_set_months() =>                                                                               // Sets inner monthly data of the table    display_array = switch i_eq_to_dd         "Simple Equity" => monthly_simp_pnls         "Compound Equity" => monthly_comp_pnls        => monthly_dds    for i = 0 to array.size(month_times) - 1        m_row = year(array.get(month_times, i)) - year(array.get(year_times, 0)) + 1        m_col = month(array.get(month_times, i))         m_color = array.get(display_array, i) == 0 ? color.new(i_zero_col, transp = 30) : array.get(display_array, i) > 0 ? color.new(i_pos_col, transp = 30) : color.new(i_neg_col, transp = 30)        table.cell(main_table, m_col, m_row, str.tostring(math.round(array.get(display_array, i) * 100, i_precision)), bgcolor = m_color, text_color = i_cell_text_col)        t_set_years() =>                                                                                // Sets inner yearly data of the table    display_array = switch i_eq_to_dd         "Simple Equity" => yearly_simp_pnls         "Compound Equity" => yearly_comp_pnls        => yearly_dds    for i = 0 to array.size(year_times) - 1        y_color = array.get(display_array, i) == 0 ? color.new(i_zero_col, transp = 30) : array.get(display_array, i) > 0 ? color.new(i_pos_col, transp = 20) : color.new(i_neg_col, transp = 20)        table.cell(main_table, 13, i + 1, str.tostring(math.round(array.get(display_array, i) * 100, i_precision)), bgcolor = y_color, text_color = i_cell_text_col)t_set_headers() t_set_months()t_set_years()// }// PLACE YOUR STRATEGY CODE HERE {// This is a sample code of a working strategy to show the table in actionfastLength = input(12)slowlength = input(26)MACDLength = input(9)MACD = ta.ema(close, fastLength) - ta.ema(close, slowlength)aMACD = ta.ema(MACD, MACDLength)delta = MACD - aMACDif (ta.crossover(delta, 0))    strategy.entry("MacdLE", strategy.long, comment = "MacdLE")if (ta.crossunder(delta, 0))    strategy.entry("MacdSE", strategy.short, comment = "MacdSE")// }