Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Crunchster's Normalised Trend Strategy

A Pine Script v5 strategy built on Stdev (src - src[1], 14), CUM (nRet) and WMA (nPrice[offset], hlength). It has 6 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss. Each trade is 0.1 contracts and pays 0.06 commission. 17 settings; defaults include Source close, Lookback period for price normalisation filter 14 and Lookback period for Hull Moving Average 100.

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 Crunchster's Normalised Trend Strategy repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 14 of 14 trades.
How did Crunchster's Normalised Trend Strategy do on BTCUSDT 1D with default settings?
+22.88%
From 26 Jan 2024 to 21 Oct 2026, over 73 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Crunchster's Normalised Trend Strategy 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: 73 before, 73 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 Crunchster's Normalised Trend Strategy use a stop loss?
Yes
strategy.exit sets a stop on line 59, 68.
Does Crunchster's Normalised Trend Strategy run in Zeal Terminal?
Yes
It compiles in 28 ms and runs 1,000 bars in 76 ms, in the browser.

BTCUSDT · 1D · default settings

  • Real Price
  • Hull MA
  • Hull MA Offset
  • 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 (17)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctReal Price$1,235$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.
Net profit
+22.88%
$228.79
Buy and hold
+102.5%
same period
Closed trades
73
20 won · 53 lost
Profitable
27.4%
of closed trades
Profit factor
1.56
gross profit ÷ gross loss
Max drawdown
10.86%
−$118.31

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

  • Likely bug

    ta.stdev(close-close[1], 14) ignores the settings line 35

    Line 35 hard-codes 14 where line 28 uses “Lookback period for price normalisation filter”. Changing those settings moves one band but not this one.

    ta.stdev(close-close[1], 14)ta.stdev(close-close[1], length)

Settings

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

SettingDefaultType and rangeFeeds
Strategy Settings
SourceclosesourcenRet
Lookback period for price normalisation filterThis sets the lookback period for the volatility adjustment of returns, which is used to transform the price series into the "real price"14int · min 2nRet
Lookback period for Hull Moving Average100int · min 2fHMA
HMA Offset0int · min 0fHMA
Longtrueboolline 53
ShortToggle long/short strategy on/offtrueboolline 62
Risk Management Settings
Stop multipleMultiple for ATR, setting hard stop loss from entry price1float · step 0.25exit Stop Long exit Stop Short
Max LeverageMax leverage sets maximum allowable leverage of total capital (initial capital + any net profit), capping maximum volatility adjusted position size1float · step 0.5shares line 44
Annualised Volatility Target %Specify annual risk target, used to determine volatility adjusted position size. Annualised daily volatility is referenced to this value and position size adjusted accordingly10float · max 75shares
Compoundingfalseboolline 39
%Toggle compounding of profit, and set % of profit to compound50float · step 5risk
Backtest range
From Day1int · min 1 · max 31start
From Mon1int · min 1 · max 12start
From YrSet start of backtesting period2018int · min 1900start
To Day1int · min 1 · max 31finish
To Mon1int · min 1 · max 12finish
To YrSet end of backtesting period9999int · min 1900finish

What it calculates

  • Stdev(src - src[1]), Lookback period for price normalisation filter (14)nRet · line 28
  • CUMnRetnPrice · line 29
  • WMA2 * ta.wma(nPrice[offset], hlength / 2) - ta.wma(nPrice[offset], hlength), math.round(math.sqrt(hlength))fHMA · line 31
  • SMAtr, 14stopL · line 34
  • Stdevclose-close[1], 14stdev · line 35
  • CrossundernPrice, fHMAexitlong · line 55
  • CrossovernPrice, fHMAexitshort · line 64

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 datalengthLookback period for pri…setting · 14offsetHMA Offsetsetting · 0hlengthLookback period for Hul…setting · 100FromYearFrom Yrsetting · 2018FromMonthFrom Monsetting · 1FromDayFrom Daysetting · 1ToYearTo Yrsetting · 9999ToMonthTo Monsetting · 1ToDayTo Daysetting · 1lowlowprice datahighhighprice dataComppct%setting · 50riskTAnnualised Volatility T…setting · 10levMax Leveragesetting · 1timetimeprice datanRetStdev→ nRetnPriceCUM→ nPricefHMAWMA→ fHMAstopLSMA→ stopLstdevStdev→ stdevexitlongCrossunder→ exitlongexitshortCrossover→ exitshortstartstartvaluefinishfinishvaluetrtrvaluemaxcapitalmaxcapitalvalueannvolannvolvalueriskriskvaluesharessharesvalueopenNopenNvaluelongConditionlongConditionconditionshortConditionshortConditionconditionwindowwindowconditionMAColorColourMAColorentry:Go Long!Open Go Long!strategy.entryexit:Stop Longexit Stop Longstrategy.exitclose:Go Long!Close Go Long!strategy.closeentry:Go Short!Open Go Short!strategy.entryexit:Stop Shortexit Stop Shortstrategy.exitclose:Go Short!Close Go Short!strategy.closeplot:72Real Priceplotplot:74Hull MAplotplot:75Hull MA Offsetplotfill:Band FillerBand Fillerfill

