Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Forex Scalping 1min Bollinger Bands, RSI and ADX Trading System

A Pine Script v4 strategy built on RSI (price, 20), Crossover (vrsi, 35) and Crossunder (vrsi, 65). It has 6 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 is one contract and pays no commission. 10 settings; defaults include Length 20, Over Sold 35 and Over Bought 65.

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 Forex Scalping 1min Bollinger Bands, RSI and ADX Trading System repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Forex Scalping 1min Bollinger Bands, RSI and ADX Trading System do on BTCUSDT 1D with default settings?
−0.00%
From 26 Jan 2024 to 21 Oct 2026, over 3 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Forex Scalping 1min Bollinger Bands, RSI and ADX Trading System be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
Does Forex Scalping 1min Bollinger Bands, RSI and ADX Trading System use a stop loss?
Yes
strategy.exit sets a stop on line 47, 50.
Does Forex Scalping 1min Bollinger Bands, RSI and ADX Trading System run in Zeal Terminal?
Yes
It compiles in 16 ms and runs 1,000 bars in 47 ms, in the browser.

BTCUSDT · 1D · default settings

  • 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 (10)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$99,999$202,527Equity from $100,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference. Zeal Terminal's engine currently reads an order side written as 1, 0 as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 46, 49) so the engine trades the way the script says. 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
−0.00%
−$0.90
Buy and hold
+102.5%
same period
Closed trades
3
1 won · 2 lost
Profitable
33.3%
of closed trades
Profit factor
0.50
gross profit ÷ gross loss
Max drawdown
0.00%
−$1.80

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

    No commission

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

  • Note

    6 settings have no label

    In the settings dialog length (line 9), overSold (line 10), overBought (line 11), lengthB (line 18), tp (line 44), sl (line 45) show an empty name. The labels on this page come from the variable names.

  • Note

    No slippage

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

  • Note

    Uses an argument v6 removed

    when = on line 46, 48, 49, 51. The upgraded version below moves each call inside an if block.

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 rsi → ta.rsi, crossover → ta.crossover, crossunder → ta.crossunder, sma → ta.sma, stdev → ta.stdev, change → ta.change, rma → ta.rma, abs → math.abs.
  • 4 strategy calls use the when = argument (line 46, 48, 49, 51). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

Same 3 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 13: rsi → ta.rsi
  • Line 14: crossover → ta.crossover
  • Line 15: crossunder → ta.crossunder
  • Line 21: sma → ta.sma
  • Line 22: stdev → ta.stdev
14 more edits
  • Line 29: change → ta.change
  • Line 30: change → ta.change
  • Line 33: rma → ta.rma
  • Line 33: tr → ta.tr
  • Line 34: rma → ta.rma
  • Line 35: rma → ta.rma
  • Line 40: rma → ta.rma
  • Line 40: abs → math.abs
  • Line 42: crossover → ta.crossover
  • Line 43: crossunder → ta.crossunder
  • Line 46: strategy.entry(…, 1) → strategy.entry(…, strategy.long)
  • Line 48: crossunder → ta.crossunder
  • Line 49: strategy.entry(…, 0) → strategy.entry(…, strategy.short)
  • Line 51: crossover → ta.crossover
⋯// © exlux99-//@version=4+//@version=5strategy("Bollinger Bands, RSI and ADX Trading System", overlay=true)⋯price = close-vrsi = rsi(price, length)+vrsi = ta.rsi(price, length)-co = crossover(vrsi, overSold)+co = ta.crossover(vrsi, overSold)-cu = crossunder(vrsi, overBought)+cu = ta.crossunder(vrsi, overBought)//if (not na(vrsi))⋯mult = input(2.0, minval=0.001, maxval=50, title="StdDev")-basis = sma(src, lengthB)+basis = ta.sma(src, lengthB)-dev = mult * stdev(src, lengthB)+dev = mult * ta.stdev(src, lengthB)upper = basis + dev⋯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)-longEntry = close < upper and crossover(vrsi,overSold) and sig < 32 //and (timeinrange(timeframe.period, "0301-0600") or timeinrange(timeframe.period, "0901-1300") or timeinrange(timeframe.period, "2031-2300"))+longEntry = close < upper and ta.crossover(vrsi,overSold) and sig < 32 //and (timeinrange(timeframe.period, "0301-0600") or timeinrange(timeframe.period, "0901-1300") or timeinrange(timeframe.period, "2031-2300"))-shortEntry = close > upper and crossunder(vrsi,overBought) and sig < 32 //and (timeinrange(timeframe.period, "0301-0600") or timeinrange(timeframe.period, "0901-1300") or timeinrange(timeframe.period, "2031-2300"))+shortEntry = close > upper and ta.crossunder(vrsi,overBought) and sig < 32 //and (timeinrange(timeframe.period, "0301-0600") or timeinrange(timeframe.period, "0901-1300") or timeinrange(timeframe.period, "2031-2300"))tp=input(90, step=10)sl=input(90, step=10)-strategy.entry("long",1,when=longEntry)+strategy.entry("long",strategy.long,when=longEntry)strategy.exit("X_long", "long", profit=tp,  loss=sl )-strategy.close("long",when=crossunder(close,basis))+strategy.close("long",when=ta.crossunder(close,basis))-strategy.entry('short',0,when=shortEntry)+strategy.entry('short',strategy.short,when=shortEntry)strategy.exit("x_short", "short",profit=tp, loss=sl)-strategy.close("short",when=crossover(close,basis))+strategy.close("short",when=ta.crossover(close,basis))

