Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Strategy Myth-Busting #6 - PSAR+MA+SQZMOM+HVI - [MYN]

A Pine Script v5 strategy built on SAR (startPSAR, increment), SMA (source, 20) and Stdev (source, 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 100.0% of equity and pays 0.075 commission. 79 settings; defaults include Trend Code (If Overriding Adaptive PSAR) 5, BB Length 20 and BB MultFactor 2.0.

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 #6 - PSAR+MA+SQZMOM+HVI - [MYN] repaint?
Yes
At least one pattern in the source can repaint: intrabar recalculation.
How did Strategy Myth-Busting #6 - PSAR+MA+SQZMOM+HVI - [MYN] do on BTCUSDT 1D with default settings?
−94.42%
From 26 Jan 2024 to 21 Oct 2026, over 2 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
What alerts does Strategy Myth-Busting #6 - PSAR+MA+SQZMOM+HVI - [MYN] have?
2
alertSyntaxBase + 'side:long'; alertSyntaxBase + 'side:short'.
Does Strategy Myth-Busting #6 - PSAR+MA+SQZMOM+HVI - [MYN] run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L52:C92: '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 #6 - PSAR+MA+SQZMOM+HVI - [MYN] use a stop loss?
No
Its exits set a profit target but no stop.

BTCUSDT · 1D · default settings

  • PSAR
  • MA 1
  • MA 2
  • 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 (69)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,114$40,505Equity from $20,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: long1725667200000
End: long1769731200000
Net Profit: -94.42%
Percent Per Day -0.18514%
Percent Profitable: 0%
Profit Factor: 0
Total Trades: 2
Max Wins In A Row: 0
Max Losses In A Row: 2
Net profit
−94.42%
−$18,883.80
Buy and hold
+102.5%
same period
Closed trades
2
0 won · 2 lost
Profitable
0.0%
of closed trades
Profit factor
0.00
gross profit ÷ gross loss
Max drawdown
100.87%
−$20,173.30

One run with the author's default settings, $20,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

    1 setting does nothing

    “BB MultFactor” is declared but never read.

  • Check

    No stop loss

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

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    34 settings have no label

    In the settings dialog plot_ma_1 (line 100), ma_1_val (line 102), ma1_tf (line 103), plot_ma_2 (line 105), ma_2_val (line 107), ma2_tf (line 108), plot_ma_3 (line 110), ma_3_val (line 112), ma3_tf (line 113), plot_ma_4 (line 115), ma_4_val (line 117), ma4_tf (line 118), plot_ma_5 (line 120), ma_5_val (line 122), ma5_tf (line 123), plot_ma_6 (line 125), ma_6_val (line 127), ma_6_src (line 128), plot_ma_7 (line 130), ma_7_val (line 132), ma_7_src (line 133), plot_ma_8 (line 135), ma_8_val (line 137), ma_8_src (line 138), plot_ma_9 (line 140), ma_9_val (line 142), ma_9_src (line 143), plot_ma_10 (line 145), ma_10_val (line 147), ma_10_src (line 148), lengthhvi (line 199), divisor (line 203), startPeriodTime (line 257), endPeriodTime (line 259) 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 319, 320, 321. 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
Adaptive Parabolic Sar
Override Adaptive PSARfalseboolmaximum
Trend Code (If Overriding Adaptive PSAR)5intmaximum
BB MultFactor2.0floatunused
KC Length20intma rangema val
KC MultFactor1.5floatdev upperKC lowerKC
Use TrueRange (KC)trueboolrange_1
Divisor (no label in the script)1intu1 d1
Squeeze Momentum
BB Length20intbasis dev
Multi Timeframe Moving Averages
Plot ma 1 (no label in the script)trueboolma_1 MA 1
MA 1EMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_1
MA 1 val (no label in the script)200int · min 1ma_1
Ma1 tf (no label in the script)timeframema_1
MA 1 colour (no label in the script)color.greencolorMA 1
Plot ma 2 (no label in the script)trueboolma_2 MA 2
MA 2 SMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_2
MA 2 val (no label in the script)50int · min 1ma_2
Ma2 tf (no label in the script)timeframema_2
MA 2 colour (no label in the script)color.yellowcolorMA 2
Plot ma 3 (no label in the script)falseboolma_3 MA 3
MA 3 SMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_3
MA 3 val (no label in the script)1int · min 1ma_3
Ma3 tf (no label in the script)timeframema_3
MA 3 colour (no label in the script)color.blackcolorMA 3
Plot ma 4 (no label in the script)falseboolma_4 MA 4
MA 4 SMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_4
MA 4 val (no label in the script)1int · min 1ma_4
Ma4 tf (no label in the script)timeframema_4
MA 4 colour (no label in the script)color.blackcolorMA 4
Plot ma 5 (no label in the script)falseboolma_5 MA 5
MA 5 SMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_5
MA 5 val (no label in the script)1int · min 1ma_5
Ma5 tf (no label in the script)timeframema_5
MA 5 colour (no label in the script)color.blackcolorMA 5
Normal Moving Averages
Plot ma 6 (no label in the script)falseboolma_6 MA 6
MA 6 SMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_6
MA 6 val (no label in the script)1int · min 1ma_6
MA 6 src (no label in the script)closesourcema_6
MA 6 colour (no label in the script)color.blackcolorMA 6
Plot ma 7 (no label in the script)falseboolma_7 MA 7
MA 7 SMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_7
MA 7 val (no label in the script)1int · min 1ma_7
MA 7 src (no label in the script)closesourcema_7
MA 7 colour (no label in the script)color.blackcolorMA 7
Plot ma 8 (no label in the script)falseboolma_8 MA 8
MA 8SMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_8
MA 8 val (no label in the script)1int · min 1ma_8
MA 8 src (no label in the script)closesourcema_8
MA 8 colour (no label in the script)color.blackcolorMA 8
Plot ma 9 (no label in the script)falseboolma_9 MA 9
MA 9 SMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_9
MA 9 val (no label in the script)1int · min 1ma_9
MA 9 src (no label in the script)closesourcema_9
MA 9 colour (no label in the script)color.blackcolorMA 9
Plot ma 10 (no label in the script)falseboolma_10 MA 10
MA 10SMAstring · options ['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA']ma_10
MA 10 val (no label in the script)1int · min 1ma_10
MA 10 src (no label in the script)closesourcema_10
MA 10 colour (no label in the script)color.blackcolorMA 10
HawkEye Volume Indicator
Lengthhvi (no label in the script)200intrangeAvg volumeA
ADX
Average Directional Index (ADX)falsebooladxsig 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 307 line 310
Take Profit
Take Profit 1 - Target %100float · 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 (%)999float · min 0.01slLongClose slShortClose
Leverage
Leverage1float · step .5contracts
ProfitView Alert Syntax
Alert Syntax PrefixCRYPTANEX_99FTX_Strategy-Name-HerestringalertSyntaxBase
Dashboard
Show Dashboardtrueboolline 330

What it calculates

  • SARstartPSAR, increment, maximumpsar · line 49
  • SMAsource, BB Length (20)basis · line 71
  • Stdevsource, BB Length (20)dev · line 72
  • SMAsource, KC Length (20)ma · line 76
  • TRrange_1 · line 77
  • SMArange_1, KC Length (20)rangema · line 78
  • Linreg / Highest / Lowest / SMAsource - math.avg(math.avg(ta.highest(high, lengthKC), ta.lowest(low, lengthKC)), ta.sma(close, lengthKC)), KC Length (20), 0val · line 84
  • SMArange_1HVI, Lengthhvi (200)rangeAvg · line 201
  • SMAvolume, Lengthhvi (200)volumeA · line 202
  • Changehighadxup · line 240
  • Changelowadxdown · line 241
  • RMAta.tr, lenadxtruerange · line 244
  • RMAmath.abs(adxplus - adxminus) / (adxsum == 0 ? 1 : adxsum), ADX Smoothing (14)adx · line 251

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 142 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 == falseOn308
Open Short shortshortConditionCalc and tradeDirection != 'Long Only' and isInShortPosition == falseOn311
Exit TP1 limitcalcPeriodOn315
Exit TP2 limitcalcPeriodOn316
Exit TP3 limitcalcPeriodOn317
Exit TP4 limitcalcPeriodOn318
Close LongslLongCloseclose < strategy.position_avg_price * (1 - stoplossPercent)On319
Close ShortslShortCloseclose > strategy.position_avg_price * (1 + stoplossPercent)On320
Close closeLongCondition or closeShortConditionOn321

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'309
(no title)alertalertSyntaxBase + 'side:short'312

Does it repaint?

Yes

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

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • 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−94.4%+102.5%20%0.00100.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−35.4%+5.5%10%0.0039.6%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+1.5%+9.8%1100%20.838.2%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+27.1%+8.4%1100%285.074.4%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−45.1%+16.7%10%0.0086.7%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−38.8%+21.5%250%0.0143.2%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+32.2%+148.3%250%1.4839.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−9.3%+17.1%10%0.0013.6%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 market10%−$265.36
Sideways market0—$0.00
Falling market10%−$18,617.60

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

How bad could the drawdown be?

94.4%

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

0%109%
All 2 trades
SideEntryExitBarsP&L
short7 Sep 2024 53,963.0018 Jan 2025 104,077.00133−$18,617.60
long18 Jan 2025 104,077.0030 Jan 2026 84,650.20377−$265.36

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 #6 - PSAR+MA+SQZMOM+HVI - [MYN] this page—v5 strategy−94.4%2100.9%
Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN] by myncryptosar linreg sma stdev tr rmav5 strategy−23.4%7344.0%
ATR GOD Strategy by TradeSmart (PineConnector-compatible) by TradeSmart22tr lowest highest sma stdev rmav5 strategyNo trades on this market
VixFixLinReg-Strategy by Trendoscopehighest stdev sma lowest linregv4 strategy−49.3%1251.1%
BT-SAR Ema, Squeeze, Volatility by Credsonbsar stdev sma tr linreg lowestv5 strategy+3.5%1411.5%
Strategy Myth-Busting #7 - MACDBB+SSL+VSF - [MYN] by myncryptostdev sma tr highest lowest rmav5 strategyNo trades on this market

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 319, 320, 321). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 12 settings use the untyped input() (line 44, 45, 64, 65, 66, 67, 68, 199, 203, 236, 237, 238). 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 2 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 44: input() → input.bool()
  • Line 45: input() → input.int()
  • Line 64: input() → input.int()
  • Line 65: input() → input.float()
  • Line 66: input() → input.int()
  • Line 67: input() → input.float()