Order rules

OrderFires whenBy defaultLine
Open Go Long! long(longCondition)On57
Exit Stop Long stopstrategy.position_size > 0On59
Close Go Long!(exitlong)On61
Open Go Short! short(shortCondition)On66
Exit Stop Short stopstrategy.position_size < 0On68
Close Go Short!(exitshort)On70

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.

14/14trades 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+22.9%+102.5%7327%1.5610.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+14.0%+5.5%7817%1.2918.5%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+39.2%+9.8%7930%1.975.6%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−20.8%+8.4%10512%0.7035.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+9.9%+16.7%7127%1.279.3%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−13.6%+21.5%8314%0.7623.1%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−10.7%+148.3%9919%0.8224.8%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−13.3%+17.1%8720%0.7229.3%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 market3216%−$53.32
Sideways market2540%$137.70
Falling market1631%$144.73

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

How bad could the drawdown be?

15.6%

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, 6.8% to 15.6%; the tick is what actually happened, 10.4%. Order luck alone moves it this much.

0%18%
All 73 trades
SideEntryExitBarsP&L
long15 May 2024 66,206.6011 Jun 2024 67,314.1027$2.88
short11 Jun 2024 67,314.1012 Jun 2024 68,264.101−$5.53
long12 Jun 2024 68,264.1013 Jun 2024 66,772.901−$8.31
short13 Jun 2024 66,772.9015 Jul 2024 64,724.2032$9.86
long15 Jul 2024 64,724.202 Aug 2024 62,168.8018−$7.67
short2 Aug 2024 61,498.2021 Aug 2024 61,156.1019$1.00
long21 Aug 2024 61,156.1022 Aug 2024 60,375.701−$2.12
short22 Aug 2024 60,375.7023 Aug 2024 64,037.301−$15.58
long23 Aug 2024 64,037.3027 Aug 2024 61,484.104−$8.81
short27 Aug 2024 59,414.9010 Sep 2024 57,636.1014$5.19
long10 Sep 2024 57,636.109 Oct 2024 60,635.9029$11.98
short9 Oct 2024 60,635.9011 Oct 2024 63,115.502−$11.00
long11 Oct 2024 62,540.104 Nov 2024 67,849.9024$22.39
short4 Nov 2024 67,849.905 Nov 2024 69,372.101−$6.43
long5 Nov 2024 69,372.102 Dec 2024 95,840.5027$101.44
short2 Dec 2024 95,840.504 Dec 2024 97,835.302−$4.93
long4 Dec 2024 98,587.405 Dec 2024 96,945.501−$4.08
short5 Dec 2024 96,945.506 Dec 2024 99,740.901−$7.43
long6 Dec 2024 99,740.907 Dec 2024 99,831.901−$0.07
short7 Dec 2024 99,831.908 Dec 2024 101,110.001−$3.40
long8 Dec 2024 101,110.009 Dec 2024 97,276.401−$9.53
short9 Dec 2024 97,276.4011 Dec 2024 101,283.002−$10.78
long16 Dec 2024 106,059.0018 Dec 2024 101,417.002−$11.76
short18 Dec 2024 100,204.006 Jan 2025 102,236.0019−$4.26
long6 Jan 2025 102,236.007 Jan 2025 96,954.501−$14.31
short7 Jan 2025 96,954.5017 Jan 2025 101,283.0010−$10.28
long17 Jan 2025 104,078.0019 Jan 2025 100,203.002−$8.18
short28 Jan 2025 101,335.0029 Jan 2025 103,733.001−$5.91
long29 Jan 2025 103,733.0031 Jan 2025 102,429.002−$3.58
short31 Jan 2025 102,429.0020 Feb 2025 98,305.1020$11.02
long20 Feb 2025 98,305.1021 Feb 2025 96,181.901−$10.91
short21 Feb 2025 96,181.9019 Mar 2025 86,846.0026$39.54
long19 Mar 2025 86,846.0029 Mar 2025 82,151.3010−$9.28
short6 Apr 2025 78,429.909 Apr 2025 81,901.803−$9.86
long9 Apr 2025 82,615.3010 Apr 2025 79,607.201−$6.11
short10 Apr 2025 79,607.2011 Apr 2025 83,423.901−$7.48
long11 Apr 2025 83,423.9030 May 2025 103,985.0049$37.19
short30 May 2025 103,985.009 Jun 2025 108,263.0010−$11.57
long9 Jun 2025 110,263.0011 Jun 2025 108,645.002−$4.79
short11 Jun 2025 108,645.003 Jul 2025 109,585.0022−$2.90
long3 Jul 2025 109,585.004 Jul 2025 107,984.001−$5.39
short4 Jul 2025 107,984.009 Jul 2025 110,795.005−$9.05
long9 Jul 2025 111,234.0030 Jul 2025 117,840.0021$25.47
short30 Jul 2025 117,840.0011 Aug 2025 120,239.0012−$12.80
long12 Aug 2025 120,134.0014 Aug 2025 117,355.002−$9.96
short14 Aug 2025 118,295.0010 Sep 2025 113,960.0027$10.29
long10 Sep 2025 113,960.0022 Sep 2025 112,651.0012−$4.89
short22 Sep 2025 112,651.0029 Sep 2025 114,312.007−$7.74
long29 Sep 2025 114,312.0010 Oct 2025 111,322.0011−$9.27
short10 Oct 2025 112,774.0026 Oct 2025 114,560.0016−$3.22
long26 Oct 2025 114,560.0029 Oct 2025 109,967.003−$13.46
short29 Oct 2025 110,021.003 Dec 2025 93,430.1035$46.82
long3 Dec 2025 93,430.105 Dec 2025 89,757.602−$7.78
short5 Dec 2025 89,329.907 Dec 2025 90,395.402−$2.70
long7 Dec 2025 90,395.4015 Dec 2025 87,059.508−$8.07
short15 Dec 2025 86,432.0016 Dec 2025 87,863.501−$3.97
long16 Dec 2025 87,863.5018 Dec 2025 84,561.002−$11.47
short18 Dec 2025 85,516.3019 Dec 2025 88,137.001−$10.03
long19 Dec 2025 88,137.0024 Jan 2026 89,225.2036$3.48
short24 Jan 2026 89,225.202 Mar 2026 68,830.2037$60.17
long2 Mar 2026 68,830.2028 Mar 2026 66,376.9026−$7.48
short28 Mar 2026 66,376.9030 Mar 2026 66,797.502−$1.53
long30 Mar 2026 66,797.5013 May 2026 79,313.5044$43.01
short13 May 2026 79,313.5014 May 2026 81,090.101−$9.76
long14 May 2026 81,090.1015 May 2026 79,113.101−$10.07
short15 May 2026 79,113.102 Jul 2026 61,560.1048$80.30
long2 Jul 2026 61,560.1012 Aug 2026 63,479.9041$9.02
short12 Aug 2026 63,479.9017 Aug 2026 64,532.205−$8.41
long17 Aug 2026 64,532.2010 Sep 2026 76,568.6024$104.85
short10 Sep 2026 76,568.6018 Sep 2026 80,112.808−$12.86
long18 Sep 2026 80,884.0028 Sep 2026 83,499.9010$8.41
short28 Sep 2026 83,499.9030 Sep 2026 85,619.002−$5.66
long4 Oct 2026 86,530.105 Oct 2026 85,766.801−$2.79

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
Crunchster's Normalised Trend Strategy this page—v5 strategy+22.9%7310.9%
BB+RSI+OBV by atakhadivicum sma stdevv4 strategy+52.5%7129.3%
ADX_TSI_Bol Band Trend Chaser by gary_tradessma stdev wmav4 strategyNo trades on this market
meta-capitulation by serafimovklimentsma cumv5 strategyNo trades on this market
Double Bollinger Binary Options by Trade_by_DBsma stdevv5 strategyNo trades on this market
Improved Bollinger Swing Strategy Stock Nasdaq by exlux99sma stdevv4 strategy−20.4%722.3%

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.

  • 4 settings use the untyped input() (line 6, 10, 11, 15). 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 6: input() → input.source()
  • Line 10: input() → input.bool()
  • Line 11: input() → input.bool()
  • Line 15: input() → input.bool()