Clean v5

VerifiedDownload the v5 script

Same 3 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 9: input() → input.int()
  • Line 10: input() → input.int()
  • Line 11: input() → input.int()
  • Line 18: input() → input.int()
  • Line 19: input() → input.source()
  • Line 20: input() → input.float()
8 more edits
  • Line 26: input() → input.int()
  • Line 27: input() → input.int()
  • Line 44: input() → input.int()
  • Line 45: input() → input.int()
  • Line 46: when = longEntry → if block
  • Line 48: when = ta.crossunder(close,basis) → if block
  • Line 49: when = shortEntry → if block
  • Line 51: when = ta.crossover(close,basis) → if block
⋯//RSI-length = input( 20 )+length = input.int( 20 )-overSold = input( 35 )+overSold = input.int( 35 )-overBought = input( 65 )+overBought = input.int( 65 )price = close⋯//BB-lengthB = input(60, minval=1)+lengthB = input.int(60, minval=1)-src = input(close, title="Source")+src = input.source(close, title="Source")-mult = input(2.0, minval=0.001, maxval=50, title="StdDev")+mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev")basis = ta.sma(src, lengthB)⋯//adx-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")dirmov(len) =>⋯shortEntry = close > upper and ta.crossunder(vrsi,overBought) and sig < 32 //and (timeinrange(timeframe.period, "0301-0600") or timeinrange(timeframe.period, "0901-1300") or timeinrange(timeframe.period, "2031-2300"))-tp=input(90, step=10)+tp=input.int(90, step=10)-sl=input(90, step=10)+sl=input.int(90, step=10)-strategy.entry("long",strategy.long,when=longEntry)+if longEntry+    strategy.entry("long",strategy.long)strategy.exit("X_long", "long", profit=tp,  loss=sl )-strategy.close("long",when=ta.crossunder(close,basis))+if ta.crossunder(close,basis)+    strategy.close("long")-strategy.entry('short',strategy.short,when=shortEntry)+if shortEntry+    strategy.entry('short',strategy.short)strategy.exit("x_short", "short",profit=tp, loss=sl)-strategy.close("short",when=ta.crossover(close,basis))+if ta.crossover(close,basis)+    strategy.close("short")

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

⋯// © exlux99-//@version=5+//@version=6strategy("Bollinger Bands, RSI and ADX Trading System", overlay=true)⋯

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)20intvrsi
Over Sold (no label in the script)35intco longEntry
Over Bought (no label in the script)65intcu shortEntry
Length B (no label in the script)60int · min 1basis dev
Sourceclosesourcebasis dev
StdDev2.0float · min 0.001 · max 50dev
ADX Smoothing14intadx sig
DI Length14intplus minus sig
Tp (no label in the script)90int · step 10exit X_long exit x_short
Sl (no label in the script)90int · step 10exit X_long exit x_short

What it calculates

  • RSI (rsi, ta.rsi in v5)price, Length (20)vrsi · line 13
  • Crossover (crossover, ta.crossover in v5)vrsi, Over Sold (35)co · line 14
  • Crossunder (crossunder, ta.crossunder in v5)vrsi, Over Bought (65)cu · line 15
  • SMA (sma, ta.sma in v5)Source (close), Length B (60)basis · line 21
  • Stdev (stdev, ta.stdev in v5)Source (close), Length B (60)dev · line 22
  • Change (change, ta.change in v5)highup · line 29
  • Change (change, ta.change in v5)lowdown · line 30
  • RMA (rma, ta.rma in v5)tr, lentruerange · line 33
  • RMA (rma, ta.rma in v5)abs(plus - minus) / (sum == 0 ? 1 : sum), ADX Smoothing (14)adx · line 40

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.

