Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Kahlman HullMA - WT Cross Strategy

A Pine Script v5 strategy built on EMA (apL_src, 6), SMA (wt1L, 4) and RSI (src_src, 13). It has 10 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade commits 100% of equity and pays no commission. 94 settings; defaults include TP1 Profit Percent 10, TP2 Profit Percent 15 and Long Take Profit 1 8.9.

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 Kahlman HullMA - WT Cross Strategy repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 13 of 13 trades.
How did Kahlman HullMA - WT Cross Strategy do on BTCUSDT 1D with default settings?
+1.01%
From 26 Jan 2024 to 21 Oct 2026, over 54 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Kahlman HullMA - WT Cross 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: 54 before, 23 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 Kahlman HullMA - WT Cross Strategy use a stop loss?
Yes
strategy.exit sets a stop on line 472, 474, 476, 482, 484, 486.
Does Kahlman HullMA - WT Cross Strategy run in Zeal Terminal?
Yes
It compiles in 103 ms and runs 1,000 bars in 304 ms, in the browser.

BTCUSDT · 1D · default settings

  • Long Plot
  • Short Plot
  • Long/Short TP1
  • Long/Short TP2
  • Long/Short SL
  • Long/Short Position Check
  • Long Trailing Stop
  • 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 (94)
50,00075,000100,000125,000AprJulOct2025AprJulOct2026AprJulOct$100$203Equity from $100
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
+1.01%
$1.01
Buy and hold
+102.5%
same period
Closed trades
54
25 won · 29 lost
Profitable
46.3%
of closed trades
Profit factor
1.01
gross profit ÷ gross loss
Max drawdown
33.27%
−$48.12

One run with the author's default settings, $100 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.sma(wt1L, 4) ignores the settings line 203

    Line 203 hard-codes 4 where line 301 uses “K”. Changing those settings moves one band but not this one.

    ta.sma(wt1L, 4)ta.sma(wt1L, smoothK)
  • Likely bug

    ta.sma(wt1S, 4) ignores the settings line 231

    Line 231 hard-codes 4 where line 301 uses “K”. Changing those settings moves one band but not this one.

    ta.sma(wt1S, 4)ta.sma(wt1S, smoothK)
  • Check

    12 settings do nothing

    “|| LONG TP SETTINGS ||”, “|| SHORT TP SETTINGS ||”, “|| STOP LOSS SETTINGS ||”, “|| TRAILING STOP SETTINGS ||”, “|| POSITION CHECK SETTINGS ||”, “|| WT CROSS SETTINGS ||”, “|| HULLMA SETTINGS ||”, “|| STOCH RSI SETTINGS ||”, “|| VOLUME SETTINGS ||”, “|| ADX SETTINGS ||”, “|| WUNDERBIT SETTINGS ||”, “|| DATE & DATE RANGE SETTINGS ||” are declared but never read.

  • Check

    No commission

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

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    4 settings have no label

    In the settings dialog startDate (line 346), endDate (line 347), timeSession (line 350), timeSession2 (line 375) show an empty name. The labels on this page come from the variable names.

  • Note

    No slippage

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

Settings

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

