Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

ADX_TSI_Bol Band Trend Chaser

A Pine Script v4 strategy built on SMA (close, 20), Stdev (close, 20) and WMA (close, 25). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 10% of equity and pays 0.1 commission. 11 settings; defaults include Length 20, Source close and StdDev 0.382.

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 ADX_TSI_Bol Band Trend Chaser repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did ADX_TSI_Bol Band Trend Chaser do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
Can ADX_TSI_Bol Band Trend Chaser be converted to Pine Script v5?
Not tested
The steps are shown below, but neither version placed a trade on any market tested, so there was nothing to compare and no download is offered.
Does ADX_TSI_Bol Band Trend Chaser use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does ADX_TSI_Bol Band Trend Chaser run in Zeal Terminal?
Yes
It compiles in 27 ms and runs 1,000 bars in 98 ms, in the browser.

BTCUSDT · 1D · default settings

  • Basis
  • Upper
  • Lower
  • MA
  • Plot
  • Plot
  • Zero
  • ADX
  • ADX Keyline
  • 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 (11)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctBasis$10,000$20,253Equity from $10,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. Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 98) so the engine trades the way the script says.
Net profit
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.00%
$0.00

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

    “Keylevel for ADX” is declared but never read.

  • Check

    No stop loss

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

  • Note

    1 setting has no label

    In the settings dialog length (line 18) shows 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 98, 99. The upgraded version below moves each call inside an if block.

  • Note

    Uses transp =, which v5 removed line 29

    transp = on line 29, 71. v5 folds the transparency into the colour with color.new(c, transp).

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames sma → ta.sma, stdev → ta.stdev, wma → ta.wma, change → ta.change, abs → math.abs, rma → ta.rma, crossunder → ta.crossunder, crossover → ta.crossover.
  • 2 strategy calls use the when = argument (line 98, 99). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Not verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 12: //@version=4 → //@version=5
  • Line 21: sma → ta.sma
  • Line 22: stdev → ta.stdev
  • Line 25: input(type = input.integer) → input.int()
  • Line 29: transp = 85 → color.new(#787B86, 85)
  • Line 33: sma → ta.sma
21 more edits
  • Line 37: input(type = input.integer) → input.int()
  • Line 38: input(type = input.integer) → input.int()
  • Line 39: input(type = input.integer) → input.int()
  • Line 41: wma → ta.wma
  • Line 42: wma → ta.wma
  • Line 44: change → ta.change
  • Line 46: abs → math.abs
  • Line 48: wma → ta.wma
  • Line 50: wma → ta.wma
  • Line 58: change → ta.change
  • Line 59: change → ta.change
  • Line 62: rma → ta.rma
  • Line 62: tr → ta.tr
  • Line 63: rma → ta.rma
  • Line 64: rma → ta.rma
  • Line 69: rma → ta.rma
  • Line 69: abs → math.abs
  • Line 71: transp = 40 → color.new(color.black, 40)
  • Line 91: crossunder → ta.crossunder
  • Line 94: crossover → ta.crossover
  • Line 98: strategy.entry(…, true) → strategy.entry(…, strategy.long)
⋯//-------------//@version=4+//@version=5strategy(shorttitle="Trend Chaser", title="ADX_TSI_Bol Band Trend Chaser", overlay=false, pyramiding=0,⋯mult = input(0.382, minval=0.001, maxval=50, title="StdDev")-basis = sma(src, length)+basis = ta.sma(src, length)-dev = mult * stdev(src, length)+dev = mult * ta.stdev(src, length)upper = basis + devlower = basis - dev-offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)+offset = input.int(0, "Offset", minval = -500, maxval = 500)plot(basis, "Basis", color=color.gray, offset = offset, display=display.none)⋯p2 = plot(lower, "Lower", color=color.gray, offset = offset, display=display.none)-fill(p1, p2, title = "Background", color=#787B86, transp=85)+fill(p1, p2, title = "Background", color=color.new(#787B86, 85))//------------⋯MAlen = input(200, minval=1, title="Length")-MAout = sma(src, MAlen)+MAout = ta.sma(src, MAlen)plot(MAout, color=color.black, title="MA", offset=offset, linewidth=2, display=display.none)⋯//True Strength WMA-TSlong = input(title="Long Length", type=input.integer, defval=25)+TSlong = input.int(title="Long Length", defval=25)-TSshort = input(title="Short Length", type=input.integer, defval=13)+TSshort = input.int(title="Short Length", defval=13)-TSsignal = input(title="Signal Length", type=input.integer, defval=52)+TSsignal = input.int(title="Signal Length", defval=52)double_smooth(src, TSlong, TSshort) =>-    fist_smooth = wma(src, TSlong)+    fist_smooth = ta.wma(src, TSlong)-    wma(fist_smooth, TSshort)+    ta.wma(fist_smooth, TSshort)price = close     -pc = change(price)+pc = ta.change(price)double_smoothed_pc = double_smooth(pc, TSlong, TSshort)-double_smoothed_abs_pc = double_smooth(abs(pc), TSlong, TSshort)+double_smoothed_abs_pc = double_smooth(math.abs(pc), TSlong, TSshort)tsi_value = 100 * (double_smoothed_pc / double_smoothed_abs_pc)-tsi2 = wma(tsi_value, TSsignal)+tsi2 = ta.wma(tsi_value, TSsignal)plot(tsi_value, color=color.blue)-plot(wma(tsi_value, TSsignal), color=color.red)+plot(ta.wma(tsi_value, TSsignal), color=color.red)hline(0, title="Zero")⋯dirmov(len) =>-    up = change(high)+    up = ta.change(high)-    down = -change(low)+    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 = rma(tr, len)+    truerange = ta.rma(ta.tr, len)-    plus = fixnan(100 * rma(plusDM, len) / truerange)+    plus = fixnan(100 * ta.rma(plusDM, len) / truerange)-    minus = fixnan(100 * rma(minusDM, len) / truerange)+    minus = fixnan(100 * ta.rma(minusDM, len) / truerange)    [plus, minus]⋯    sum = plus + minus-    adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)+    adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)sig = adx(dilen, adxlen)-plot(sig, color=color.black, title="ADX", style=plot.style_histogram, transp=40)+plot(sig, color=color.new(color.black, 40), title="ADX", style=plot.style_histogram)plot(20, color=color.green, title="ADX Keyline", linewidth=1)⋯Buy = Long1 and Long2 and Long3 and ADXkey-CloseLong = crossunder(tsi_value,tsi2)+CloseLong = ta.crossunder(tsi_value,tsi2)//ShortSell = Short1 and Short2 and Short3 and ADXkey-CloseShort = crossover(tsi_value,tsi2)+CloseShort = ta.crossover(tsi_value,tsi2)//------------⋯if time >= start and time <= end-    strategy.entry("Long", true, when = Buy)+    strategy.entry("Long", strategy.long, when = Buy)strategy.close("Long", when = CloseLong)

Clean v5

Not verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 18: input() → input.int()
  • Line 19: input() → input.source()
  • Line 20: input() → input.float()
  • Line 32: input() → input.int()
  • Line 54: input() → input.int()
  • Line 55: input() → input.int()
3 more edits
  • Line 56: input() → input.int()
  • Line 98: when = Buy → if block
  • Line 99: when = CloseLong → if block
⋯//Custom Bollinger Band-length = input(20, minval=1)+length = input.int(20, minval=1)-src = input(close, title="Source")+src = input.source(close, title="Source")-mult = input(0.382, minval=0.001, maxval=50, title="StdDev")+mult = input.float(0.382, minval=0.001, maxval=50, title="StdDev")basis = ta.sma(src, length)⋯//Moving Average-MAlen = input(200, minval=1, title="Length")+MAlen = input.int(200, minval=1, title="Length")MAout = ta.sma(src, MAlen)⋯//ADX-adxlen = input(13, title="ADX Smoothing")+adxlen = input.int(13, title="ADX Smoothing")-dilen = input(13, title="DI Length")+dilen = input.int(13, title="DI Length")-keyLevel = input(20, title="Keylevel for ADX")+keyLevel = input.int(20, title="Keylevel for ADX")dirmov(len) =>⋯if time >= start and time <= end-    strategy.entry("Long", strategy.long, when = Buy)+    if Buy+        strategy.entry("Long", strategy.long)-strategy.close("Long", when = CloseLong)+if CloseLong+    strategy.close("Long")

Does it run in Pine Script v6?

Not tested

Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯//-------------//@version=5+//@version=6strategy(shorttitle="Trend Chaser", title="ADX_TSI_Bol Band Trend Chaser", overlay=false, pyramiding=0,⋯

Settings

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

SettingDefaultType and rangeFeeds
Length (no label in the script)20int · min 1basis dev
Sourceclosesourcebasis dev MAout fist_smooth
StdDev0.382float · min 0.001 · max 50dev
Offset0int (written input.integer) · min -500 · max 500Upper Lower Basis MA
Length200int · min 1MAout
Long Length25int (written input.integer)fist_smooth double_smoothed_pc double_smoothed_abs_pc
Short Length13int (written input.integer)double_smoothed_pc double_smoothed_abs_pc line 42
Signal Length52int (written input.integer)tsi2 plot
ADX Smoothing13intadx sig ADXkey
DI Length13intplus minus sig ADXkey
Keylevel for ADX20intunused

What it calculates

  • SMA (sma, ta.sma in v5)Source (close), Length (20)basis · line 21
  • Stdev (stdev, ta.stdev in v5)Source (close), Length (20)dev · line 22
  • SMA (sma, ta.sma in v5)Source (close), Length (200)MAout · line 33
  • WMA (wma, ta.wma in v5)Source (close), Long Length (25)fist_smooth · line 41
  • Change (change, ta.change in v5)pricepc · line 44
  • WMA (wma, ta.wma in v5)tsi_value, Signal Length (52)tsi2 · line 48
  • Change (change, ta.change in v5)highup · line 58
  • Change (change, ta.change in v5)lowdown · line 59
  • RMA (rma, ta.rma in v5)tr, lentruerange · line 62
  • RMA (rma, ta.rma in v5)abs(plus - minus) / (sum == 0 ? 1 : sum), ADX Smoothing (13)adx · line 69
  • Crossunder (crossunder, ta.crossunder in v5)tsi_value, tsi2CloseLong · line 91
  • Crossover (crossover, ta.crossover in v5)tsi_value, tsi2CloseShort · line 94

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 datalengthLengthsetting · 20multStdDevsetting · 0.382MAlenLengthsetting · 200TSlongLong Lengthsetting · 25TSsignalSignal Lengthsetting · 52highhighprice datalowlowprice dataadxlenADX Smoothingsetting · 13TSshortShort Lengthsetting · 13dilenDI Lengthsetting · 13basisSMA→ basisdevStdev→ devMAoutSMA→ MAoutfist_smoothWMA→ fist_smoothpcChange→ pctsi2WMA→ tsi2upChange→ updownChange→ downtruerangeRMA→ truerangeadxRMA→ adxCloseLongCrossunder→ CloseLongCloseShortCrossover→ CloseShortupper, lowerupper · lower2 valuespricepricevaluedouble_smoothed_pc, double_smoothed_abs_pcdouble_smoothed_pc · do…2 valuestsi_valuetsi_valuevalueplusDM, minusDMplusDM · minusDM2 valuesplus, minusplus · minus2 valuessumsumvaluesigsigvalueBuyBuyconditionLong1, Short1Long1 · Short12 conditionsLong2, Short2Long2 · Short22 conditionsLong3, Short3Long3 · Short32 conditionsADXkeyADXkeyconditionSellSellconditionentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeplot:26Basisplotplot:27Upperplotplot:28Lowerplotfill:BackgroundBackgroundfillplot:34MAplotplot:49plotplotplot:50plotplothline:51Zerohlineplot:71ADXplotplot:72ADX Keylineplot

Order rules

OrderFires whenBy defaultLine
Open Long longBuyLong1 and Long2 and Long3 and ADXkeyOn98
Close LongCloseLongOn99

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.

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 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 1D0.0%+102.5%00%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—0.0%8 May 2026 – 21 Oct 2026

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

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
ADX_TSI_Bol Band Trend Chaser this page—v4 strategy0.0%00.0%
Flawless Victory Strategy - 15min BTC Machine Learning Strategy by Bungholerma sma stdevv4 strategy+21.3%635.4%
Contrarian Scalping Counter Trend Bb Envelope Adx and Stochastic by exlux99sma stdev rmav5 strategy+1.9%153.2%
Forex Scalping 1min Bollinger Bands, RSI and ADX Trading System by exlux99sma stdev rmav4 strategy−0.0%30.0%
Crunchster's Normalised Trend Strategy by Crunchster1stdev wma smav5 strategy+22.9%7310.9%
Best TradingView Strategy - For NASDAQ and DOW30 and other Index by The_Bigger_Bullsma stdev rmav5 strategy+2.2%173.4%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 27 msWith a workaround 1,000 bars in 98 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 98) so the engine trades the way the script says.

