Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN]

A Pine Script v5 strategy built on SAR (startCalc, incrementCalc), Linreg (close_price, 50) and SMA (close, 20). It has 9 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a profit target and no stop loss. Each trade commits 1.0% of equity and pays 0.075 commission. 43 settings; defaults include Start - Default = 2 - Multiplied by .01 3, Step Setting (Sensitivity) - Default = 2 - Multiplied by .01 3 and Maximum Step (Sensitivity) - Default = 2 - Multiplied by .10 3.

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 Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN] repaint?
Yes
At least one pattern in the source can repaint: intrabar recalculation.
How did Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN] do on BTCUSDT 1D with default settings?
−23.40%
From 26 Jan 2024 to 21 Oct 2026, over 73 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
What alerts does Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN] have?
2
alertSyntaxBase + 'side:long'; alertSyntaxBase + 'side:short'.
Does Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN] run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L231:C49: 'plot' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download.
Does Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN] use a stop loss?
No
Its exits set a profit target but no stop.

BTCUSDT · 1D · default settings

  • Buy Signal
  • Sell Signal
  • Average
  • Close price
  • 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 (43)
25,00050,00075,000100,000125,000AprJulOct2025AprJulOct2026AprJulOct$749$2,025Equity from $1,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
Table drawn by the script, as it stood on the last bar
Start: long1709251200000
End: long1790035200000
Net Profit: -23.4%
Percent Per Day -0.02503%
Percent Profitable: 80.82%
Profit Factor: 0.803
Total Trades: 73
Max Wins In A Row: 9
Max Losses In A Row: 2
Net profit
−23.40%
−$234.00
Buy and hold
+102.5%
same period
Closed trades
73
59 won · 14 lost
Profitable
80.8%
of closed trades
Profit factor
0.80
gross profit ÷ gross loss
Max drawdown
44.04%
−$440.44

One run with the author's default settings, $1,000 starting capital, commission as the script sets it. A long 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

    4 settings do nothing

    “Show Up Trending Parabolic Sar”, “Show Down Trending Parabolic Sar”, “Start and Step settings are *.01 so 2 = .02 etc, Maximum Step is *.10 so 2 = .2”, “Show Bullish/Bearish Zones” are declared but never read.

  • Check

    No stop loss

    strategy.exit is used without a stop, loss or trailing stop.

  • Note

    4 settings have no label

    In the settings dialog lengthG (line 216), src (line 217), startPeriodTime (line 271), endPeriodTime (line 273) 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.

  • Note

    Uses an argument v6 removed

    when = on line 333, 334, 335. The upgraded version below moves each call inside an if block.

Settings

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

SettingDefaultType and rangeFeeds
POKI
Start - Default = 2 - Multiplied by .013int · min 0 · max 10startCalc
Step Setting (Sensitivity) - Default = 2 - Multiplied by .013int · min 0 · max 10incrementCalc
Maximum Step (Sensitivity) - Default = 2 - Multiplied by .103int · min 1 · max 10maximumCalc
Show Up Trending Parabolic Sartrueboolunused
Show Down Trending Parabolic Sartrueboolunused
Start and Step settings are *.01 so 2 = .02 etc, Maximum Step is *.10 so 2 = .2falseboolunused
Linear Regression length50int · min 1linear_reg linear_reg_prev adxtruerange adxplus adxminus
Bollinger Length20int · min 1smabasis stdev
Bollinger Deviation2float · min 1dev
Overbought1int · min 1pintarojo
Oversold0int · min 0pintaverde
Use another Timeframe?falseboolres1
Select The Timeframe60timeframeres1
Renko Assignment MethodTraditionalstring · options ['ATR', 'Traditional', 'Part of Price']line 88 line 91
Value29float · min 0prevhigh prevlow line 90 line 93
Price SourceClosestring · options ['Close', 'Open / Close', 'High / Low']useClose useOpenClose
Use True Range instead of VolumeAutostring · options ['Always', 'Auto', 'Never']vol
Oscillatingtrueboolx
Normalizefalseboolbarcount
period32intn2ma nma sqn n2ma1 nma1 sqn1
Show Bullish/Bearish Zonestrueboolunused
Src (no label in the script)ohlc4sourcea b
G-Channel Trend Detection
Length G (no label in the script)100inta b
ADX
Average Directional Index (ADX)truebooladxsig isADXEnabledAndAboveThreshold
ADX Smoothing14intadx adxsig
DI Length14intadxplus adxminus adxsig
ADX Threshold25intisADXEnabledAndAboveThreshold
Date Range
Starttrueboolstart
Start Period Time (no label in the script)timestamp('1 Jan 2019')timestart
Endtrueboolend
End Period Time (no label in the script)timestamp('31 Dec 2030')timeend
Trade Direction
Trade DirectionLong and Shortstring · options ['Long and Short', 'Long Only', 'Short Only']entry Long entry Short line 321 line 324
Take Profit
Take Profit 1 - Target %2float · min 0.0 · step 0.5exit TP1
% Of Position100int · min 0exit TP1
Take Profit 2 - Target %100float · min 0.0 · step 0.5exit TP2
% Of Position100int · min 0exit TP2
Take Profit 3 - Target %100float · min 0.0 · step 0.5exit TP3
% Of Position100int · min 0exit TP3
Take Profit 4 - Target %100float · min 0.0 · step 0.5exit TP4
Stop Loss
Stop Loss (%)9float · min 0.01slLongClose slShortClose
Leverage
Leverage1float · step .5contracts
ProfitView Alert Syntax
Alert Syntax PrefixCRYPTANEX_99FTX_Strategy-Name-HerestringalertSyntaxBase
Dashboard
Show Dashboardtrueboolline 344