SettingDefaultType and rangeFeeds
|| LONG TP SETTINGS ||falseboolunused
Long Ontrueboolline 469
TP1 Profit PercentPercentage of balance to be taken for take profit 1-2.10float · min 0 · max 100 · step 5exit LONG
TP2 Profit PercentPercentage of balance to be taken for take profit 1-2.15float · min 0 · max 100 · step 5exit LONG1
Long Take Profit 1Long take profit 1 percent setting8.9float · min 0.1 · step 0.1exitTP positionCheckLong
Long Take Profit 2Long take profit 2 percent setting. / Close TP213.6float · min 0.1 · step 0.1exitTP2
OntrueboolLSTP2Lines LSTP3Lines exit LONG1 exit LONG line 473
Long Take Profit 3Long take profit 3 percent setting. / Close TP313.6float · min 0.1 · step 0.1exitTP3
OnfalseboolLSTP3Lines exit LONG2 exit LONG1 line 475
Long TP1 SourceTP1 up or down control. Close process if selected 'source' is less than TP1hc2string · options ["hc2", "co2", "hco3", "hlo3", "ho2", "lo2", "open", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high"]source_long
Long TP2 SourceTP2 up or down control. Close process if selected 'source' is less than TP2hc2string · options ["hc2", "co2", "hco3", "hlo3", "ho2", "lo2", "open", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high"]source_long2
|| SHORT TP SETTINGS ||falseboolunused
Short Ontrueboolline 479
TP1 Profit PercentPercentage of balance to be taken for take profit 1-2.50float · min 0 · max 100 · step 5exit SHORT
TP2 Profit PercentPercentage of balance to be taken for take profit 1-2.70float · min 0 · max 100 · step 5exit SHORT1
Short Take Profit 1Short take profit 1 percent setting8.2float · min 0.1 · step 0.1exitTP positionCheckShort
Short Take Profit 2Short take profit 2 percent setting. / Close TP313.4float · min 0.1 · step 0.1exitTP2
OntrueboolLSTP2Lines LSTP3Lines exit SHORT1 exit SHORT line 483
Short Take Profit 3Short take profit 3 percent setting. / Close TP313.9float · min 0.1 · step 0.1exitTP3
OnfalseboolLSTP3Lines exit SHORT2 exit SHORT1 line 485
Short TP1 SourceTP1 up or down control. Close process if selected 'source' is greater than TP1lc2string · options ["lc2", "lco3", "hco3", "hc2", "co2", "hlo3", "lo2", "ho2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"]source_short
Short TP2 SourceTP2 up or down control. Close process if selected 'source' is greater than TP2lco3string · options ["lc2", "lco3", "hco3", "hc2", "co2", "hlo3", "lo2", "ho2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"]source_short2
|| STOP LOSS SETTINGS ||falseboolunused
LongStop loss percent(Red line)7.1float · min 0.1 · step 0.1exitSL
Short7.9float · min 0.1 · step 0.1exitSL
|| TRAILING STOP SETTINGS ||falseboolunused
Long Trailing SL OnTrailing stop loss mode.trueboolpriceStopL TrailingStopLines
Change LineOn: If price is greater than TP1. Off: If price is greater than Long Position Check.truebooltrailingStopChangeL1
LongTrailing stop loss percent. Note: Activated if greater than TP1. Otherwise, the stop level is the value on a bottom line.(Yellow dot line)3.6float · min 0.1 · step 0.1priceStopL stopMeasure
Short Trailing SL OnTrailing stop loss mode.falseboolpriceStopS TrailingStopLines2
Change LineOn: If price is greater than TP1. Off: If price is greater than Short Position Check.truebooltrailingStopChangeS1
ShortTrailing stop loss percent. Note: Activated if greater than TP1. Otherwise, the stop level is the value on a bottom line.(Yellow dot line)3.4float · min 0.1 · step 0.1stopMeasure priceStopS
|| POSITION CHECK SETTINGS ||falseboolunused
Long Position Check OnLong Position check mode. Depends on TP1 percentage. It works as a '%X' / 'Senstive Value'.trueboolpositionCheckLong PositionCheckColors PositionCheckLines
SourceLong check senstive up or down control. Close process if selected 'source' is less than Position Check Line(Yellow solid line)co2string · options ["hco3", "lco3", "hc2", "lc2", "co2", "ho2", "lo2", "hlo3", "close", "open", "hl2", "hlc3", "ohlc4", "hlcc4", "low", "high"]source_CheckLong
Senstive1.7float · min 1 · step 0.01positionCheckLong
Short Position Check OnShort Position check mode. It works as a '%X' / 'Senstive Value'.trueboolpositionCheckShort PositionCheckColors PositionCheckLines
SourceShort check senstive up or down control. Close process if selected 'source' is greater than Position Check Line(Yellow solid line)lowstring · options ["lco3", "hco3", "lc2", "hc2", "co2", "lo2", "ho2", "hlo3", "close", "open", "hl2", "hlc3", "ohlc4", "hlcc4", "low", "high"]source_CheckShort
Senstive1.4float · min 1 · step 0.01positionCheckShort
|| WT CROSS SETTINGS ||falseboolunused
Channel Length6intesaL rL
Average Length23inttciL
Sourcehlc3string · options ["hc2", "hco3", "lc2", "lco3", "co2", "hlo3", "lo2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"]apL_src
Channel Length8intesaS rS
Average Length19inttciS
Sourcehlc3string · options ["hc2", "hco3", "lc2", "lco3", "co2", "hlo3", "lo2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"]apS_src
|| HULLMA SETTINGS ||falseboolunused
Sourcehl2string · options ["hc2", "hco3", "lc2", "lco3", "co2", "hlo3", "lo2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"]hull_src
Lookback24intp a b
Gain10000inta b
|| STOCH RSI SETTINGS ||falseboolunused
Stoch RSIStoch RSI On/OfftrueboolLStoch SStoch
K2int · min 1k
D3int · min 1d
RSI Length13int · min 1rsi1
Stochastic Length13int · min 1k
RSI Sourcehl2string · options ["hc2", "hco3", "lc2", "lco3", "co2", "hlo3", "lo2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"]src_src
|| VOLUME SETTINGS ||falseboolunused
On/OfftrueboolvolEntry
Mult.0.6float · min 0 · step 0.1vol
Sma volume lenght3int · min 1vol
Vwma volume lenght3int · min 1vol
Wma volume lenght4int · min 1vol
|| ADX SETTINGS ||falseboolunused
OnfalseboolADXEntry
ADX Smoothing14intadx sig
DI Length14intplus minus sig
Buy Level20intADXEntry
|| WUNDERBIT SETTINGS ||falseboolunused
|| DATE & DATE RANGE SETTINGS ||falseboolunused
Start Date (no label in the script)timestamp("1 Jan 2020 00:00 +0000")timestrategyTime line 392 line 394
End Date (no label in the script)timestamp("1 Jan 9999 03:00 +0000")timestrategyTime line 392 line 394
Wunderbit Comments
Long Entry CommentENTER-LONGstringentry LONG
Long Exit CommentEXIT-LONGstringexit LONG exit LONG1 exit LONG2 close LONG
Short Entry CommentENTER-SHORTstringentry SHORT
Short Exit CommentEXIT-SHORTstringexit SHORT exit SHORT1 exit SHORT2 close SHORT
LONG
Long/Time Range & Weekdays On/OffStart Date and End Date not incluededtrueboolentry LONG line 367 line 470
Time Session (no label in the script)0000-0000sessionentry LONG line 470
Mondaytruebooldays
Tuesdaytruebooldays
Wednesdaytruebooldays
Thursdaytruebooldays
Fridaytruebooldays
Saturdayfalsebooldays
SundayTrade days?truebooldays
SHORT
Short/Time Range & Weekdays On/OffStart Date and End Date not incluededfalseboolentry SHORT line 391 line 480
Time Session2 (no label in the script)0300-0300sessionentry SHORT line 480
Mondaytruebooldays2
Tuesdaytruebooldays2
Wednesdaytruebooldays2
Thursdaytruebooldays2
Fridaytruebooldays2
Saturdaytruebooldays2
SundayTrade days?truebooldays2

What it calculates

  • EMAapL_src, Channel Length (6)esaL · line 198
  • EMAmath.abs(apL_src - esaL), Channel Length (6)rL · line 199
  • EMAciL, Average Length (23)tciL · line 201
  • SMAwt1L, 4wt2L · line 203
  • EMAapS_src, Channel Length (8)esaS · line 226
  • EMAmath.abs(apS_src - esaS), Channel Length (8)rS · line 227
  • EMAciS, Average Length (19)tciS · line 229
  • SMAwt1S, 4wt2S · line 231
  • RSIsrc_src, RSI Length (13)rsi1 · line 300
  • SMA / Stochta.stoch(rsi1, rsi1, rsi1, lengthStoch), K (2)k · line 301
  • SMAk, D (3)d · line 302
  • SMA / VWMA / WMAvolume, Sma volume lenght (3)vol · line 312
  • Changehighup · line 320
  • Changelowdown · line 321
  • RMAta.tr, lentruerange · line 324
  • RMAmath.abs(plus - minus) / (sum == 0 ? 1 : sum), ADX Smoothing (14)adx · line 331

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 147 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.

Order rules

OrderFires whenBy defaultLine
Open LONG longinSession(sessionOnOff ? timeSession:na)On471
Exit LONG stop and limitstrategyTimeOn472
Exit LONG1 stop and limittp2OnOffLOn “On”474
Exit LONG2 stop and limittp3OnOffLOff “On”476
Close LONGlongConditionExit or longTStopOn478
Open SHORT shortinSession2(sessionOnOff2 ? timeSession2:na)On481
Exit SHORT stop and limitstrategyTimeOn482
Exit SHORT1 stop and limittp2OnOffSOn “On”484
Exit SHORT2 stop and limittp3OnOffSOff “On”486
Close SHORTshortConditionExit or shortTStopOn488

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.

13/13trades 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 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+1.0%+102.5%5446%1.0133.3%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+8.3%+5.5%1741%1.3015.2%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+92.0%+9.8%8154%1.5041.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−37.5%+8.4%2417%0.3237.8%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+55.4%+16.7%7653%1.2844.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+1.5%+21.5%3047%1.0317.2%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−5.0%+148.3%4751%0.9643.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+7.4%+17.1%1547%1.2514.2%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 market1856%$22.47
Sideways market2544%−$9.64
Falling market1136%−$11.81

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

How bad could the drawdown be?

41.0%

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

0%47%
All 54 trades
SideEntryExitBarsP&L
long14 Mar 2024 73,072.4015 Mar 2024 67,884.301−$0.71
long14 Mar 2024 73,072.4015 Mar 2024 67,884.301−$6.39
long26 Mar 2024 69,880.002 Apr 2024 64,918.507−$0.66
long26 Mar 2024 69,880.002 Apr 2024 64,918.507−$5.94
short3 Apr 2024 65,464.008 Apr 2024 70,635.605−$3.41
short3 Apr 2024 65,464.008 Apr 2024 70,635.605−$3.41
long6 May 2024 64,012.0020 May 2024 69,709.1014$0.71
long6 May 2024 64,012.0022 May 2024 68,874.5016$5.43
short5 Jul 2024 57,050.0011 Jul 2024 57,725.806−$1.01
short25 Jul 2024 65,376.003 Aug 2024 60,015.209$3.47
short25 Jul 2024 65,376.004 Aug 2024 60,698.0010$3.03
long11 Sep 2024 57,636.0019 Sep 2024 62,765.608$0.81
long11 Sep 2024 57,636.0026 Sep 2024 65,474.5015$11.15
long30 Oct 2024 72,736.403 Nov 2024 67,572.104−$0.73
long30 Oct 2024 72,736.403 Nov 2024 67,572.104−$6.59
long7 Nov 2024 75,572.0011 Nov 2024 82,297.904$0.85
long7 Nov 2024 75,572.0011 Nov 2024 85,849.804$11.72
short19 Dec 2024 100,204.0030 Dec 2024 91,987.3011$4.44
short19 Dec 2024 100,204.0031 Dec 2024 92,792.1012$4.01
long15 Jan 2025 96,560.9017 Jan 2025 105,155.002$1.04
long15 Jan 2025 96,560.9018 Jan 2025 104,077.003$8.18
long3 Mar 2025 94,270.004 Mar 2025 86,221.201−$1.08
long3 Mar 2025 94,270.004 Mar 2025 86,221.201−$9.68
short29 Mar 2025 84,424.406 Apr 2025 77,501.608$4.72
short29 Mar 2025 84,424.407 Apr 2025 78,430.009$4.09
long9 May 2025 103,262.0025 May 2025 107,762.0016$5.41
long9 Jun 2025 105,734.0022 Jun 2025 98,226.9013−$0.92
long9 Jun 2025 105,734.0022 Jun 2025 98,226.9013−$8.27
long25 Jun 2025 106,083.0010 Jul 2025 115,524.0015$1.07
long25 Jun 2025 106,083.0014 Jul 2025 120,510.0019$14.72
long8 Aug 2025 117,472.0026 Aug 2025 109,132.0018−$0.97
long8 Aug 2025 117,472.0026 Aug 2025 109,132.0018−$8.69
long1 Oct 2025 114,049.005 Oct 2025 124,199.004$1.12
long1 Oct 2025 114,049.008 Oct 2025 121,333.007$7.27
short10 Oct 2025 121,662.0011 Oct 2025 112,774.001$9.85
long21 Oct 2025 110,532.004 Nov 2025 102,684.0014−$1.03
long21 Oct 2025 110,532.004 Nov 2025 102,684.0014−$9.24
long10 Nov 2025 104,723.0014 Nov 2025 97,287.604−$0.95
long10 Nov 2025 104,723.0014 Nov 2025 97,287.604−$8.59
long25 Nov 2025 88,300.0013 Jan 2026 96,158.7049$1.11
long25 Nov 2025 88,300.0014 Jan 2026 95,414.0050$9.05
short24 Feb 2026 64,656.0025 Feb 2026 69,763.801−$5.33
short24 Feb 2026 64,656.0025 Feb 2026 69,763.801−$5.33
long27 Feb 2026 67,485.204 Mar 2026 73,491.405$1.11
long27 Feb 2026 67,485.205 Mar 2026 72,666.806$8.59
short20 Mar 2026 69,930.0014 Apr 2026 75,454.5025−$5.29
short20 Mar 2026 69,930.0014 Apr 2026 75,454.5025−$5.29
long26 May 2026 77,322.001 Jun 2026 71,832.106−$0.88
long26 May 2026 77,322.001 Jun 2026 71,832.106−$7.89
long2 Jul 2026 60,024.0014 Jul 2026 62,334.5012$4.41
short25 Jul 2026 64,140.0019 Aug 2026 69,207.1025−$4.70
short25 Jul 2026 64,140.0019 Aug 2026 69,207.1025−$4.70
short29 Aug 2026 77,845.9021 Sep 2026 83,995.7023−$4.33
short29 Aug 2026 77,845.9021 Sep 2026 83,995.7023−$4.33

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
Kahlman HullMA - WT Cross Strategy this page—v5 strategy+1.0%5433.3%
Stoch-RSI 4h-1h-15min by MoonFlagema rsi sma rma stochv4 strategyNo trades on this market
DRSI DMA Scalping Strategy No Repaint by allenlksma wma ema rsiv4 strategy−99.5%44137.7%
High-Low Channel Multi averages Crypto Swing strategy by exlux99sma ema wma rma vwmav4 strategyNo trades on this market
Bear & Bull Zone Signal Strategy by Solutions1978rsi ema stoch sma vwmav4 strategyNo trades on this market
EMA bands + leledc + bollinger bands trend following strategy v2 by readysetliqdema sma rsi rma wmav5 strategy+7.8%3832.0%

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.

  • 42 settings use the untyped input() (line 7, 8, 14, 17, 24, 25, 31, 34, 41, 44, 45, 46, 49, 50, 53, 54, 60, 175, 177, 178, 206, 207, 233, 236, 237, 276, 277, 306, 307, 314, 315, 316, 317, 318, 338, 340, 341, 342, 343, 345, 349, 374). 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 54 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 7: input() → input.bool()
  • Line 8: input() → input.bool()
  • Line 14: input() → input.bool()
  • Line 17: input() → input.bool()
  • Line 24: input() → input.bool()
  • Line 25: input() → input.bool()
36 more edits
  • Line 31: input() → input.bool()
  • Line 34: input() → input.bool()
  • Line 41: input() → input.bool()
  • Line 44: input() → input.bool()
  • Line 45: input() → input.bool()
  • Line 46: input() → input.bool()
  • Line 49: input() → input.bool()
  • Line 50: input() → input.bool()
  • Line 53: input() → input.bool()
  • Line 54: input() → input.bool()
  • Line 60: input() → input.bool()
  • Line 175: input() → input.bool()
  • Line 177: input() → input.int()
  • Line 178: input() → input.int()
  • Line 206: input() → input.int()
  • Line 207: input() → input.int()
  • Line 233: input() → input.bool()
  • Line 236: input() → input.int()
  • Line 237: input() → input.int()
  • Line 276: input() → input.bool()
  • Line 277: input() → input.bool()
  • Line 306: input() → input.bool()
  • Line 307: input() → input.bool()
  • Line 314: input() → input.bool()
  • Line 315: input() → input.bool()
  • Line 316: input() → input.int()
  • Line 317: input() → input.int()
  • Line 318: input() → input.int()
  • Line 338: input() → input.bool()
  • Line 340: input() → input.string()
  • Line 341: input() → input.string()
  • Line 342: input() → input.string()
  • Line 343: input() → input.string()
  • Line 345: input() → input.bool()
  • Line 349: input() → input.bool()
  • Line 374: input() → input.bool()
⋯//Inputs-_1 = input(false, '|| LONG TP SETTINGS ||')+_1 = input.bool(false, '|| LONG TP SETTINGS ||')-long = input(true, 'Long On')+long = input.bool(true, 'Long On')LongprofitPercent = input.float(10, "TP1 Profit Percent", minval = 0, maxval = 100, step = 5, tooltip="Percentage of balance to be taken for take profit 1-2.")⋯takeprofit2Long = input.float(13.6, "Long Take Profit 2", minval = 0.1, step = 0.1, tooltip="Long take profit 2 percent setting. / Close TP2", inline=tp2L)/100-tp2OnOffL = input(true, 'On', inline=tp2L)+tp2OnOffL = input.bool(true, 'On', inline=tp2L)var tp3L = "tp3L"takeprofit3Long = input.float(13.6, "Long Take Profit 3", minval = 0.1, step = 0.1, tooltip="Long take profit 3 percent setting. / Close TP3", inline=tp3L)/100-tp3OnOffL = input(false, 'On', inline=tp3L)+tp3OnOffL = input.bool(false, 'On', inline=tp3L)src_long = input.string(title='Long TP1 Source', defval="hc2",⋯     tooltip="TP2 up or down control. Close process if selected 'source' is less than TP2")-_2 = input(false, '|| SHORT TP SETTINGS ||')+_2 = input.bool(false, '|| SHORT TP SETTINGS ||')-short = input(true, 'Short On')+short = input.bool(true, 'Short On')ShortprofitPercent = input.float(50, "TP1 Profit Percent", minval = 0, maxval = 100, step = 5, tooltip="Percentage of balance to be taken for take profit 1-2.")⋯takeprofit2Short = input.float(13.4, "Short Take Profit 2", minval = 0.1, step = 0.1, tooltip="Short take profit 2 percent setting. / Close TP3", inline=tp2S)/100-tp2OnOffS = input(true, 'On', inline=tp2S)+tp2OnOffS = input.bool(true, 'On', inline=tp2S)var tp3S = "tp3S"takeprofit3Short = input.float(13.9, "Short Take Profit 3", minval = 0.1, step = 0.1, tooltip="Short take profit 3 percent setting. / Close TP3", inline=tp3S)/100-tp3OnOffS = input(false, 'On', inline=tp3S)+tp3OnOffS = input.bool(false, 'On', inline=tp3S)src_short = input.string(title='Short TP1 Source', defval="lc2",⋯     tooltip="TP2 up or down control. Close process if selected 'source' is greater than TP2")-_3 = input(false, '|| STOP LOSS SETTINGS ||')+_3 = input.bool(false, '|| STOP LOSS SETTINGS ||')stoplossLong = input.float(7.1, "Long", minval = 0.1, step = 0.1, tooltip="Stop loss percent(Red line)")/100stoplossShort = input.float(7.9, "Short", minval = 0.1, step = 0.1)/100-_4 = input(false, '|| TRAILING STOP SETTINGS ||')+_4 = input.bool(false, '|| TRAILING STOP SETTINGS ||')-trailingSLOnOff = input(true, 'Long Trailing SL On', tooltip="Trailing stop loss mode.")+trailingSLOnOff = input.bool(true, 'Long Trailing SL On', tooltip="Trailing stop loss mode.")-trailingStopChangeL = input(true, 'Change Line', tooltip="On: If price is greater than TP1. Off: If price is greater than Long Position Check.")+trailingStopChangeL = input.bool(true, 'Change Line', tooltip="On: If price is greater than TP1. Off: If price is greater than Long Position Check.")trailingPercent = input.float(3.6, "Long", minval = 0.1, step = 0.1,     tooltip="Trailing stop loss percent. Note: Activated if greater than TP1. Otherwise, the stop level is the value on a bottom line.(Yellow dot line)")/100-trailingSLOnOff2 = input(false, 'Short Trailing SL On', tooltip="Trailing stop loss mode.")+trailingSLOnOff2 = input.bool(false, 'Short Trailing SL On', tooltip="Trailing stop loss mode.")-trailingStopChangeS = input(true, 'Change Line', tooltip="On: If price is greater than TP1. Off: If price is greater than Short Position Check.")+trailingStopChangeS = input.bool(true, 'Change Line', tooltip="On: If price is greater than TP1. Off: If price is greater than Short Position Check.")trailingPercent2 = input.float(3.4, "Short", minval = 0.1, step = 0.1,     tooltip="Trailing stop loss percent. Note: Activated if greater than TP1. Otherwise, the stop level is the value on a bottom line.(Yellow dot line)")/100-_5 = input(false, '|| POSITION CHECK SETTINGS ||')+_5 = input.bool(false, '|| POSITION CHECK SETTINGS ||')-LongpositionCheckOnOff = input(true, 'Long Position Check On',+LongpositionCheckOnOff = input.bool(true, 'Long Position Check On',     tooltip="Long Position check mode. Depends on TP1 percentage. It works as a '%X' / 'Senstive Value'.")⋯LongpositionCheck = input.float(1.7, "Senstive", minval = 1, step = 0.01)-ShortpositionCheckOnOff = input(true, 'Short Position Check On',+ShortpositionCheckOnOff = input.bool(true, 'Short Position Check On',     tooltip="Short Position check mode. It works as a '%X' / 'Senstive Value'.")⋯// WT Cross Setup-_6 = input(false, '|| WT CROSS SETTINGS ||')+_6 = input.bool(false, '|| WT CROSS SETTINGS ||')var wtlong = "WT LONG"-n1L = input(6, 'Channel Length')+n1L = input.int(6, 'Channel Length')-n2L = input(23, 'Average Length')+n2L = input.int(23, 'Average Length')apL = input.string(title='Source', defval='hlc3', ⋯var wtshort = "WT SHORT"-n1S = input(8, 'Channel Length')+n1S = input.int(8, 'Channel Length')-n2S = input(19, 'Average Length')+n2S = input.int(19, 'Average Length')apS = input.string(title='Source', defval='hlc3', ⋯// Hull Kahlman Setup-_7 = input(false, '|| HULLMA SETTINGS ||')+_7 = input.bool(false, '|| HULLMA SETTINGS ||')hull_source = input.string(title='Source', defval='hl2',      options=["hc2", "hco3", "lc2", "lco3", "co2", "hlo3", "lo2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"])-lengthhull = input(24, 'Lookback')+lengthhull = input.int(24, 'Lookback')-gain = input(10000, 'Gain')+gain = input.int(10000, 'Gain')float hull_src = switch hull_source⋯//Stoch RSI Settings-_8 = input(false, '|| STOCH RSI SETTINGS ||')+_8 = input.bool(false, '|| STOCH RSI SETTINGS ||')-rsistochOnOff = input(true, 'Stoch RSI', tooltip="Stoch RSI On/Off")+rsistochOnOff = input.bool(true, 'Stoch RSI', tooltip="Stoch RSI On/Off")smoothK = input.int(2, "K", minval=1)⋯//Vol Setup-_15 = input(false, '|| VOLUME SETTINGS ||')+_15 = input.bool(false, '|| VOLUME SETTINGS ||')-volumeonoff = input(true, 'On/Off')+volumeonoff = input.bool(true, 'On/Off')volume_f = input.float(0.6, title="Mult.", minval = 0, step = 0.1)⋯volEntry = volumeonoff ? volume > vol:volume-_16 = input(false, '|| ADX SETTINGS ||')+_16 = input.bool(false, '|| ADX SETTINGS ||')-adxon = input(false, 'On')+adxon = input.bool(false, 'On')-adxlen = input(14, title="ADX Smoothing")+adxlen = input.int(14, title="ADX Smoothing")-dilen = input(14, title="DI Length")+dilen = input.int(14, title="DI Length")-adxBuyLevel = input(20, title="Buy Level")+adxBuyLevel = input.int(20, title="Buy Level")dirmov(len) =>⋯// Wunderbit Settings-_9 = input(false, '|| WUNDERBIT SETTINGS ||')+_9 = input.bool(false, '|| WUNDERBIT SETTINGS ||')var wunder = "Wunderbit Comments"-longentryComment = input("ENTER-LONG", title = "Long Entry Comment", group=wunder)+longentryComment = input.string("ENTER-LONG", title = "Long Entry Comment", group=wunder)-longexitComment = input("EXIT-LONG", title = "Long Exit Comment", group=wunder)+longexitComment = input.string("EXIT-LONG", title = "Long Exit Comment", group=wunder)-shortentryComment = input("ENTER-SHORT", title = "Short Entry Comment", group=wunder)+shortentryComment = input.string("ENTER-SHORT", title = "Short Entry Comment", group=wunder)-shortexitComment = input("EXIT-SHORT", title = "Short Exit Comment", group=wunder)+shortexitComment = input.string("EXIT-SHORT", title = "Short Exit Comment", group=wunder)// Date Setup-_10 = input(false, '|| DATE & DATE RANGE SETTINGS ||')+_10 = input.bool(false, '|| DATE & DATE RANGE SETTINGS ||')startDate = input.time(timestamp("1 Jan 2020 00:00 +0000"), "Start Date")⋯var rangeL = "LONG"-sessionOnOff = input(true, 'Long/Time Range & Weekdays On/Off', tooltip="Start Date and End Date not inclueded", group=rangeL)+sessionOnOff = input.bool(true, 'Long/Time Range & Weekdays On/Off', tooltip="Start Date and End Date not inclueded", group=rangeL)timeSession = input.session("0000-0000", 'Time Range', group=rangeL)⋯var rangeS = "SHORT"-sessionOnOff2 = input(false, 'Short/Time Range & Weekdays On/Off', tooltip="Start Date and End Date not inclueded", group=rangeS)+sessionOnOff2 = input.bool(false, 'Short/Time Range & Weekdays On/Off', tooltip="Start Date and End Date not inclueded", group=rangeS)timeSession2 = input.session("0300-0300", 'Time Range', group=rangeS)⋯

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

⋯// Kahlman HullMA / WT Cross Strategy ©author [pigsq]-//@version=5+//@version=6strategy("Kahlman HullMA / WT Cross Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, initial_capital=100)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 103 msWith a workaround 1,000 bars in 304 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/// WT CROSS @author [LazyBear]// Kahlman HullMA / WT Cross Strategy ©author [pigsq]//@version=5strategy("Kahlman HullMA / WT Cross Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, initial_capital=100)//Inputs_1 = input(false, '|| LONG TP SETTINGS ||')long = input(true, 'Long On')LongprofitPercent = input.float(10, "TP1 Profit Percent", minval = 0, maxval = 100, step = 5, tooltip="Percentage of balance to be taken for take profit 1-2.")LongprofitPercent2 = input.float(15, "TP2 Profit Percent", minval = 0, maxval = 100, step = 5, tooltip="Percentage of balance to be taken for take profit 1-2.")takeprofitLong = input.float(8.9, "Long Take Profit 1", minval = 0.1, step = 0.1, tooltip="Long take profit 1 percent setting")/100var tp2L = "tp2L"takeprofit2Long = input.float(13.6, "Long Take Profit 2", minval = 0.1, step = 0.1, tooltip="Long take profit 2 percent setting. / Close TP2", inline=tp2L)/100tp2OnOffL = input(true, 'On', inline=tp2L)var tp3L = "tp3L"takeprofit3Long = input.float(13.6, "Long Take Profit 3", minval = 0.1, step = 0.1, tooltip="Long take profit 3 percent setting. / Close TP3", inline=tp3L)/100tp3OnOffL = input(false, 'On', inline=tp3L)src_long = input.string(title='Long TP1 Source', defval="hc2",     options=["hc2", "co2", "hco3", "hlo3", "ho2", "lo2", "open", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high"],     tooltip="TP1 up or down control. Close process if selected 'source' is less than TP1")src_long2 = input.string(title='Long TP2 Source', defval="hc2",      options=["hc2", "co2", "hco3", "hlo3", "ho2", "lo2", "open", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high"],      tooltip="TP2 up or down control. Close process if selected 'source' is less than TP2")_2 = input(false, '|| SHORT TP SETTINGS ||')short = input(true, 'Short On')ShortprofitPercent = input.float(50, "TP1 Profit Percent", minval = 0, maxval = 100, step = 5, tooltip="Percentage of balance to be taken for take profit 1-2.")ShortprofitPercent2 = input.float(70, "TP2 Profit Percent", minval = 0, maxval = 100, step = 5, tooltip="Percentage of balance to be taken for take profit 1-2.")takeprofitShort = input.float(8.2, "Short Take Profit 1", minval = 0.1, step = 0.1, tooltip="Short take profit 1 percent setting")/100var tp2S = "tp2S"takeprofit2Short = input.float(13.4, "Short Take Profit 2", minval = 0.1, step = 0.1, tooltip="Short take profit 2 percent setting. / Close TP3", inline=tp2S)/100tp2OnOffS = input(true, 'On', inline=tp2S)var tp3S = "tp3S"takeprofit3Short = input.float(13.9, "Short Take Profit 3", minval = 0.1, step = 0.1, tooltip="Short take profit 3 percent setting. / Close TP3", inline=tp3S)/100tp3OnOffS = input(false, 'On', inline=tp3S)src_short = input.string(title='Short TP1 Source', defval="lc2",     options=["lc2", "lco3", "hco3", "hc2", "co2", "hlo3", "lo2", "ho2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"],     tooltip="TP1 up or down control. Close process if selected 'source' is greater than TP1")src_short2 = input.string(title='Short TP2 Source', defval="lco3",      options=["lc2", "lco3", "hco3", "hc2", "co2", "hlo3", "lo2", "ho2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"],     tooltip="TP2 up or down control. Close process if selected 'source' is greater than TP2")_3 = input(false, '|| STOP LOSS SETTINGS ||')stoplossLong = input.float(7.1, "Long", minval = 0.1, step = 0.1, tooltip="Stop loss percent(Red line)")/100stoplossShort = input.float(7.9, "Short", minval = 0.1, step = 0.1)/100_4 = input(false, '|| TRAILING STOP SETTINGS ||')trailingSLOnOff = input(true, 'Long Trailing SL On', tooltip="Trailing stop loss mode.")trailingStopChangeL = input(true, 'Change Line', tooltip="On: If price is greater than TP1. Off: If price is greater than Long Position Check.")trailingPercent = input.float(3.6, "Long", minval = 0.1, step = 0.1,     tooltip="Trailing stop loss percent. Note: Activated if greater than TP1. Otherwise, the stop level is the value on a bottom line.(Yellow dot line)")/100trailingSLOnOff2 = input(false, 'Short Trailing SL On', tooltip="Trailing stop loss mode.")trailingStopChangeS = input(true, 'Change Line', tooltip="On: If price is greater than TP1. Off: If price is greater than Short Position Check.")trailingPercent2 = input.float(3.4, "Short", minval = 0.1, step = 0.1,     tooltip="Trailing stop loss percent. Note: Activated if greater than TP1. Otherwise, the stop level is the value on a bottom line.(Yellow dot line)")/100_5 = input(false, '|| POSITION CHECK SETTINGS ||')LongpositionCheckOnOff = input(true, 'Long Position Check On',     tooltip="Long Position check mode. Depends on TP1 percentage. It works as a '%X' / 'Senstive Value'.")src_LongpositionCheck = input.string(title='Source', defval="co2",     options=["hco3", "lco3", "hc2", "lc2", "co2", "ho2", "lo2", "hlo3", "close", "open", "hl2", "hlc3", "ohlc4", "hlcc4", "low", "high"],     tooltip="Long check senstive up or down control. Close process if selected 'source' is less than Position Check Line(Yellow solid line)")LongpositionCheck = input.float(1.7, "Senstive", minval = 1, step = 0.01)ShortpositionCheckOnOff = input(true, 'Short Position Check On',     tooltip="Short Position check mode. It works as a '%X' / 'Senstive Value'.")src_ShortpositionCheck = input.string(title='Source', defval="low",     options=["lco3", "hco3", "lc2", "hc2", "co2", "lo2", "ho2", "hlo3", "close", "open", "hl2", "hlc3", "ohlc4", "hlcc4", "low", "high"],     tooltip="Short check senstive up or down control. Close process if selected 'source' is greater than Position Check Line(Yellow solid line)")ShortpositionCheck = input.float(1.4, "Senstive", minval = 1, step = 0.01)//Long TP1 sourcefloat source_long = switch src_long    "hc2" => (high + close)/2    "hco3" => (high + close + open)/3    "co2" => (open + close)/2    "hlo3" => (open + high + low)/3    "ho2" => (open + high)/2    "lo2" => (low + open)/2    "lc2" => (low + close)/2    "lco3" => (low + close + open)/3    "open" => open    "close" => close    "hlc3" => hlc3    "hl2" => hl2    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "low" => low    "high" => high//Long TP2 sourcefloat source_long2 = switch src_long2    "hc2" => (high + close)/2    "hco3" => (high + close + open)/3    "co2" => (open + close)/2    "lc2" => (low + close)/2    "lco3" => (low + close + open)/3    "hlo3" => (open + high + low)/3    "lo2" => (open + low)/2    "ho2" => (high + open)/2    "open" => open    "close" => close    "hlc3" => hlc3    "hl2" => hl2    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "low" => low    "high" => high//Short TP1 sourcefloat source_short = switch src_short    "lc2" => (low + close)/2    "lco3" => (low + close + open)/3    "co2" => (open + close)/2    "hlo3" => (open + high + low)/3    "lo2" => (open + low)/2    "ho2" => (high + open)/2    "hc2" => (high + close)/2    "hco3" => (high + close + open)/3    "close" => close    "hlc3" => hlc3    "hl2" => hl2    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "low" => low    "high" => high    "open" => open//Short TP2 sourcefloat source_short2 = switch src_short2    "lc2" => (low + close)/2    "lco3" => (low + close + open)/3    "co2" => (open + close)/2    "hlo3" => (open + high + low)/3    "lo2" => (open + low)/2    "ho2" => (high + open)/2    "hc2" => (high + close)/2    "hco3" => (high + close + open)/3    "close" => close    "hlc3" => hlc3    "hl2" => hl2    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "low" => low    "high" => high    "open" => open//Long position check sourcefloat source_CheckLong = switch src_LongpositionCheck    "hco3" => (high + close + open)/3    "lco3" => (low + close + open)/3    "hc2" => (high + close)/2    "lc2" => (low + close)/2    "hlo3" => (open + high + low)/3    "co2" => (open + close)/2    "ho2" => (open + high)/2    "lo2" => (low + open)/2    "close" => close    "hl2" => hl2    "hlc3" => hlc3    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "low" => low    "high" => high    "open" => open//Short position check sourcefloat source_CheckShort = switch src_ShortpositionCheck    "lco3" => (low + close + open)/3    "hco3" => (high + close + open)/3    "lc2" => (low + close)/2    "hc2" => (high + close)/2    "hlo3" => (open + high + low)/3    "co2" => (open + close)/2    "lo2" => (open + low)/2    "ho2" => (high + open)/2    "close" => close    "hl2" => hl2    "hlc3" => hlc3    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "high" => high    "open" => open    "low" => low// WT Cross Setup_6 = input(false, '|| WT CROSS SETTINGS ||')var wtlong = "WT LONG"n1L = input(6, 'Channel Length')n2L = input(23, 'Average Length')apL = input.string(title='Source', defval='hlc3',      options=["hc2", "hco3", "lc2", "lco3", "co2", "hlo3", "lo2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"])float apL_src = switch apL    "hc2" => (high + close)/2    "hco3" => (high + close + open)/3    "lc2" => (low + close)/2    "lco3" => (low + close + open)/3    "co2" => (open + close)/2    "hlo3" => (open + high + low)/3    "lo2" => (open + low)/2    "close" => close    "hlc3" => hlc3    "hl2" => hl2    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "low" => low    "high" => high    "open" => open    esaL = ta.ema(apL_src, n1L)rL = ta.ema(math.abs(apL_src - esaL), n1L)ciL = (apL_src - esaL) / (0.015 * rL)tciL = ta.ema(ciL, n2L)wt1L = tciLwt2L = ta.sma(wt1L, 4)// WT SHORTvar wtshort = "WT SHORT"n1S = input(8, 'Channel Length')n2S = input(19, 'Average Length')apS = input.string(title='Source', defval='hlc3',      options=["hc2", "hco3", "lc2", "lco3", "co2", "hlo3", "lo2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"])float apS_src = switch apS    "hc2" => (high + close)/2    "hco3" => (high + close + open)/3    "lc2" => (low + close)/2    "lco3" => (low + close + open)/3    "co2" => (open + close)/2    "hlo3" => (open + high + low)/3    "lo2" => (open + low)/2    "close" => close    "hlc3" => hlc3    "hl2" => hl2    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "low" => low    "high" => high    "open" => openesaS = ta.ema(apS_src, n1S)rS = ta.ema(math.abs(apS_src - esaS), n1S)ciS = (apS_src - esaS) / (0.015 * rS)tciS = ta.ema(ciS, n2S)wt1S = tciSwt2S = ta.sma(wt1S, 4)// Hull Kahlman Setup_7 = input(false, '|| HULLMA SETTINGS ||')hull_source = input.string(title='Source', defval='hl2',      options=["hc2", "hco3", "lc2", "lco3", "co2", "hlo3", "lo2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"])lengthhull = input(24, 'Lookback')gain = input(10000, 'Gain')float hull_src = switch hull_source    "hc2" => (high + close)/2    "hco3" => (high + close + open)/3    "lc2" => (low + close)/2    "lco3" => (low + close + open)/3    "co2" => (open + close)/2    "hlo3" => (open + high + low)/3    "lo2" => (open + low)/2    "close" => close    "hlc3" => hlc3    "hl2" => hl2    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "low" => low    "high" => high    "open" => openhma(_hull_src, _lengthhull) =>    ta.wma((2 * ta.wma(_hull_src, _lengthhull / 2)) - ta.wma(_hull_src, _lengthhull), math.round(math.sqrt(_lengthhull)))hma3(_hull_src, _lengthhull) =>    p = lengthhull / 2    ta.wma(ta.wma(close, p / 3) * 3 - ta.wma(close, p / 2) - ta.wma(close, p), p)kahlman(x, g) =>    kf = 0.0    dk = x - nz(kf[1], x)    smooth = nz(kf[1], x) + dk * math.sqrt(g / 10000 * 2)    velo = 0.0    velo := nz(velo[1], 0) + g / 10000 * dk    kf := smooth + velo    kfa = kahlman(hma(hull_src, lengthhull), gain)b = kahlman(hma3(hull_src, lengthhull), gain)c = b > a ? color.lime : color.redcrossdn = a > b and a[1] < b[1]crossup = b > a and b[1] < a[1]p1hma = plot(a, color=color.new(c, 75), linewidth=1, title='Long Plot')p2hma = plot(b, color=color.new(c, 75), linewidth=1, title='Short Plot')fill(p1hma, p2hma, color=color.new(c, 75), title='Fill')//Stoch RSI Settings_8 = input(false, '|| STOCH RSI SETTINGS ||')rsistochOnOff = input(true, 'Stoch RSI', tooltip="Stoch RSI On/Off")smoothK = input.int(2, "K", minval=1)smoothD = input.int(3, "D", minval=1)lengthRSI = input.int(13, "RSI Length", minval=1)lengthStoch = input.int(13, "Stochastic Length", minval=1)src = input.string(title='RSI Source', defval='hl2',      options=["hc2", "hco3", "lc2", "lco3", "co2", "hlo3", "lo2", "close", "hlc3", "hl2", "ohlc4", "hlcc4", "low", "high", "open"])float src_src = switch src    "hc2" => (high + close)/2    "hco3" => (high + close + open)/3    "lc2" => (low + close)/2    "lco3" => (low + close + open)/3    "co2" => (open + close)/2    "hlo3" => (open + high + low)/3    "lo2" => (open + low)/2    "close" => close    "hlc3" => hlc3    "hl2" => hl2    "ohlc4" => ohlc4    "hlcc4" => hlcc4    "low" => low    "high" => high    "open" => openrsi1 = ta.rsi(src_src, lengthRSI)k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)d = ta.sma(k, smoothD)LStoch = rsistochOnOff ? k > d:closeSStoch = rsistochOnOff ? k < d:close//Vol Setup_15 = input(false, '|| VOLUME SETTINGS ||')volumeonoff = input(true, 'On/Off')volume_f = input.float(0.6, title="Mult.", minval = 0, step = 0.1)sma_length = input.int(3, title="Sma volume lenght", minval = 1)vwma_length = input.int(3, title="Vwma volume lenght", minval = 1)wma_length = input.int(4, title="Wma volume lenght", minval = 1)vol = ((ta.sma(volume, sma_length) + ta.vwma(volume, vwma_length) + ta.wma(volume, wma_length)) / 3) * volume_fvolEntry = volumeonoff ? volume > vol:volume_16 = input(false, '|| ADX SETTINGS ||')adxon = input(false, 'On')adxlen = input(14, title="ADX Smoothing")dilen = input(14, title="DI Length")adxBuyLevel = input(20, title="Buy Level")dirmov(len) =>    up = ta.change(high)    down = -ta.change(low)    plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)    minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)    truerange = ta.rma(ta.tr, len)    plus = fixnan(100 * ta.rma(plusDM, len) / truerange)    minus = fixnan(100 * ta.rma(minusDM, len) / truerange)    [plus, minus]adx(dilen, adxlen) =>    [plus, minus] = dirmov(dilen)    sum = plus + minus    adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)sig = adx(dilen, adxlen)ADXEntry = if adxon    sig > adxBuyLevelelse    sig < 100// Wunderbit Settings_9 = input(false, '|| WUNDERBIT SETTINGS ||')var wunder = "Wunderbit Comments"longentryComment = input("ENTER-LONG", title = "Long Entry Comment", group=wunder)longexitComment = input("EXIT-LONG", title = "Long Exit Comment", group=wunder)shortentryComment = input("ENTER-SHORT", title = "Short Entry Comment", group=wunder)shortexitComment = input("EXIT-SHORT", title = "Short Exit Comment", group=wunder)// Date Setup_10 = input(false, '|| DATE & DATE RANGE SETTINGS ||')startDate = input.time(timestamp("1 Jan 2020 00:00 +0000"), "Start Date")endDate = input.time(timestamp("1 Jan 9999 03:00 +0000"), "End Date")var rangeL = "LONG"sessionOnOff = input(true, 'Long/Time Range & Weekdays On/Off', tooltip="Start Date and End Date not inclueded", group=rangeL)timeSession = input.session("0000-0000", 'Time Range', group=rangeL)d_monday        = input.bool(title="Monday", defval=true, inline="D1", group=rangeL)d_tuesday       = input.bool(title="Tuesday", defval=true, inline="D1", group=rangeL)d_wednesday     = input.bool(title="Wednesday", defval=true, inline="D1", group=rangeL)d_thursday      = input.bool(title="Thursday", defval=true, inline="D2", group=rangeL)d_friday        = input.bool(title="Friday", defval=true, inline="D2", group=rangeL)d_saturday      = input.bool(title="Saturday", defval=false, inline="D2", group=rangeL)d_sunday        = input.bool(title="Sunday", defval=true, tooltip="Trade days?", inline="D2", group=rangeL)days = d_sunday ? "1" : ""days := days + (d_monday ? "2" : "")days := days + (d_tuesday ? "3" : "")days := days + (d_wednesday ? "4" : "")days := days + (d_thursday ? "5" : "")days := days + (d_friday ? "6" : "")days := days + (d_saturday ? "7" : "")strategyTime = time >= startDate and time <= endDate ? true : falseinSession(session) =>    if sessionOnOff        na(time(timeframe.period, session + ":" + days)) == false and strategyTime    else        strategyTime        // For Shortvar rangeS = "SHORT"sessionOnOff2 = input(false, 'Short/Time Range & Weekdays On/Off', tooltip="Start Date and End Date not inclueded", group=rangeS)timeSession2 = input.session("0300-0300", 'Time Range', group=rangeS)d_monday2       = input.bool(title="Monday", defval=true, inline="D3", group=rangeS)d_tuesday2       = input.bool(title="Tuesday", defval=true, inline="D3", group=rangeS)d_wednesday2     = input.bool(title="Wednesday", defval=true, inline="D3", group=rangeS)d_thursday2      = input.bool(title="Thursday", defval=true, inline="D4", group=rangeS)d_friday2        = input.bool(title="Friday", defval=true, inline="D4", group=rangeS)d_saturday2      = input.bool(title="Saturday", defval=true, inline="D4", group=rangeS)d_sunday2        = input.bool(title="Sunday", defval=true, tooltip="Trade days?", inline="D4", group=rangeS)days2 = d_sunday2 ? "1" : ""days2 := days2 + (d_monday2 ? "2" : "")days2 := days2 + (d_tuesday2 ? "3" : "")days2 := days2 + (d_wednesday2 ? "4" : "")days2 := days2 + (d_thursday2 ? "5" : "")days2 := days2 + (d_friday2 ? "6" : "")days2 := days2 + (d_saturday2 ? "7" : "")inSession2(session2) =>    if sessionOnOff2        na(time(timeframe.period, session2 + ":" + days2)) == false and time >= startDate and time <= endDate    else        time >= startDate and time <= endDate ? true : false// SL-TP SetupslongConditionDirection = strategy.position_size >= 0shortConditionDirection = strategy.position_size <= 0// Long Line SetupexitSL = if longConditionDirection    strategy.position_avg_price * (1 - stoplossLong)else    strategy.position_avg_price * (1 + stoplossShort)exitTP = if longConditionDirection    strategy.position_avg_price * (1 + takeprofitLong)else    strategy.position_avg_price * (1 - takeprofitShort)exitTP2 = if longConditionDirection    strategy.position_avg_price * (1 + takeprofit2Long)else    strategy.position_avg_price * (1 - takeprofit2Short)exitTP3 = if longConditionDirection    strategy.position_avg_price * (1 + takeprofit3Long)else    strategy.position_avg_price * (1 - takeprofit3Short)    positionCheckLong = if LongpositionCheckOnOff    longConditionDirection ? strategy.position_avg_price * (1 + takeprofitLong/LongpositionCheck):napositionCheckShort = if ShortpositionCheckOnOff    shortConditionDirection ? strategy.position_avg_price * (1 - takeprofitShort/ShortpositionCheck):na // Long-Short Condition SetuplongCondition = crossup and ta.crossover(wt1L,wt2L) and LStoch or     crossup and ta.crossover(wt1L[1],wt2L[1]) and LStoch or     crossup and ta.crossover(wt1L[2],wt2L) and LStochshortCondition = crossdn and ta.crossunder(wt1S,wt2S) and SStoch// Trailing Long Stop SetuptrailingStopChangeL1 = trailingStopChangeL ? high >= exitTP or high[1] >= exitTP:     high >= positionCheckLong or high[1] >= positionCheckLongpriceStopL = 0.0priceStopL := if longConditionDirection and trailingStopChangeL1 and trailingSLOnOff    stopMeasure = close * (1 - trailingPercent)    math.max(stopMeasure, priceStopL[1])else if longConditionDirection    exitSL// Trailing Short Stop SetuptrailingStopChangeS1 = trailingStopChangeS ? low <= exitTP or low[1] <= exitTP:     low <= positionCheckShort or low[1] <= positionCheckShortpriceStopS = 0.0priceStopS := if shortConditionDirection and trailingStopChangeS1 and trailingSLOnOff2    stopMeasure = close * (1 + trailingPercent2)    math.min(stopMeasure, priceStopS[1])else if shortConditionDirection    exitSL// Position Check ControlpositionCheckLong2 =     high >= positionCheckLong and ta.crossunder(wt1L,wt2L) and source_CheckLong < positionCheckLong or     high >= positionCheckLong and ta.crossunder(wt1S,wt2S) and source_CheckLong < positionCheckLong or     high >= positionCheckLong and a > b and source_CheckLong < positionCheckLong and wt1L < wt2L and not volEntry or     high >= positionCheckLong and a > b and source_CheckLong < positionCheckLong and wt1S < wt2S and not volEntry or     high >= positionCheckLong and crossdn and source_CheckLong < positionCheckLongpositionCheckShort2 =     low <= positionCheckShort and ta.crossover(wt1S,wt2S) and source_CheckShort > positionCheckShort or     low <= positionCheckShort and ta.crossover(wt1L,wt2L) and source_CheckShort > positionCheckShort or     low <= positionCheckShort and a < b and source_CheckShort > positionCheckShort and wt1S > wt2S and not volEntry or     low <= positionCheckShort and a < b and source_CheckShort > positionCheckShort and wt1L > wt2L and not volEntry or     low <= positionCheckShort and crossup and source_CheckShort > positionCheckShort// TP's ControllongTStop = high >= exitTP and source_long <= exitTP or     high >= exitTP2 and source_long2 <= exitTP2 or     high >= exitTP2 and a > bshortTStop = low <= exitTP and source_short >= exitTP or     low <= exitTP2 and source_short2 >= exitTP2 or     low <= exitTP2 and a < b// Long-Short Condition CloselongConditionExit = if high <= strategy.position_avg_price or high >= positionCheckLong    shortCondition or positionCheckLong2shortConditionExit = if low >= strategy.position_avg_price or low <= positionCheckShort    longCondition or positionCheckShort2if strategyTime    if longConditionDirection and longCondition and long and volEntry and ADXEntry        if inSession(sessionOnOff ? timeSession:na)            strategy.entry("LONG", strategy.long, comment=longentryComment)    strategy.exit("LONG", stop=priceStopL, qty_percent=tp2OnOffL ? LongprofitPercent:100, limit=exitTP, comment=longexitComment)    if tp2OnOffL        strategy.exit("LONG1", stop=priceStopL, qty_percent=tp3OnOffL ? LongprofitPercent2:100, limit=exitTP2, comment=longexitComment)    if tp3OnOffL        strategy.exit("LONG2", stop=priceStopL, qty_percent=100, limit=exitTP3, comment=longexitComment)    if longConditionExit or longTStop        strategy.close("LONG", comment=longexitComment)    if shortConditionDirection and shortCondition and short and volEntry and ADXEntry        if inSession2(sessionOnOff2 ? timeSession2:na)            strategy.entry("SHORT", strategy.short, comment=shortentryComment)    strategy.exit("SHORT", stop=priceStopS, qty_percent=tp2OnOffS ? ShortprofitPercent:100, limit=exitTP, comment=shortexitComment)    if tp2OnOffS        strategy.exit("SHORT1", stop=priceStopS, qty_percent=tp3OnOffS ? ShortprofitPercent2:100, limit=exitTP2, comment=shortexitComment)    if tp3OnOffS        strategy.exit("SHORT2", stop=priceStopS, qty_percent=100, limit=exitTP3, comment=shortexitComment)    if shortConditionExit or shortTStop        strategy.close("SHORT", comment=shortexitComment)// SL-TP LinesLSTP2Lines = longConditionDirection ? tp2OnOffL ? exitTP2:na:shortConditionDirection ? tp2OnOffS ? exitTP2:na:naLSTP3Lines = longConditionDirection ? tp3OnOffL ? tp2OnOffL ? exitTP3:na:na:shortConditionDirection ? tp3OnOffS ? tp2OnOffS ? exitTP3:na:na:naplot(exitTP, title='Long/Short TP1', color=color.lime, style=plot.style_linebr, linewidth=1)plot(LSTP2Lines, title='Long/Short TP2', color=color.lime, style=plot.style_linebr, linewidth=1)plot(LSTP3Lines, title='Long/Short TP3', color=color.lime, style=plot.style_linebr, linewidth=1)// L/S Stop Loss Linesplot(exitSL, title='Long/Short SL', color=color.red, style=plot.style_linebr, linewidth=1)// Position Check LinesPositionCheckColors = LongpositionCheckOnOff and positionCheckLong ? color.yellow :     ShortpositionCheckOnOff and positionCheckShort ? color.yellow:naPositionCheckLines = LongpositionCheckOnOff and longConditionDirection ? positionCheckLong :     ShortpositionCheckOnOff and shortConditionDirection ? positionCheckShort:naplot(PositionCheckLines, title='Long/Short Position Check', color=PositionCheckColors, style=plot.style_linebr, linewidth=1)// Trailing Stop LinesTrailingStopLines = trailingSLOnOff ? longConditionDirection and trailingStopChangeL1 ? priceStopL:na:naTrailingStopLines2 = trailingSLOnOff2 ? shortConditionDirection and trailingStopChangeS1 ? priceStopS:na:naplot(TrailingStopLines, title='Long Trailing Stop', color=color.yellow, style=plot.style_circles, linewidth=1)plot(TrailingStopLines2, title='Short Trailing Stop', color=color.yellow, style=plot.style_circles, linewidth=1)// Date Range Background Color// bgcolor(sessionOnOff ? inSession(timeSession) ? color.rgb(91, 255, 0, 95):na:na, title="Long Time Range Bg Color")// bgcolor(sessionOnOff2 ? inSession2(timeSession2) ? color.rgb(91, 255, 0, 95):na:na, title="Short Time Range Bg Color")