“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. PineTS runs Pine Script v5 and v6 only.

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/// © gary_trades//This script has been designed to be used on trending stocks as a low risk trade with minimal drawdown, utilising 200 Moving Average, Custom Bollinger Band, TSI with weighted moving average and ADX strength. //Backtest dates are set to 2010 - 2020 and all other filters (moving average, ADX, TSI , Bollinger Band) are not locked so they can be user amended if desired. //Buy signal is given when trading above the 200 moving average + 5 candles have closed above the upper custom Bollinger + the TSI is positive + ADX is above 20.//As back testing proved that this traded better only in tends then some Sell/Short conditions have been removed and this focueses on  Long orders.//Only requires 2 additional lines of code to add shorting orders.//Close for either long or short trades is signaled once the TSI crosses in the opposite direction indicating change in trend strength or if stop loss is trggered.//Further optimization could be achieved by adding a stop loss.//NOTE: This only shows the lower indicators however for visualization you can use my script "CUSTOM BOLLINGER WITH SMA", which is the upper indicators in this stratergy.//------------//@version=4strategy(shorttitle="Trend Chaser", title="ADX_TSI_Bol Band Trend Chaser", overlay=false, pyramiding=0, currency=currency.USD, default_qty_type=strategy.percent_of_equity, default_qty_value=10, initial_capital=10000, commission_value=0.1)//------------//Custom Bollinger Bandlength = input(20, minval=1)src = input(close, title="Source")mult = input(0.382, minval=0.001, maxval=50, title="StdDev")basis = sma(src, length)dev = mult * stdev(src, length)upper = basis + devlower = basis - devoffset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)plot(basis, "Basis", color=color.gray, offset = offset, display=display.none)p1 = plot(upper, "Upper", color=color.gray, offset = offset, display=display.none)p2 = plot(lower, "Lower", color=color.gray, offset = offset, display=display.none)fill(p1, p2, title = "Background", color=#787B86, transp=85)//------------//Moving AverageMAlen = input(200, minval=1, title="Length")MAout = sma(src, MAlen)plot(MAout, color=color.black, title="MA", offset=offset, linewidth=2, display=display.none)//------------//True Strength WMATSlong = input(title="Long Length", type=input.integer, defval=25)TSshort = input(title="Short Length", type=input.integer, defval=13)TSsignal = input(title="Signal Length", type=input.integer, defval=52)double_smooth(src, TSlong, TSshort) =>    fist_smooth = wma(src, TSlong)    wma(fist_smooth, TSshort)price = close     pc = change(price)double_smoothed_pc = double_smooth(pc, TSlong, TSshort)double_smoothed_abs_pc = double_smooth(abs(pc), TSlong, TSshort)tsi_value = 100 * (double_smoothed_pc / double_smoothed_abs_pc)tsi2 = wma(tsi_value, TSsignal)plot(tsi_value, color=color.blue)plot(wma(tsi_value, TSsignal), color=color.red)hline(0, title="Zero")//------------//ADXadxlen = input(13, title="ADX Smoothing")dilen = input(13, title="DI Length")keyLevel = input(20, title="Keylevel for ADX")dirmov(len) =>    up = change(high)    down = -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 = rma(tr, len)    plus = fixnan(100 * rma(plusDM, len) / truerange)    minus = fixnan(100 * rma(minusDM, len) / truerange)    [plus, minus]adx(dilen, adxlen) =>    [plus, minus] = dirmov(dilen)    sum = plus + minus    adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)sig = adx(dilen, adxlen)plot(sig, color=color.black, title="ADX", style=plot.style_histogram, transp=40)plot(20, color=color.green, title="ADX Keyline", linewidth=1)//------------//Identify Triggers//Back Test Rangestart = timestamp("America/New_York", 2010, 1, 1, 9,30)end = timestamp("America/New_York", 2020, 7, 1, 0, 0)//Custom Bollinger BandLong1 = close > upper[5] and close[5] > upper [6]Short1 = close < lower[5] and close[5] < lower [6]//Moving AverageLong2 = close >= MAout[1]Short2 = close <= MAout[1]//True Strength WMALong3 = tsi_value > tsi2  Short3 = tsi_value < tsi2//ADXADXkey = adx(dilen, adxlen) > 20 and adx(dilen, adxlen) < 100//BuyBuy = Long1 and Long2 and Long3 and ADXkeyCloseLong = crossunder(tsi_value,tsi2)//ShortSell = Short1 and Short2 and Short3 and ADXkeyCloseShort = crossover(tsi_value,tsi2)//------------//Entry and Exitif time >= start and time <= end    strategy.entry("Long", true, when = Buy)strategy.close("Long", when = CloseLong)