⋯// Inputs and Parameters-src = input(close, 'Source', group='Strategy Settings')+src = input.source(close, 'Source', group='Strategy Settings')length = input.int(title="Lookback period for price normalisation filter", defval=14, minval=2, group='Strategy Settings', tooltip='This sets the lookback period for the volatility adjustment of returns, which is used to transform the price series into the "real price"')⋯offset = input.int(title="HMA Offset", defval=0, minval=0, group='Strategy Settings')-long = input(true, 'Long', inline='08', group='Strategy Settings')+long = input.bool(true, 'Long', inline='08', group='Strategy Settings')-short = input(true, 'Short', inline='08', group='Strategy Settings', tooltip='Toggle long/short strategy on/off')+short = input.bool(true, 'Short', inline='08', group='Strategy Settings', tooltip='Toggle long/short strategy on/off')stopMultiple = input.float(1, 'Stop multiple', step=0.25, group='Risk Management Settings', tooltip='Multiple for ATR, setting hard stop loss from entry price')⋯riskT = input.float(10, maxval=75, title='Annualised Volatility Target %', group='Risk Management Settings', tooltip='Specify annual risk target, used to determine volatility adjusted position size. Annualised daily volatility is referenced to this value and position size adjusted accordingly')-comp = input(false, 'Compounding', inline='09', group='Risk Management Settings')+comp = input.bool(false, 'Compounding', inline='09', group='Risk Management Settings')Comppct = input.float(50, '%', step=5, inline='09', group='Risk Management Settings', tooltip='Toggle compounding of profit, and set % of profit to compound')⋯

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: 73 before, 73 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.