What it calculates

  • SARstartCalc, incrementCalc, maximumCalcsarUp · line 34
  • SARstartCalc, incrementCalc, maximumCalcsarDown · line 35
  • Linregclose_price, Linear Regression length (50), 0linear_reg · line 43
  • Linregclose[1], Linear Regression length (50), 0linear_reg_prev · line 44
  • SMAclose, Bollinger Length (20)smabasis · line 53
  • Stdevclose, Bollinger Length (20)stdev · line 54
  • TR · chosen by Use True Range instead of Volumevol · line 84
  • WMAclose, math.round(z / 2)n2ma · line 111
  • WMAclose, period (32)nma · line 112
  • WMAclose[1], math.round(z / 2)n2ma1 · line 115
  • WMAclose[1], period (32)nma1 · line 116
  • WMAdiff, sqnn1 · line 119
  • WMAdiff1, sqnn2 · line 120
  • Crossoverx, 0longCondPOKI · line 123
  • Crossunderx, 0shortCondPOKI · line 124
  • Changehighadxup · line 254
  • Changelowadxdown · line 255
  • RMAta.tr, Linear Regression length (50)adxtruerange · line 258
  • RMAmath.abs(adxplus - adxminus) / (adxsum == 0 ? 1 : adxsum), ADX Smoothing (14)adx · line 265

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.

The script has 127 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.

Order rules

OrderFires whenBy defaultLine
Open Long longlongConditionCalc and tradeDirection != 'Short Only' and isInLongPosition == falseOn322
Open Short shortshortConditionCalc and tradeDirection != 'Long Only' and isInShortPosition == falseOn325
Exit TP1 limitcalcPeriodOn329
Exit TP2 limitcalcPeriodOn330
Exit TP3 limitcalcPeriodOn331
Exit TP4 limitcalcPeriodOn332
Close LongslLongCloseclose < strategy.position_avg_price * (1 - stoplossPercent)On333
Close ShortslShortCloseclose > strategy.position_avg_price * (1 + stoplossPercent)On334
Close closeLongCondition or closeShortConditionOn335

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

Alerts

AlertCallMessageLine
(no title)alertalertSyntaxBase + 'side:long'323
(no title)alertalertSyntaxBase + 'side:short'326

Does it repaint?

Yes

At least one pattern in the source can repaint; it is marked Check below.

27/27trades 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. On 11 of them the position changed while the bar was forming before it settled. Anyone watching live sees those changes; once the bar closes it matches history.
  • ClearHigher-timeframe data5 request.security call(s), none with lookahead on.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • CheckIntrabar recalculationuses varip. Live values can differ from history.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

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−23.4%+102.5%7381%0.8044.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−8.5%+5.5%3474%0.8530.3%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+90.6%+9.8%8188%1.5832.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+15.1%+8.4%1493%2.4813.4%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+15.3%+16.7%3100%—7.6%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−6.2%+148.3%1776%0.8722.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−6.8%+17.1%367%0.3511.0%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 market2090%$98.55
Sideways market3376%−$219.61
Falling market2080%−$112.37

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

How bad could the drawdown be?

56.5%

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