9 more edits
  • Line 68: input() → input.bool()
  • Line 199: input() → input.int()
  • Line 203: input() → input.int()
  • Line 236: input() → input.int()
  • Line 237: input() → input.int()
  • Line 238: input() → input.int()
  • Line 319: when = slLongClose → if block
  • Line 320: when = slShortClose → if block
  • Line 321: when = closeLongCondition or closeShortCondition → if block
⋯        int(4)-bool overrideAdaptiveSar = input(false, title="Override Adaptive PSAR", group="Adaptive Parabolic Sar")+bool overrideAdaptiveSar = input.bool(false, title="Override Adaptive PSAR", group="Adaptive Parabolic Sar")-TrendCodeOverRide = input(5, title='Trend Code (If Overriding Adaptive PSAR)')+TrendCodeOverRide = input.int(5, title='Trend Code (If Overriding Adaptive PSAR)')startPSAR = 0.02⋯//indicator(shorttitle='SQZMOM_LB', title='Squeeze Momentum Indicator [LazyBear]', overlay=false)-lengthBB = input(20, title='BB Length', group="Squeeze Momentum")+lengthBB = input.int(20, title='BB Length', group="Squeeze Momentum")-mult = input(2.0, title='BB MultFactor')+mult = input.float(2.0, title='BB MultFactor')-lengthKC = input(20, title='KC Length')+lengthKC = input.int(20, title='KC Length')-multKC = input(1.5, title='KC MultFactor')+multKC = input.float(1.5, title='KC MultFactor')-useTrueRange = input(true, title='Use TrueRange (KC)')+useTrueRange = input.bool(true, title='Use TrueRange (KC)')// Calculate BB⋯//indicator('HawkEye Volume Indicator [LazyBear]', shorttitle='HVI_LB')-lengthhvi = input(200, group="HawkEye Volume Indicator")+lengthhvi = input.int(200, group="HawkEye Volume Indicator")range_1HVI = high - low⋯volumeA = ta.sma(volume, lengthhvi)-divisor = input(1)+divisor = input.int(1)high1 = high[1]⋯adxEnabled = input.bool(defval = false , 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 @L52:C92: '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 #6 - PSAR+MA+SQZMOM+HVI - [MYN]', max_bars_back=5000, overlay=true, pyramiding=0, initial_capital=20000, currency='USD', default_qty_type=strategy.percent_of_equity, default_qty_value=100.0, commission_value=0.075, use_bar_magnifier = false)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 220 msWith a workaround 1,000 bars in 280 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 #6 - PSAR+MA+SQZMOM+HVI - [MYN]', max_bars_back=5000, overlay=true, pyramiding=0, initial_capital=20000, currency='USD', default_qty_type=strategy.percent_of_equity, default_qty_value=100.0, commission_value=0.075, use_bar_magnifier = false)///////////////////////////////////////* Put your strategy logic below *///////////////////////////////////////// dOg28adjYWY//Trading Strategies Used// Parabolic Sar// 10 in 1 MA's// Squeeze Momentum// HawkEYE Volume Indicator// Long Condition// Parabolic Sar shift below price at last dot above and then previous bar needs to breach above that.// Price action has to be below both MA's and 50MA needs to be above 200MA// Squeeze Momentum needsd to be in green or close to going green// HawkEYE Volume Indicator needs to be show a green bar on the histagram// Short Condition// Parabolic Sar shift above price at last dot below and then previous bar needs to breach below that.// Price action needs to be above both MA's and 50MA needs to be below 200MA// Squeeze Momentum needsd to be in red or close to going red// HawkEYE Volume Indicator needs to be show a red bar on the histagram// Parabolic SAR//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░// Functions// Dynamic Max based on trendcodeint trendCodeAdaptive = switch timeframe.multiplier    1 => 1    3 => 1    5 => 1    10 => 2    15 => 3    30 => 5    45 => 5    60 => 7    120 => 9    180 => 9    240 => 13    300 => 14    360 => 15    =>        int(4)bool overrideAdaptiveSar = input(false, title="Override Adaptive PSAR", group="Adaptive Parabolic Sar")TrendCodeOverRide = input(5, title='Trend Code (If Overriding Adaptive PSAR)')startPSAR = 0.02increment = 0.02maximum = overrideAdaptiveSar ? TrendCodeOverRide * 0.005 :  trendCodeAdaptive * 0.005psar = ta.sar(startPSAR, increment, maximum)dir = psar < close ? 1 : -1psarColor = dir == 1 ? #00c3ff : #ff0062psarPlot = plot(psar, title='PSAR', style=plot.style_circles, linewidth=3, color=psarColor, transp=0)var color longColor = color.greenvar color shortColor = color.redPSARLongEntry = dir == 1 and dir[1] == -1PSARShortEntry = dir == -1 and dir[1] == 1// Squeeze Momentum//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░//@version=5// @author LazyBear // List of all my indicators: https://www.tradingview.com/v/4IneGo8h/////indicator(shorttitle='SQZMOM_LB', title='Squeeze Momentum Indicator [LazyBear]', overlay=false)lengthBB = input(20, title='BB Length', group="Squeeze Momentum")mult = input(2.0, title='BB MultFactor')lengthKC = input(20, title='KC Length')multKC = input(1.5, title='KC MultFactor')useTrueRange = input(true, title='Use TrueRange (KC)')// Calculate BBsource = closebasis = ta.sma(source, lengthBB)dev = multKC * ta.stdev(source, lengthBB)upperBB = basis + devlowerBB = basis - dev// Calculate KCma = ta.sma(source, lengthKC)range_1 = useTrueRange ? ta.tr : high - lowrangema = ta.sma(range_1, lengthKC)upperKC = ma + rangema * multKClowerKC = ma - rangema * multKCsqzOn = lowerBB > lowerKC and upperBB < upperKCsqzOff = lowerBB < lowerKC and upperBB > upperKCnoSqz = sqzOn == false and sqzOff == falseval = ta.linreg(source - math.avg(math.avg(ta.highest(high, lengthKC), ta.lowest(low, lengthKC)), ta.sma(close, lengthKC)), lengthKC, 0)iff_1 = val > nz(val[1]) ? color.lime : color.greeniff_2 = val < nz(val[1]) ? color.red : color.maroonbcolor = val > 0 ? iff_1 : iff_2scolor = noSqz ? color.blue : sqzOn ? color.black : color.gray//plot(val, color=bcolor, style=plot.style_histogram, linewidth=4)//plot(0, color=scolor, style=plot.style_cross, linewidth=2)SQZMOMLongEntry = val > 0SQZMOMShortEntry = val < 0// 10 in 1 Different Moving Averages//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░// © hiimannshu//@version=5// This indicator is just a simple indicator which plot any kind of multiple (atmost 10) moving everage (sma/ema/wma/rma/hma/vwma) on chart.// Enjoy the new update//indicator(title='10 in 1 Different Moving Averages ( SMA/EMA/WMA/RMA/HMA/VWMA )', shorttitle=' 10 in 1 MAs', overlay=true)bool plot_ma_1 = input.bool(true, '', inline='MA 1',group= "Multi Timeframe Moving Averages")string ma_1_type = input.string(defval='EMA', title='MA 1', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 1',group= "Multi Timeframe Moving Averages")int ma_1_val = input.int(200, '', minval=1, inline='MA 1',group= "Multi Timeframe Moving Averages")ma1_tf = input.timeframe(title='', defval='', inline='MA 1',group= "Multi Timeframe Moving Averages")color ma_1_colour = input.color(color.green, '', inline='MA 1',group= "Multi Timeframe Moving Averages")bool plot_ma_2 = input.bool(true, '', inline='MA 2',group= "Multi Timeframe Moving Averages")string ma_2_type = input.string(defval='SMA', title='MA 2 ', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 2',group= "Multi Timeframe Moving Averages")int ma_2_val = input.int(50, '', minval=1, inline='MA 2',group= "Multi Timeframe Moving Averages")ma2_tf = input.timeframe(title='', defval='', inline='MA 2',group= "Multi Timeframe Moving Averages")color ma_2_colour = input.color(color.yellow, '', inline='MA 2',group= "Multi Timeframe Moving Averages")bool plot_ma_3 = input.bool(false, '', inline='MA 3',group= "Multi Timeframe Moving Averages")string ma_3_type = input.string(defval='SMA', title='MA 3 ', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 3',group= "Multi Timeframe Moving Averages")int ma_3_val = input.int(1, '', minval=1, inline='MA 3',group= "Multi Timeframe Moving Averages")ma3_tf = input.timeframe(title='', defval='', inline='MA 3',group= "Multi Timeframe Moving Averages")color ma_3_colour = input.color(color.black, '', inline='MA 3',group= "Multi Timeframe Moving Averages")bool plot_ma_4 = input.bool(false, '', inline='MA 4',group= "Multi Timeframe Moving Averages")string ma_4_type = input.string(defval='SMA', title='MA 4 ', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 4',group= "Multi Timeframe Moving Averages")int ma_4_val = input.int(1, '', minval=1, inline='MA 4',group= "Multi Timeframe Moving Averages")ma4_tf = input.timeframe(title='', defval='', inline='MA 4',group= "Multi Timeframe Moving Averages")color ma_4_colour = input.color(color.black, '', inline='MA 4',group= "Multi Timeframe Moving Averages")bool plot_ma_5 = input.bool(false, '', inline='MA 5',group= "Multi Timeframe Moving Averages")string ma_5_type = input.string(defval='SMA', title='MA 5 ', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 5',group= "Multi Timeframe Moving Averages")int ma_5_val = input.int(1, '', minval=1, inline='MA 5',group= "Multi Timeframe Moving Averages")ma5_tf = input.timeframe(title='', defval='', inline='MA 5',group= "Multi Timeframe Moving Averages")color ma_5_colour = input.color(color.black, '', inline='MA 5',group= "Multi Timeframe Moving Averages")bool plot_ma_6 = input.bool(false, '', inline='MA 6',group= "Normal Moving Averages")string ma_6_type = input.string(defval='SMA', title='MA 6 ', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 6',group= "Normal Moving Averages")int ma_6_val = input.int(1, '', minval=1, inline='MA 6',group= "Normal Moving Averages")ma_6_src = input.source(defval=close, title='', inline='MA 6',group= "Normal Moving Averages")color ma_6_colour = input.color(color.black, '', inline='MA 6',group= "Normal Moving Averages")bool plot_ma_7 = input.bool(false, '', inline='MA 7',group= "Normal Moving Averages")string ma_7_type = input.string(defval='SMA', title='MA 7 ', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 7',group= "Normal Moving Averages")int ma_7_val = input.int(1, '', minval=1, inline='MA 7',group= "Normal Moving Averages")ma_7_src = input.source(defval=close, title='', inline='MA 7',group= "Normal Moving Averages")color ma_7_colour = input.color(color.black, '', inline='MA 7',group= "Normal Moving Averages")bool plot_ma_8 = input.bool(false, '', inline='MA 8',group= "Normal Moving Averages")string ma_8_type = input.string(defval='SMA', title='MA 8', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 8',group= "Normal Moving Averages")int ma_8_val = input.int(1, '', minval=1, inline='MA 8',group= "Normal Moving Averages")ma_8_src = input.source(defval=close, title='', inline='MA 8',group= "Normal Moving Averages")color ma_8_colour = input.color(color.black, '', inline='MA 8',group= "Normal Moving Averages")bool plot_ma_9 = input.bool(false, '', inline='MA 9',group= "Normal Moving Averages")string ma_9_type = input.string(defval='SMA', title='MA 9 ', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 9',group= "Normal Moving Averages")int ma_9_val = input.int(1, '', minval=1, inline='MA 9',group= "Normal Moving Averages")ma_9_src = input.source(defval=close, title='', inline='MA 9',group= "Normal Moving Averages")color ma_9_colour = input.color(color.black, '', inline='MA 9',group= "Normal Moving Averages")bool plot_ma_10 = input.bool(false, '', inline='MA 10',group= "Normal Moving Averages")string ma_10_type = input.string(defval='SMA', title='MA 10', options=['RMA', 'SMA', 'EMA', 'WMA','HMA','VWMA'], inline='MA 10',group= "Normal Moving Averages")int ma_10_val = input.int(1, '', minval=1, inline='MA 10',group= "Normal Moving Averages")ma_10_src = input.source(defval=close, title='', inline='MA 10',group= "Normal Moving Averages")color ma_10_colour = input.color(color.black, '', inline='MA 10',group= "Normal Moving Averages")ma_function(source, length, type) =>    if type == 'RMA'        ta.rma(source, length)    else if type == 'SMA'        ta.sma(source, length)    else if type == 'EMA'        ta.ema(source, length)    else if type == 'WMA'        ta.wma(source, length)    else if type == 'HMA'        if(length<2)            ta.hma(source,2)        else            ta.hma(source, length)    else         ta.vwma(source, length)        ma_1 = plot_ma_1 ? request.security(syminfo.tickerid, ma1_tf, ma_function(close, ma_1_val, ma_1_type)):0ma_2 = plot_ma_2 ?request.security(syminfo.tickerid, ma2_tf, ma_function(close, ma_2_val, ma_2_type)):0ma_3 = plot_ma_3 ?request.security(syminfo.tickerid, ma3_tf, ma_function(close, ma_3_val, ma_3_type)):0ma_4 = plot_ma_4 ? request.security(syminfo.tickerid, ma4_tf, ma_function(close, ma_4_val, ma_4_type)):0ma_5 = plot_ma_5 ?request.security(syminfo.tickerid, ma5_tf, ma_function(close, ma_5_val, ma_5_type)):0ma_6 = plot_ma_6 ?ma_function(ma_6_src, ma_6_val, ma_6_type):0ma_7 = plot_ma_7 ?ma_function(ma_7_src, ma_7_val, ma_7_type):0ma_8 = plot_ma_8 ?ma_function(ma_8_src, ma_8_val, ma_8_type):0ma_9 = plot_ma_9 ?ma_function(ma_9_src, ma_9_val, ma_9_type):0ma_10 = plot_ma_10 ?ma_function(ma_10_src, ma_10_val, ma_10_type):0plot(plot_ma_1 ? ma_1 : na, 'MA 1', ma_1_colour)plot(plot_ma_2 ? ma_2 : na, 'MA 2', ma_2_colour)plot(plot_ma_3 ? ma_3 : na, 'MA 3', ma_3_colour)plot(plot_ma_4 ? ma_4 : na, 'MA 4', ma_4_colour)plot(plot_ma_5 ? ma_5 : na, 'MA 5', ma_5_colour)plot(plot_ma_6 ? ma_6 : na, 'MA 6', ma_6_colour)plot(plot_ma_7 ? ma_7 : na, 'MA 7', ma_7_colour)plot(plot_ma_8 ? ma_8 : na, 'MA 8', ma_8_colour)plot(plot_ma_9 ? ma_9 : na, 'MA 9', ma_9_colour)plot(plot_ma_10 ? ma_10 : na, 'MA 10', ma_10_colour)// Long entry -  Price has to be below both MA's and 50MA needs to be above 200MAMALongEntry = (close > ma_1 and close > ma_2) and (ma_2 > ma_1)// Short Entry - Price has to be above both MA's and 50MA needs to be below 200MAMAShortEntry = (close < ma_1 and close < ma_2) and (ma_2 < ma_1)// HawkEYE Volume Indicator//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░//@version=5// @author LazyBear// If you use this code, in its original or modified form, do drop me a note. Thx. // //indicator('HawkEye Volume Indicator [LazyBear]', shorttitle='HVI_LB')lengthhvi = input(200, group="HawkEye Volume Indicator")range_1HVI = high - lowrangeAvg = ta.sma(range_1HVI, lengthhvi)volumeA = ta.sma(volume, lengthhvi)divisor = input(1)high1 = high[1]low1 = low[1]mid1 = hl2[1]u1 = mid1 + (high1 - low1) / divisord1 = mid1 - (high1 - low1) / divisorr_enabled1 = range_1HVI > rangeAvg and close < d1 and volume > volumeAr_enabled2 = close < mid1r_enabled = r_enabled1 or r_enabled2g_enabled1 = close > mid1g_enabled2 = range_1HVI > rangeAvg and close > u1 and volume > volumeAg_enabled3 = high > high1 and range_1HVI < rangeAvg / 1.5 and volume < volumeAg_enabled4 = low < low1 and range_1HVI < rangeAvg / 1.5 and volume > volumeAg_enabled = g_enabled1 or g_enabled2 or g_enabled3 or g_enabled4gr_enabled1 = range_1HVI > rangeAvg and close > d1 and close < u1 and volume > volumeA and volume < volumeA * 1.5 and volume > volume[1]gr_enabled2 = range_1HVI < rangeAvg / 1.5 and volume < volumeA / 1.5gr_enabled3 = close > d1 and close < u1gr_enabled = gr_enabled1 or gr_enabled2 or gr_enabled3v_color = gr_enabled ? color.gray : g_enabled ? color.green : r_enabled ? color.red : color.blue//plot(volume, style=plot.style_histogram, color=v_color, linewidth=5)HVILongEntry = g_enabledHVIShortEntry = r_enabled////////////////////////////////////////* Put your strategy rules below *///////////////////////////////////////longCondition = PSARLongEntry and MALongEntry and HVILongEntry and SQZMOMLongEntryshortCondition = PSARShortEntry and MAShortEntry and HVIShortEntry and SQZMOMShortEntry//define as 0 if do not want to usecloseLongCondition = 0closeShortCondition = 0// ADX//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░adxEnabled = input.bool(defval = false , 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=100, 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=999, 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)