⋯// © Crunchster1-//@version=5+//@version=6strategy(title="Crunchster's Normalised Trend Strategy", shorttitle="Normalised Trend Strategy", overlay=false, slippage=10, pyramiding=1, precision = 4, calc_on_order_fills = false, calc_on_every_tick = false, default_qty_value = 0.1, initial_capital = 1000, commission_value = 0.06, process_orders_on_close = true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 28 msWith a workaround 1,000 bars in 76 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/// © Crunchster1//@version=5strategy(title="Crunchster's Normalised Trend Strategy", shorttitle="Normalised Trend Strategy", overlay=false, slippage=10, pyramiding=1, precision = 4, calc_on_order_fills = false, calc_on_every_tick = false, default_qty_value = 0.1, initial_capital = 1000, commission_value = 0.06, process_orders_on_close = true)// Inputs and Parameterssrc = input(close, 'Source', group='Strategy Settings')length = input.int(title="Lookback period for price normalisation filter", defval=14, minval=2, group='Strategy Settings', tooltip='This sets the lookback period for the volatility adjustment of returns, which is used to transform the price series into the "real price"')hlength = input.int(title="Lookback period for Hull Moving Average", defval=100, minval=2, group='Strategy Settings')offset = input.int(title="HMA Offset", defval=0, minval=0, group='Strategy Settings')long = input(true, 'Long', inline='08', group='Strategy Settings')short = input(true, 'Short', inline='08', group='Strategy Settings', tooltip='Toggle long/short strategy on/off')stopMultiple = input.float(1, 'Stop multiple', step=0.25, group='Risk Management Settings', tooltip='Multiple for ATR, setting hard stop loss from entry price')lev = input.float(1, 'Max Leverage', step=0.5, group='Risk Management Settings', tooltip='Max leverage sets maximum allowable leverage of total capital (initial capital + any net profit), capping maximum volatility adjusted position size')riskT = input.float(10, maxval=75, title='Annualised Volatility Target %', group='Risk Management Settings', tooltip='Specify annual risk target, used to determine volatility adjusted position size. Annualised daily volatility is referenced to this value and position size adjusted accordingly')comp = input(false, 'Compounding', inline='09', group='Risk Management Settings')Comppct = input.float(50, '%', step=5, inline='09', group='Risk Management Settings', tooltip='Toggle compounding of profit, and set % of profit to compound')// Backtesting periodFromDay = input.int(defval=1, title='From Day', minval=1, maxval=31, inline='04', group='Backtest range')FromMonth = input.int(defval=1, title='From Mon', minval=1, maxval=12, inline='04', group='Backtest range')FromYear = input.int(defval=2018, title='From Yr', minval=1900, inline='04', group='Backtest range', tooltip='Set start of backtesting period')ToDay = input.int(defval=1, title='To Day', minval=1, maxval=31, inline='05', group='Backtest range')ToMonth = input.int(defval=1, title='To Mon', minval=1, maxval=12, inline='05', group='Backtest range')ToYear = input.int(defval=9999, title='To Yr', minval=1900, inline='05', group='Backtest range', tooltip='Set end of backtesting period')start = timestamp(FromYear, FromMonth, FromDay, 00, 00)finish = timestamp(ToYear, ToMonth, ToDay, 23, 59)window = time >= start and time <= finish// Normalised returns calculationnRet = (src - src[1]) / ta.stdev((src - src[1]), length)nPrice = ta.cum(nRet)//Hull Moving Average - using normalised price seriesfHMA = ta.wma(2 * ta.wma(nPrice[offset], hlength / 2) - ta.wma(nPrice[offset], hlength), math.round(math.sqrt(hlength)))//Risk Management formulaetr = math.max(high - low, math.abs(high - close), math.abs(low - close)) //True rangestopL = ta.sma(tr, 14) //Average true rangestdev = ta.stdev(close-close[1], 14) //volatility of recent returnsmaxcapital = strategy.initial_capital+strategy.netprofit //Maximum capital available to invest - initial capital net of profitannvol = 100*math.sqrt(365)*stdev/close //converts recent volatility of returns into annualised volatility of returns - assumes daily timeframerisk = 1.1if comp    risk := (strategy.initial_capital+(Comppct*strategy.netprofit/100))//adjust investment capital to include compoundingelse    risk := strategy.initial_capitalshares = (risk * (riskT/annvol)) / close //calculates volatility adjusted position size, dependent on user specified annualised risk targetif ((shares*close) > lev*maxcapital) //ensures position size does not exceed available capital multiplied by user specified maximum leverage    shares := lev*maxcapital/close//To set the price at the entry point of tradePosopen() =>    math.abs(strategy.position_size[1]) <= 0 and math.abs(strategy.position_size) > 0var float openN = naif Posopen()    openN := stopL// Strategy Rulesif long    longCondition = ta.crossover(nPrice, fHMA) and window    exitlong = ta.crossunder(nPrice, fHMA)    if (longCondition)        strategy.entry('Go Long!', strategy.long, qty=shares)    if strategy.position_size > 0            strategy.exit('Stop Long', from_entry = 'Go Long!', stop=(strategy.opentrades.entry_price(0) - (openN * stopMultiple)))    if (exitlong)        strategy.close('Go Long!', immediately = true)if short    shortCondition = ta.crossunder(nPrice, fHMA) and window    exitshort = ta.crossover(nPrice, fHMA)    if (shortCondition)        strategy.entry('Go Short!', strategy.short, qty=shares)    if strategy.position_size < 0           strategy.exit('Stop Short', from_entry = 'Go Short!', stop=(strategy.opentrades.entry_price(0) + (openN * stopMultiple)))    if (exitshort)        strategy.close('Go Short!', immediately = true)// Visuals of trend and directionplot(nPrice, title='Real Price', color=color.black)MAColor = fHMA > fHMA[3] ? #00ff00 : #ff0000MA1 = plot(fHMA, title='Hull MA', color=MAColor)MA2 = plot(fHMA[3], title='Hull MA Offset', color=MAColor)fill(MA1, MA2, title='Band Filler', color=MAColor)