0%65%
All 73 trades
SideEntryExitBarsP&L
short1 Mar 2024 61,131.005 Mar 2024 68,245.704−$117.97
short6 Mar 2024 63,724.0012 Mar 2024 72,078.106−$117.04
short13 Mar 2024 71,452.0014 Mar 2024 70,023.001$14.16
short15 Mar 2024 71,388.9016 Mar 2024 69,499.801$19.46
short19 Mar 2024 67,610.0020 Mar 2024 61,937.401$65.86
short22 Mar 2024 65,501.3023 Mar 2024 63,796.601$21.22
short28 Mar 2024 69,470.001 Apr 2024 68,080.604$16.40
short1 May 2024 60,672.002 May 2024 58,365.001$32.97
short7 May 2024 63,165.208 May 2024 61,901.901$17.31
short27 Jun 2024 60,865.003 Jul 2024 59,647.706$17.63
short8 Jul 2024 55,857.8016 Jul 2024 64,724.108−$155.54
short18 Jul 2024 64,088.001 Aug 2024 62,806.2014$15.08
short8 Aug 2024 55,133.809 Aug 2024 61,686.001−$99.90
short10 Aug 2024 60,838.0011 Aug 2024 59,621.201$13.51
short12 Aug 2024 58,712.6015 Aug 2024 57,538.303$13.76
short19 Aug 2024 58,427.3024 Aug 2024 64,037.205−$73.86
long14 Nov 2024 90,375.2018 Nov 2024 92,182.704$12.63
long19 Nov 2024 90,464.1020 Nov 2024 92,310.801$13.15
long25 Nov 2024 97,900.105 Dec 2024 99,858.1010$13.10
long7 Dec 2024 99,740.8011 Dec 2024 101,736.004$13.34
long12 Dec 2024 101,125.0015 Dec 2024 103,148.003$13.59
long21 Dec 2024 97,805.4026 Dec 2024 99,761.605$13.84
long29 Dec 2024 95,300.002 Jan 2025 97,206.004$14.10
long11 Feb 2025 97,430.8021 Feb 2025 99,379.4010$14.36
long23 Feb 2025 96,551.0027 Feb 2025 84,250.104−$101.91
short1 Mar 2025 84,349.903 Mar 2025 94,270.002−$82.16
short4 Mar 2025 86,221.209 Mar 2025 84,496.705$11.24
short14 Mar 2025 81,115.806 Apr 2025 79,493.5023$11.45
long29 Apr 2025 95,011.201 May 2025 96,911.402$11.64
long2 May 2025 96,489.908 May 2025 98,419.706$11.86
long11 May 2025 104,810.0019 May 2025 106,906.008$12.08
long21 May 2025 106,850.0022 May 2025 109,644.001$16.39
long25 May 2025 107,762.0026 May 2025 109,917.001$12.60
long1 Jun 2025 104,592.003 Jun 2025 106,684.002$12.84
long17 Jul 2025 118,630.0011 Aug 2025 121,003.0025$13.07
long9 Oct 2025 123,306.0012 Oct 2025 110,644.003−$74.98
long13 Oct 2025 114,959.0022 Oct 2025 108,298.009−$38.33
short22 Oct 2025 108,298.003 Nov 2025 106,132.0012$11.25
short7 Nov 2025 101,346.0013 Nov 2025 99,319.106$11.45
short17 Nov 2025 94,261.4018 Nov 2025 92,215.101$12.73
short20 Nov 2025 91,555.0021 Nov 2025 86,637.201$33.57
short26 Nov 2025 87,370.001 Dec 2025 85,622.605$12.52
short5 Dec 2025 92,078.106 Dec 2025 89,330.001$19.53
short11 Dec 2025 92,015.4012 Dec 2025 90,175.101$13.11
short13 Dec 2025 90,268.4014 Dec 2025 88,463.101$13.35
short18 Dec 2025 86,243.2014 Jan 2026 95,414.0027−$79.26
short16 Jan 2026 95,604.8018 Jan 2026 93,692.702$12.13
short25 Jan 2026 89,225.3026 Jan 2026 86,670.401$18.12
short4 Feb 2026 75,770.205 Feb 2026 73,165.801$22.55
short8 Feb 2026 69,289.4010 Feb 2026 67,903.602$13.11
short16 Feb 2026 68,832.6017 Feb 2026 67,455.901$13.35
short18 Feb 2026 67,503.5019 Feb 2026 66,153.401$13.60
short22 Feb 2026 67,975.9023 Feb 2026 66,616.401$13.85
short27 Feb 2026 67,485.2028 Feb 2026 65,872.101$17.08
short2 Mar 2026 65,776.505 Mar 2026 72,666.803−$82.83
short6 Mar 2026 70,891.007 Mar 2026 68,114.001$26.25
short18 Mar 2026 73,909.4019 Mar 2026 71,246.601$24.96
short28 Apr 2026 77,371.3029 Apr 2026 75,823.901$13.84
short4 May 2026 78,568.6015 May 2026 81,090.0011−$25.59
long15 May 2026 81,090.0029 May 2026 73,617.5014−$68.89
short1 Jun 2026 73,674.402 Jun 2026 71,408.901$19.52
short9 Jun 2026 63,086.0010 Jun 2026 61,730.001$13.73
short13 Jun 2026 63,580.0018 Jun 2026 62,308.405$12.96
short22 Jun 2026 63,312.0023 Jun 2026 62,045.801$13.20
short24 Jun 2026 62,734.6025 Jun 2026 61,078.001$18.10
short28 Jun 2026 60,029.0030 Jun 2026 58,828.402$13.78
short1 Jul 2026 58,624.707 Jul 2026 64,042.906−$71.25
short8 Jul 2026 63,364.009 Jul 2026 62,096.701$12.72
short12 Jul 2026 63,819.0013 Jul 2026 62,542.601$12.95
long24 Aug 2026 77,734.0025 Aug 2026 79,288.701$13.17
long27 Aug 2026 79,023.8028 Aug 2026 80,604.201$13.41
long30 Aug 2026 78,230.003 Sep 2026 79,794.604$13.66
long4 Sep 2026 81,270.4021 Sep 2026 82,895.8017$13.91

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
Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN] this page—v5 strategy−23.4%7344.0%
Strategy Myth-Busting #6 - PSAR+MA+SQZMOM+HVI - [MYN] by myncryptosar sma stdev tr linreg rmav5 strategy−94.4%2100.9%
ADX_TSI_Bol Band Trend Chaser by gary_tradessma stdev wma rmav4 strategyNo trades on this market
Strategy Myth-Busting #11 - TrendMagic+SqzMom+CDV - [MYN] by myncryptosma stdev tr linreg rmav5 strategy−2.3%912.3%
BT-SAR Ema, Squeeze, Volatility by Credsonbsar stdev sma tr linregv5 strategy+3.5%1411.5%
Athena Momentum Squeeze - Short, Lean, and Mean by jrandolph1046sma stdev tr linregv5 strategy+3.7%100.6%

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 strategy calls use the when = argument (line 333, 334, 335). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 13 settings use the untyped input() (line 28, 29, 30, 50, 82, 83, 110, 179, 216, 217, 250, 251, 252). 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 73 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 28: input() → input.bool()
  • Line 29: input() → input.bool()
  • Line 30: input() → input.bool()
  • Line 50: input() → input.bool()
  • Line 82: input() → input.bool()
  • Line 83: input() → input.bool()
10 more edits
  • Line 110: input() → input.int()
  • Line 179: input() → input.bool()
  • Line 216: input() → input.int()
  • Line 217: input() → input.source()
  • Line 250: input() → input.int()
  • Line 251: input() → input.int()
  • Line 252: input() → input.int()
  • Line 333: when = slLongClose → if block
  • Line 334: when = slShortClose → if block
  • Line 335: when = closeLongCondition or closeShortCondition → if block