lengthLengthsetting · 20overSoldOver Soldsetting · 35overBoughtOver Boughtsetting · 65closecloseprice datalengthBLength Bsetting · 60multStdDevsetting · 2.0highhighprice datalowlowprice dataadxlenADX Smoothingsetting · 14dilenDI Lengthsetting · 14vrsiRSI→ vrsicoCrossover→ cocuCrossunder→ cubasisSMA→ basisdevStdev→ devupChange→ updownChange→ downtruerangeRMA→ truerangeadxRMA→ adxpricepricevalueupper, lowerupper · lower2 valuesplusDM, minusDMplusDM · minusDM2 valuesplus, minusplus · minus2 valuessumsumvaluesigsigvaluelongEntrylongEntryconditionshortEntryshortEntryconditiontimerColourtimerentry:longOpen longstrategy.entryexit:X_longexit X_longstrategy.exitclose:longClose longstrategy.closeentry:shortOpen shortstrategy.entryexit:x_shortexit x_shortstrategy.exitclose:shortClose shortstrategy.close

Order rules

OrderFires whenBy defaultLine
Open long longlongEntryclose < upper and crossover(vrsi,overSold) and sig < 32On46
Exit X_long stop and limitevery barOn47
Close longcrossunder(close,basis)On48
Open short shortshortEntryclose > upper and crossunder(vrsi,overBought) and sig < 32On49
Exit x_short stop and limitevery barOn50
Close shortcrossover(close,basis)On51

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 1D−0.0%+102.5%333%0.500.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+0.0%+5.5%956%1.250.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%450%1.000.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.0%+8.4%633%0.500.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%20%0.000.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%850%1.000.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%650%1.000.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−0.0%+17.1%838%0.600.0%8 May 2026 – 21 Oct 2026

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

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market10%−$0.90
Sideways market250%$0.00
Falling market0—$0.00

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

How bad could the drawdown be?

0.0%

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

0%1%
All 3 trades
SideEntryExitBarsP&L
long26 Jun 2024 61,806.0026 Jun 2024 61,806.900$0.90
long7 Aug 2024 56,022.007 Aug 2024 56,021.100−$0.90
short19 Jul 2025 117,925.0019 Jul 2025 117,926.000−$0.90

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
Forex Scalping 1min Bollinger Bands, RSI and ADX Trading System this page—v4 strategy−0.0%30.0%
Bottom catch strategy by footlzsma stdev rsiv4 strategy+3.9%37.1%
Madri by Mdemoiorsi sma stdevv4 strategy+25.0%436.4%
Bollinger Bands and RSI Short Selling (by Coinrule) by Coinrulesma stdev rsiv5 strategy+7.6%34.3%
Shorting when Bollinger Band Above Price with RSI (by Coinrule) by Coinrulesma stdev rsiv5 strategyNo trades on this market
Flawless Victory Strategy - 15min BTC Machine Learning Strategy by Bungholerma sma stdevv4 strategy+21.3%635.4%

Where it runs

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

Zeal Terminal's engine currently reads an order side written as 1, 0 as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 46, 49) so the engine trades the way the script says. 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. 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/// © exlux99//@version=4strategy("Bollinger Bands, RSI and ADX Trading System", overlay=true)timeinrange(res, sess) => time(res, sess) != 0timer = color.red//bgcolor(timeinrange(timeframe.period, "0300-0600") or timeinrange(timeframe.period, "0900-1300") or timeinrange(timeframe.period, "2030-2300") ? timer : na, transp=70)//RSIlength = input( 20 )overSold = input( 35 )overBought = input( 65 )price = closevrsi = rsi(price, length)co = crossover(vrsi, overSold)cu = crossunder(vrsi, overBought)//if (not na(vrsi))//BBlengthB = input(60, minval=1)src = input(close, title="Source")mult = input(2.0, minval=0.001, maxval=50, title="StdDev")basis = sma(src, lengthB)dev = mult * stdev(src, lengthB)upper = basis + devlower = basis - dev//adxadxlen = input(14, title="ADX Smoothing")dilen = input(14, title="DI Length")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)longEntry = close < upper and crossover(vrsi,overSold) and sig < 32 //and (timeinrange(timeframe.period, "0301-0600") or timeinrange(timeframe.period, "0901-1300") or timeinrange(timeframe.period, "2031-2300"))shortEntry = close > upper and crossunder(vrsi,overBought) and sig < 32 //and (timeinrange(timeframe.period, "0301-0600") or timeinrange(timeframe.period, "0901-1300") or timeinrange(timeframe.period, "2031-2300"))tp=input(90, step=10)sl=input(90, step=10)strategy.entry("long",1,when=longEntry)strategy.exit("X_long", "long", profit=tp,  loss=sl )strategy.close("long",when=crossunder(close,basis))strategy.entry('short',0,when=shortEntry)strategy.exit("x_short", "short",profit=tp, loss=sl)strategy.close("short",when=crossover(close,basis))