⋯maximum = input.int(3, minval=1, maxval=10, title='Maximum Step (Sensitivity) - Default = 2 - Multiplied by .10')-sus = input(true, 'Show Up Trending Parabolic Sar')+sus = input.bool(true, 'Show Up Trending Parabolic Sar')-sds = input(true, 'Show Down Trending Parabolic Sar')+sds = input.bool(true, 'Show Down Trending Parabolic Sar')-disc = input(false, title='Start and Step settings are *.01 so 2 = .02 etc, Maximum Step is *.10 so 2 = .2')+disc = input.bool(false, title='Start and Step settings are *.01 so 2 = .02 etc, Maximum Step is *.10 so 2 = .2')startCalc = startMult * .01⋯oversold = input.int(title='Oversold', defval=0, minval=0)-custom_timeframe = input(title='Use another Timeframe?', defval=false)+custom_timeframe = input.bool(title='Use another Timeframe?', defval=false)highTimeFrame = input.timeframe(title='Select The Timeframe', defval='60')⋯useTrueRange = input.string(defval='Auto', options=['Always', 'Auto', 'Never'], title='Use True Range instead of Volume')-isOscillating = input(defval=true, title='Oscillating')+isOscillating = input.bool(defval=true, title='Oscillating')-normalize = input(defval=false, title='Normalize')+normalize = input.bool(defval=false, title='Normalize')vol = useTrueRange == 'Always' or useTrueRange == 'Auto' and na(volume) ? ta.tr : volume⋯//-z = input(title='period', defval=32)+z = input.int(title='period', defval=32)n2ma = 2 * ta.wma(close, math.round(z / 2))⋯//-showZones = input(true, title='Show Bullish/Bearish Zones')+showZones = input.bool(true, title='Show Bullish/Bearish Zones')// bullish signal rule: ⋯//indicator('G-Channel Trend Detection', shorttitle='G-Trend', overlay=true)-lengthG = input(100, group="G-Channel Trend Detection")+lengthG = input.int(100, group="G-Channel Trend Detection")-src = input(ohlc4)+src = input.source(ohlc4)//----⋯adxEnabled = input.bool(defval = true , title = "Average Directional Index (ADX)", tooltip = "", group ="ADX" ) -adxlen = input(14, title="ADX Smoothing", group="ADX")+adxlen = input.int(14, title="ADX Smoothing", group="ADX")-adxdilen = input(14, title="DI Length", group="ADX")+adxdilen = input.int(14, title="DI Length", group="ADX")-adxabove = input(25, title="ADX Threshold", group="ADX")+adxabove = input.int(25, title="ADX Threshold", group="ADX")adxdirmov(len) =>⋯    strategy.exit('TP4', profit=per(tp4))-    strategy.close('Long', qty_percent=100, comment='SL Long', when=slLongClose)+    if slLongClose+        strategy.close('Long', qty_percent=100, comment='SL Long')-    strategy.close('Short', qty_percent=100, comment='SL Short', when=slShortClose)+    if slShortClose+        strategy.close('Short', qty_percent=100, comment='SL Short')-    strategy.close_all(when=closeLongCondition or closeShortCondition, comment='Close Postion')+    if closeLongCondition or closeShortCondition+        strategy.close_all(comment='Close Postion')/// Dashboard⋯

Does it run in Pine Script v6?

No

The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L231:C49: 'plot' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © myn-//@version=5+//@version=6strategy('Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN]', max_bars_back=5000, overlay=true, pyramiding=0, initial_capital=1000, currency='USD', default_qty_type=strategy.percent_of_equity, default_qty_value=1.0, commission_value=0.075, use_bar_magnifier = false)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 144 msWith a workaround 1,000 bars in 267 msNot measured
PineTSNot testedNot testedNot measured

The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.

“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/// © myn//@version=5strategy('Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN]', max_bars_back=5000, overlay=true, pyramiding=0, initial_capital=1000, currency='USD', default_qty_type=strategy.percent_of_equity, default_qty_value=1.0, commission_value=0.075, use_bar_magnifier = false)///////////////////////////////////////* Put your strategy logic below *///////////////////////////////////////// Q0txMfU623Y// Trading Rules// 15m - 4 hours.  Ideal 1 hour// Poki // Remove color plots// Change ATR to 30// Use Buy/Sell indicators as confirmation//  G-TREND// Use color to confirm signal with POKI buy/sell indicators// To get better results had to:// Add an ADX confirmation// Changed G-Trend to use OHLC4// TP at 2% / SL 15%//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░//@version=5//indicator('poki', shorttitle='poki', overlay=true)// Parabolic SARstartMult = input.int(3, minval=0, maxval=10, title='Start - Default = 2 - Multiplied by .01', group="POKI")increment = input.int(3, minval=0, maxval=10, title='Step Setting (Sensitivity) - Default = 2 - Multiplied by .01')maximum = input.int(3, minval=1, maxval=10, title='Maximum Step (Sensitivity) - Default = 2 - Multiplied by .10')sus = input(true, 'Show Up Trending Parabolic Sar')sds = input(true, 'Show Down Trending Parabolic Sar')disc = input(false, title='Start and Step settings are *.01 so 2 = .02 etc, Maximum Step is *.10 so 2 = .2')startCalc = startMult * .01incrementCalc = increment * .01maximumCalc = maximum * .10sarUp = ta.sar(startCalc, incrementCalc, maximumCalc)sarDown = ta.sar(startCalc, incrementCalc, maximumCalc)colUp = close >= sarDown ? color.blue : nacolDown = close <= sarUp ? color.red : na//plot(sus and sarUp ? sarUp : na, title='Up Trending SAR', style=plot.style_circles, linewidth=2, color=colUp)//plot(sds and sarDown ? sarDown : na, title='Up Trending SAR', style=plot.style_circles, linewidth=2, color=colDown)// Inputclose_price = close[0]len = input.int(defval=50, minval=1, title='Linear Regression length')linear_reg = ta.linreg(close_price, len, 0)linear_reg_prev = ta.linreg(close[1], len, 0)slope = (linear_reg - linear_reg_prev) / timeframe.multiplierlength = input.int(title='Bollinger Length', defval=20, minval=1)multiplier = input.float(title='Bollinger Deviation', defval=2, minval=1)overbought = input.int(title='Overbought', defval=1, minval=1)oversold = input.int(title='Oversold', defval=0, minval=0)custom_timeframe = input(title='Use another Timeframe?', defval=false)highTimeFrame = input.timeframe(title='Select The Timeframe', defval='60')res1 = custom_timeframe ? highTimeFrame : timeframe.periodsmabasis = ta.sma(close, length)stdev = ta.stdev(close, length)cierre = request.security(syminfo.tickerid, res1, close, barmerge.gaps_off)alta = request.security(syminfo.tickerid, res1, high, barmerge.gaps_off)baja = request.security(syminfo.tickerid, res1, low, barmerge.gaps_off)basis1 = request.security(syminfo.tickerid, res1, smabasis, barmerge.gaps_off)stdevb = request.security(syminfo.tickerid, res1, stdev, barmerge.gaps_off)dev = multiplier * stdevb  // stdev(cierre, length)upper = basis1 + devlower = basis1 - devbbr = (cierre - lower) / (upper - lower)// plot(bbr)// // MARCA LAS RESISTENCIASpintarojo = 0.0pintarojo := nz(pintarojo[1])pintarojo := bbr[1] > overbought and bbr < overbought ? alta[1] : nz(pintarojo[1])//p = plot(pintarojo, color=color.new(color.red, 0), style=plot.style_circles, linewidth=2)// // MARCA LOS SOPORTESpintaverde = 0.0pintaverde := nz(pintaverde[1])pintaverde := bbr[1] < oversold and bbr > oversold ? baja[1] : nz(pintaverde[1])//g = plot(pintaverde, color=color.new(color.blue, 0), style=plot.style_circles, linewidth=2)//method = input.string(defval='Traditional', options=['ATR', 'Traditional', 'Part of Price'], title='Renko Assignment Method')methodvalue = input.float(defval=29, minval=0, title='Value')pricesource = input.string(defval='Close', options=['Close', 'Open / Close', 'High / Low'], title='Price Source')useClose = pricesource == 'Close'useOpenClose = pricesource == 'Open / Close' or useCloseuseTrueRange = input.string(defval='Auto', options=['Always', 'Auto', 'Never'], title='Use True Range instead of Volume')isOscillating = input(defval=true, title='Oscillating')normalize = input(defval=false, title='Normalize')vol = useTrueRange == 'Always' or useTrueRange == 'Auto' and na(volume) ? ta.tr : volumeop = useClose ? close : openhi = useOpenClose ? close >= op ? close : op : highlo = useOpenClose ? close <= op ? close : op : lowif method == 'ATR'    methodvalue := ta.atr(math.round(methodvalue))    methodvalueif method == 'Part of Price'    methodvalue := close / methodvalue    methodvaluecurrclose = float(na)prevclose = nz(currclose[1])prevhigh = prevclose + methodvalueprevlow = prevclose - methodvaluecurrclose := hi > prevhigh ? hi : lo < prevlow ? lo : prevclosedirection = int(na)direction := currclose > prevclose ? 1 : currclose < prevclose ? -1 : nz(direction[1])directionHasChanged = ta.change(direction) != 0directionIsUp = direction > 0directionIsDown = direction < 0barcount = 1barcount := not directionHasChanged and normalize ? barcount[1] + barcount : barcountvol := not directionHasChanged ? vol[1] + vol : volres = barcount > 1 ? vol / barcount : volx = isOscillating and directionIsDown ? -res : res//z = input(title='period', defval=32)n2ma = 2 * ta.wma(close, math.round(z / 2))nma = ta.wma(close, z)diff = n2ma - nmasqn = math.round(math.sqrt(z))n2ma1 = 2 * ta.wma(close[1], math.round(z / 2))nma1 = ta.wma(close[1], z)diff1 = n2ma1 - nma1sqn1 = math.round(math.sqrt(z))n1 = ta.wma(diff, sqn)n2 = ta.wma(diff1, sqn)c = n1 > n2 ? color.green : color.red// ConditionslongCondPOKI = bool(na)shortCondPOKI = bool(na)longCondPOKI := ta.crossover(x, 0)shortCondPOKI := ta.crossunder(x, 0)// Count your long short conditions for more control with Pyramiding// sectionLongs = 0// sectionLongs := nz(sectionLongs[1])// sectionShorts = 0// sectionShorts := nz(sectionShorts[1])// if longCond//     sectionLongs += 1//     sectionShorts := 0//     sectionShorts// if shortCond//     sectionLongs := 0//     sectionShorts += 1//     sectionShorts// Pyramiding// pyrl = 1// These check to see your signal and cross references it against the pyramiding settings above// longCondition = longCond and sectionLongs <= pyrl// shortCondition = shortCond and sectionShorts <= pyrl// Get the price of the last opened long or short// last_open_longCondition = float(na)// last_open_shortCondition = float(na)// last_open_longCondition := longCondition ? open : nz(last_open_longCondition[1])// last_open_shortCondition := shortCondition ? open : nz(last_open_shortCondition[1])// // Check if your last postion was a long or a short// last_longCondition = float(na)// last_shortCondition = float(na)// last_longCondition := longCondition ? time : nz(last_longCondition[1])// last_shortCondition := shortCondition ? time : nz(last_shortCondition[1])// in_longCondition = last_longCondition > last_shortCondition// in_shortCondition = last_shortCondition > last_longCondition// // Take profit// isTPl = input(false, 'Take Profit Long')// isTPs = input(false, 'Take Profit Short')// tp = input.float(2, 'Take Profit %')// long_tp = isTPl and ta.crossover(high, (1 + tp / 100) * last_open_longCondition) and longCondition == 0 and in_longCondition == 1// short_tp = isTPs and ta.crossunder(low, (1 - tp / 100) * last_open_shortCondition) and shortCondition == 0 and in_shortCondition == 1// // Stop Loss// isSLl = input(false, 'Stop Loss Long')// isSLs = input(false, 'Stop Loss Short')// sl = 0.0// sl := input.float(3, 'Stop Loss %')// long_sl = isSLl and ta.crossunder(low, (1 - sl / 100) * last_open_longCondition) and longCondition == 0 and in_longCondition == 1// short_sl = isSLs and ta.crossover(high, (1 + sl / 100) * last_open_shortCondition) and shortCondition == 0 and in_shortCondition == 1// // Create a single close for all the different closing conditions.// long_close = long_tp or long_sl ? 1 : 0// short_close = short_tp or short_sl ? 1 : 0// // Get the time of the last close// last_long_close = float(na)// last_short_close = float(na)// last_long_close := long_close ? time : nz(last_long_close[1])// last_short_close := short_close ? time : nz(last_short_close[1])//showZones = input(true, title='Show Bullish/Bearish Zones')// bullish signal rule: bullishRule = n1 > linear_reg// bearish signal rule: bearishRule = n1 <= linear_reg// current trading StateruleState = 0ruleState := bullishRule ? 1 : bearishRule ? -1 : nz(ruleState[1])//bgcolor(showZones ? ruleState == 1 ? color.blue : ruleState == -1 ? color.red : color.gray : na, title=' Bullish/Bearish Zones', transp=90)// Alerts & Signals// bton(b) =>//     b ? 1 : 0plotshape(longCondPOKI, title='Buy Signal', text='B', style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), editable=false)plotshape(shortCondPOKI, title='Sell Signal', text='S', style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), editable=false)//plotshape(long_tp and last_longCondition > nz(last_long_close[1]), text='TP', title='Take Profit Long', style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), editable=false)//plotshape(short_tp and last_shortCondition > nz(last_short_close[1]), text='TP', title='Take Profit Short', style=shape.triangleup, location=location.belowbar, color=color.new(color.lime, 0), editable=false)//ltp = long_tp and last_longCondition > nz(last_long_close[1]) ? (1 + tp / 100) * last_open_longCondition : na//plot(ltp, style=plot.style_cross, linewidth=3, color=color.new(color.white, 0), editable=false)//stp = short_tp and last_shortCondition > nz(last_short_close[1]) ? (1 - tp / 100) * last_open_shortCondition : na//plot(stp, style=plot.style_cross, linewidth=3, color=color.new(color.white, 0), editable=false)//plotshape(long_sl and last_longCondition > nz(last_long_close[1]), text='SL', title='Stop Loss Long', style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), editable=false)//plotshape(short_sl and last_shortCondition > nz(last_short_close[1]), text='SL', title='Stop Loss Short', style=shape.triangleup, location=location.belowbar, color=color.new(color.lime, 0), editable=false)//lsl = long_sl and last_longCondition > nz(last_long_close[1]) ? (1 - sl / 100) * last_open_longCondition : na//plot(lsl, style=plot.style_cross, linewidth=3, color=color.new(color.white, 0), editable=false)//ssl = short_sl and last_shortCondition > nz(last_short_close[1]) ? (1 + sl / 100) * last_open_shortCondition : na//plot(ssl, style=plot.style_cross, linewidth=3, color=color.new(color.white, 0), editable=false)// alertcondition(bton(longCondition), title='Buy Alert')// alertcondition(bton(shortCondition), title='Sell Alert')// alertcondition(bton(long_tp and last_longCondition > nz(last_long_close[1])), title='Take Profit Long')// alertcondition(bton(short_tp and last_shortCondition > nz(last_short_close[1])), title='Take Profit Short')// alertcondition(bton(long_sl and last_longCondition > nz(last_long_close[1])), title='Stop Loss Long')// alertcondition(bton(short_sl and last_shortCondition > nz(last_short_close[1])), title='Stop Loss Short')/// G-Channel Trend Detection//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░//@version=5//Full credit to AlexGrover: https://www.tradingview.com/script/fIvlS64B-G-Channels-Efficient-Calculation-Of-Upper-Lower-Extremities///indicator('G-Channel Trend Detection', shorttitle='G-Trend', overlay=true)lengthG = input(100, group="G-Channel Trend Detection")src = input(ohlc4)//----a = 0.b = 0.a := math.max(src, nz(a[1])) - nz(a[1] - b[1]) / lengthGb := math.min(src, nz(b[1])) + nz(a[1] - b[1]) / lengthGavg = math.avg(a, b)//----crossup = b[1] < close[1] and b > closecrossdn = a[1] < close[1] and a > closebullish = ta.barssince(crossdn) <= ta.barssince(crossup)cG = bullish ? color.lime : color.red//plot(a,"Upper",color=color.blue,linewidth=2,transp=100)//plot(b,"Lower",color=color.blue,linewidth=2,transp=100)p1 = plot(avg, 'Average', color=cG, linewidth=1, transp=100)p2 = plot(close, 'Close price', color=cG, linewidth=1, transp=100)fill(p1, p2, color=cG, transp=90)//showcross = input(true)//plotshape(showcross and not bullish and bullish[1] ? avg : na, location=location.absolute, style=shape.labeldown, color=color.new(color.red, 0), size=size.tiny, text='Sell', textcolor=color.new(#ffffff, 0), offset=-1)//plotshape(showcross and bullish and not bullish[1] ? avg : na, location=location.absolute, style=shape.labelup, color=color.new(color.lime, 0), size=size.tiny, text='Buy', textcolor=color.new(#ffffff, 0), offset=-1)longCondGTrend = bullishshortCondGTrend = not bullish////////////////////////////////////////* Put your strategy rules below *///////////////////////////////////////longCondition = longCondPOKI and longCondGTrendshortCondition = shortCondPOKI and shortCondGTrend//define as 0 if do not want to usecloseLongCondition = 0closeShortCondition = 0// ADX//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░adxEnabled = input.bool(defval = true , title = "Average Directional Index (ADX)", tooltip = "", group ="ADX" ) adxlen = input(14, title="ADX Smoothing", group="ADX")adxdilen = input(14, title="DI Length", group="ADX")adxabove = input(25, title="ADX Threshold", group="ADX")adxdirmov(len) =>    adxup = ta.change(high)    adxdown = -ta.change(low)    adxplusDM = na(adxup) ? na : (adxup > adxdown and adxup > 0 ? adxup : 0)    adxminusDM = na(adxdown) ? na : (adxdown > adxup and adxdown > 0 ? adxdown : 0)    adxtruerange = ta.rma(ta.tr, len)    adxplus = fixnan(100 * ta.rma(adxplusDM, len) / adxtruerange)    adxminus = fixnan(100 * ta.rma(adxminusDM, len) / adxtruerange)    [adxplus, adxminus]adx(adxdilen, adxlen) =>    [adxplus, adxminus] = adxdirmov(adxdilen)    adxsum = adxplus + adxminus    adx = 100 * ta.rma(math.abs(adxplus - adxminus) / (adxsum == 0 ? 1 : adxsum), adxlen)adxsig = adxEnabled ? adx(adxdilen, adxlen) : naisADXEnabledAndAboveThreshold = adxEnabled ? (adxsig > adxabove) : true//Backtesting Time Period (Input.time not working as expected as of 03/30/2021.  Giving odd start/end dates//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░useStartPeriodTime = input.bool(true, 'Start', group='Date Range', inline='Start Period')startPeriodTime = input.time(timestamp('1 Jan 2019'), '', group='Date Range', inline='Start Period')useEndPeriodTime = input.bool(true, 'End', group='Date Range', inline='End Period')endPeriodTime = input.time(timestamp('31 Dec 2030'), '', group='Date Range', inline='End Period')start = useStartPeriodTime ? startPeriodTime >= time : falseend = useEndPeriodTime ? endPeriodTime <= time : falsecalcPeriod = not start and not end// Trade Direction // ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tradeDirection = input.string('Long and Short', title='Trade Direction', options=['Long and Short', 'Long Only', 'Short Only'], group='Trade Direction')// Percent as Points// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░per(pcnt) =>    strategy.position_size != 0 ? math.round(pcnt / 100 * strategy.position_avg_price / syminfo.mintick) : float(na)// Take profit 1// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tp1 = input.float(title='Take Profit 1 - Target %', defval=2, minval=0.0, step=0.5, group='Take Profit', inline='Take Profit 1')q1 = input.int(title='% Of Position', defval=100, minval=0, group='Take Profit', inline='Take Profit 1')// Take profit 2// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tp2 = input.float(title='Take Profit 2 - Target %', defval=100, minval=0.0, step=0.5, group='Take Profit', inline='Take Profit 2')q2 = input.int(title='% Of Position', defval=100, minval=0, group='Take Profit', inline='Take Profit 2')// Take profit 3// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tp3 = input.float(title='Take Profit 3 - Target %', defval=100, minval=0.0, step=0.5, group='Take Profit', inline='Take Profit 3')q3 = input.int(title='% Of Position', defval=100, minval=0, group='Take Profit', inline='Take Profit 3')// Take profit 4// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tp4 = input.float(title='Take Profit 4 - Target %', defval=100, minval=0.0, step=0.5, group='Take Profit')/// Stop Loss// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░stoplossPercent = input.float(title='Stop Loss (%)', defval=9, minval=0.01, group='Stop Loss') * 0.01slLongClose = close < strategy.position_avg_price * (1 - stoplossPercent)slShortClose = close > strategy.position_avg_price * (1 + stoplossPercent)/// Leverage// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░leverage = input.float(1, 'Leverage', step=.5, group='Leverage')contracts = math.min(math.max(.000001, strategy.equity / close * leverage), 1000000000)/// Trade State Management// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░isInLongPosition = strategy.position_size > 0isInShortPosition = strategy.position_size < 0/// ProfitView Alert Syntax String Generation// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░alertSyntaxPrefix = input.string(defval='CRYPTANEX_99FTX_Strategy-Name-Here', title='Alert Syntax Prefix', group='ProfitView Alert Syntax')alertSyntaxBase = alertSyntaxPrefix + '\n#' + str.tostring(open) + ',' + str.tostring(high) + ',' + str.tostring(low) + ',' + str.tostring(close) + ',' + str.tostring(volume) + ','/// Trade Execution// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░longConditionCalc = (longCondition and isADXEnabledAndAboveThreshold)shortConditionCalc = (shortCondition and isADXEnabledAndAboveThreshold)if calcPeriod    if longConditionCalc and tradeDirection != 'Short Only' and isInLongPosition == false        strategy.entry('Long', strategy.long, qty=contracts)        alert(message=alertSyntaxBase + 'side:long', freq=alert.freq_once_per_bar_close)    if shortConditionCalc and tradeDirection != 'Long Only' and isInShortPosition == false        strategy.entry('Short', strategy.short, qty=contracts)        alert(message=alertSyntaxBase + 'side:short', freq=alert.freq_once_per_bar_close)        //Inspired from Multiple %% profit exits example by adolgo https://www.tradingview.com/script/kHhCik9f-Multiple-profit-exits-example/    strategy.exit('TP1', qty_percent=q1, profit=per(tp1))    strategy.exit('TP2', qty_percent=q2, profit=per(tp2))    strategy.exit('TP3', qty_percent=q3, profit=per(tp3))    strategy.exit('TP4', profit=per(tp4))    strategy.close('Long', qty_percent=100, comment='SL Long', when=slLongClose)    strategy.close('Short', qty_percent=100, comment='SL Short', when=slShortClose)    strategy.close_all(when=closeLongCondition or closeShortCondition, comment='Close Postion')/// Dashboard// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░// Inspired by https://www.tradingview.com/script/uWqKX6A2/ - Thanks VertMTshowDashboard = input.bool(group="Dashboard", title="Show Dashboard", defval=true)f_fillCell(_table, _column, _row, _title, _value, _bgcolor, _txtcolor) =>    _cellText = _title + "\n" + _value    table.cell(_table, _column, _row, _cellText, bgcolor=_bgcolor, text_color=_txtcolor, text_size=size.auto)// Draw dashboard tableif showDashboard    var bgcolor = color.new(color.black,0)        // Keep track of Wins/Losses streaks    newWin  = (strategy.wintrades  > strategy.wintrades[1]) and (strategy.losstrades == strategy.losstrades[1]) and (strategy.eventrades == strategy.eventrades[1])    newLoss = (strategy.wintrades == strategy.wintrades[1]) and (strategy.losstrades  > strategy.losstrades[1]) and (strategy.eventrades == strategy.eventrades[1])    varip int winRow     = 0    varip int lossRow    = 0    varip int maxWinRow  = 0    varip int maxLossRow = 0    if newWin        lossRow := 0        winRow := winRow + 1    if winRow > maxWinRow        maxWinRow := winRow            if newLoss        winRow := 0        lossRow := lossRow + 1    if lossRow > maxLossRow        maxLossRow := lossRow    // Prepare stats table    var table dashTable = table.new(position.bottom_right, 1, 15, border_width=1)           if barstate.islastconfirmedhistory        // Update table        dollarReturn = strategy.netprofit        f_fillCell(dashTable, 0, 0, "Start:", str.format("{0,date,long}", strategy.closedtrades.entry_time(0)) , bgcolor, color.white) // + str.format(" {0,time,HH:mm}", strategy.closedtrades.entry_time(0))         f_fillCell(dashTable, 0, 1, "End:", str.format("{0,date,long}", strategy.opentrades.entry_time(0)) , bgcolor, color.white) // + str.format(" {0,time,HH:mm}", strategy.opentrades.entry_time(0))        _profit = (strategy.netprofit / strategy.initial_capital) * 100        f_fillCell(dashTable, 0, 2, "Net Profit:", str.tostring(_profit, '##.##') + "%", _profit > 0 ? color.green : color.red, color.white)        _numOfDaysInStrategy = (strategy.opentrades.entry_time(0) - strategy.closedtrades.entry_time(0)) / (1000 * 3600 * 24)        f_fillCell(dashTable, 0, 3, "Percent Per Day", str.tostring(_profit / _numOfDaysInStrategy, '#########################.#####')+"%", _profit > 0 ? color.green : color.red, color.white)        _winRate = ( strategy.wintrades / strategy.closedtrades ) * 100        f_fillCell(dashTable, 0, 4, "Percent Profitable:", str.tostring(_winRate, '##.##') + "%", _winRate < 50 ? color.red : _winRate < 75 ? #999900 : color.green, color.white)        f_fillCell(dashTable, 0, 5, "Profit Factor:", str.tostring(strategy.grossprofit / strategy.grossloss,  '##.###'), strategy.grossprofit > strategy.grossloss ? color.green : color.red, color.white)        f_fillCell(dashTable, 0, 6, "Total Trades:", str.tostring(strategy.closedtrades), bgcolor, color.white)        f_fillCell(dashTable, 0, 8, "Max Wins In A Row:", str.tostring(maxWinRow, '######') , bgcolor, color.white)        f_fillCell(dashTable, 0, 9, "Max Losses In A Row:", str.tostring(maxLossRow, '######') , bgcolor, color.white)