Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

[KL] RSI 14 + 10 Strategy

A Pine Script v4 strategy built on ATR (ATR_multi_len) and RSI (close, 14). It has 5 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 is one contract and pays no commission. 9 settings; defaults include Risk:[Reward] (i.e. 3) for exit 3, ATR multiplier for stop loss 2 and RSI entry 40.

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 [KL] RSI 14 + 10 Strategy repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 6 of 6 trades.
How did [KL] RSI 14 + 10 Strategy do on BTCUSDT 1D with default settings?
+4.23%
From 26 Jan 2024 to 21 Oct 2026, over 27 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can [KL] RSI 14 + 10 Strategy 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 [KL] RSI 14 + 10 Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does [KL] RSI 14 + 10 Strategy run in Zeal Terminal?
Yes
It compiles in 18 ms and runs 1,000 bars in 34 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • 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 (9)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$104,232$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. 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
+4.23%
$4,227.63
Buy and hold
+102.5%
same period
Closed trades
27
11 won · 16 lost
Profitable
40.7%
of closed trades
Profit factor
1.05
gross profit ÷ gross loss
Max drawdown
39.66%
−$54,996.00

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 stop loss

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

  • Check

    No commission

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

  • Note

    No slippage

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

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 atr → ta.atr, max → math.max, rsi → ta.rsi.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 7: input(type = input.time) → input.time()
  • Line 9: input(type = input.time) → input.time()
  • Line 17: atr → ta.atr
  • Line 19: atr → ta.atr
  • Line 24: max → math.max
  • Line 35: rsi → ta.rsi
  • Line 36: rsi → ta.rsi
⋯// © DojiEmoji-//@version=4+//@version=5strategy("[KL] RSI 14 + 10 Strategy v2.1",overlay=true,pyramiding=1)⋯// 1) Fixed a bug (related to TSL)-backtest_timeframe_start = input(defval = timestamp("01 Apr 2016 13:30 +0000"), title = "Backtest Start Time", type = input.time)+backtest_timeframe_start = input.time(defval = timestamp("01 Apr 2016 13:30 +0000"), title = "Backtest Start Time")USE_ENDTIME = input(false,title="Define the ending period for backtests (If false, will test up to most recent candle)")-backtest_timeframe_end = input(defval = timestamp("19 Mar 2021 19:30 +0000"), title = "Backtest End Time", type = input.time)+backtest_timeframe_end = input.time(defval = timestamp("19 Mar 2021 19:30 +0000"), title = "Backtest End Time")TARGET_PROFIT_MODE = input(false,title="Exit when Risk:Reward met")⋯ATR_multi = input(2, "ATR multiplier for stop loss")-ATR_buffer = atr(ATR_multi_len) * ATR_multi+ATR_buffer = ta.atr(ATR_multi_len) * ATR_multi//plotchar(ATR_buffer, "ATR Buffer", "", location = location.top)-risk_reward_buffer = (atr(ATR_multi_len) * ATR_multi) * REWARD_RATIO+risk_reward_buffer = (ta.atr(ATR_multi_len) * ATR_multi) * REWARD_RATIOtake_profit_long = low > entry_price + risk_reward_buffer⋯var stop_loss_price = float(0)-stop_loss_price := max(stop_loss_price, close - trailing_SL_buffer)+stop_loss_price := math.max(stop_loss_price, close - trailing_SL_buffer)// plot TSL line⋯RSI_HIGH = input(70,title="RSI exit")-rsi14 = rsi(close, 14)+rsi14 = ta.rsi(close, 14)-rsi10 = rsi(close, 10)+rsi10 = ta.rsi(close, 10)// }⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 8: input() → input.bool()
  • Line 10: input() → input.bool()
  • Line 11: input() → input.int()
  • Line 13: input() → input.bool()
  • Line 16: input() → input.int()
  • Line 33: input() → input.int()
  • Line 34: input() → input.int()
⋯backtest_timeframe_start = input.time(defval = timestamp("01 Apr 2016 13:30 +0000"), title = "Backtest Start Time")-USE_ENDTIME = input(false,title="Define the ending period for backtests (If false, will test up to most recent candle)")+USE_ENDTIME = input.bool(false,title="Define the ending period for backtests (If false, will test up to most recent candle)")backtest_timeframe_end = input.time(defval = timestamp("19 Mar 2021 19:30 +0000"), title = "Backtest End Time")-TARGET_PROFIT_MODE = input(false,title="Exit when Risk:Reward met")+TARGET_PROFIT_MODE = input.bool(false,title="Exit when Risk:Reward met")-REWARD_RATIO = input(3,title="Risk:[Reward] (i.e. 3) for exit")+REWARD_RATIO = input.int(3,title="Risk:[Reward] (i.e. 3) for exit")// Trailing stop loss {-TSL_ON = input(true,title="Use trailing stop loss")+TSL_ON = input.bool(true,title="Use trailing stop loss")var entry_price = float(0)ATR_multi_len = 26-ATR_multi = input(2, "ATR multiplier for stop loss")+ATR_multi = input.int(2, "ATR multiplier for stop loss")ATR_buffer = ta.atr(ATR_multi_len) * ATR_multi⋯// RSI {-RSI_LOW = input(40,title="RSI entry")+RSI_LOW = input.int(40,title="RSI entry")-RSI_HIGH = input(70,title="RSI exit")+RSI_HIGH = input.int(70,title="RSI exit")rsi14 = ta.rsi(close, 14)⋯

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

⋯// © DojiEmoji-//@version=5+//@version=6strategy("[KL] RSI 14 + 10 Strategy v2.1",overlay=true,pyramiding=1)⋯

Settings

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

SettingDefaultType and rangeFeeds
Backtest Start Timetimestamp("01 Apr 2016 13:30 +0000")timeline 38
Define the ending period for backtests (If false, will test up to most recent candle)falseboolline 38
Backtest End Timetimestamp("19 Mar 2021 19:30 +0000")timeline 38
Exit when Risk:Reward metfalseboolline 60
Risk:[Reward] (i.e. 3) for exit3intrisk_reward_buffer
Use trailing stop losstrueboolline 27 line 54
ATR multiplier for stop loss2intATR_buffer risk_reward_buffer
RSI entry40intbuy_condition
RSI exit70intexit_condition

What it calculates

  • ATR (atr, ta.atr in v5)ATR_multi_lenATR_buffer · line 17
  • ATR (atr, ta.atr in v5)ATR_multi_lenrisk_reward_buffer · line 19
  • RSI (rsi, ta.rsi in v5)close, 14rsi14 · line 35
  • RSI (rsi, ta.rsi in v5)close, 10rsi10 · line 36

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.

high · low · closehigh · low · closeprice dataATR_multiATR multiplier for stop…setting · 2REWARD_RATIORisk:[Reward] (i.e. 3) …setting · 3closecloseprice datalowlowprice dataRSI_LOWRSI entrysetting · 40RSI_HIGHRSI exitsetting · 70ATR_bufferATR→ ATR_bufferrisk_reward_bufferATR→ risk_reward_bufferrsi14RSI→ rsi14rsi10RSI→ rsi10entry_priceentry_pricevaluetrailing_SL_buffertrailing_SL_buffervaluestop_loss_pricestop_loss_pricevaluetake_profit_longtake_profit_longconditionbuy_conditionbuy_conditionconditiontake_profit_shorttake_profit_shortconditionexit_conditionexit_conditionconditiontrail_profit_line_colorColourtrail_profit_line_colorentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeplot:30plotplot

Order rules

OrderFires whenBy defaultLine
Open Long longbuy_conditionOn51
Close Longclose > entry_priceOn56
Close Longclose <= entry_priceOn58
Close Longtake_profit_longOn62
Close Longtake_profit_longOn66

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.

6/6trades 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+4.2%+102.5%2741%1.0539.7%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+12.9%+5.5%3345%1.6213.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.8%+9.8%2839%1.191.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.0%+8.4%2737%1.020.8%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.1%+16.7%2532%0.810.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%2928%0.670.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.1%+148.3%1953%1.120.3%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.1%+17.1%2438%1.500.1%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 market475%$26,674.30
Sideways market1429%−$22,436.50
Falling market944%−$10.25

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

How bad could the drawdown be?

43.1%

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

0%50%
All 27 trades
SideEntryExitBarsP&L
long18 Apr 2024 61,277.402 May 2024 58,365.0014−$2,912.41
long3 May 2024 59,060.6020 Jun 2024 64,974.4048$5,913.77
long21 Jun 2024 64,870.0025 Jun 2024 60,293.304−$4,576.69
long26 Jun 2024 61,806.005 Jul 2024 57,050.009−$4,755.99
long6 Jul 2024 56,628.803 Aug 2024 61,498.3028$4,869.55
long4 Aug 2024 60,698.006 Aug 2024 54,018.802−$6,679.17
long7 Aug 2024 56,022.002 Sep 2024 57,301.8026$1,279.77
long6 Sep 2024 56,180.0011 Oct 2024 60,326.4035$4,146.40
long25 Feb 2025 91,552.9027 Feb 2025 84,250.102−$7,302.79
long28 Feb 2025 84,708.604 Mar 2025 86,221.204$1,512.59
long10 Mar 2025 80,734.507 Apr 2025 78,430.0028−$2,304.48
long8 Apr 2025 79,163.2010 May 2025 102,972.0032$23,808.80
long23 Jun 2025 100,964.0015 Jul 2025 119,841.0022$18,877.30
long3 Aug 2025 112,546.0016 Aug 2025 117,342.0013$4,795.69
long26 Aug 2025 110,112.0026 Sep 2025 108,994.0031−$1,117.49
long27 Sep 2025 109,643.0011 Oct 2025 112,774.0014$3,131.03
long12 Oct 2025 110,644.0018 Oct 2025 106,432.006−$4,212.72
long19 Oct 2025 107,185.004 Nov 2025 106,583.0016−$601.95
long5 Nov 2025 101,497.0015 Nov 2025 94,594.0010−$6,903.23
long16 Nov 2025 95,596.2021 Nov 2025 86,637.205−$8,959.01
long22 Nov 2025 85,129.4021 Jan 2026 88,427.7060$3,298.24
long26 Jan 2026 86,670.401 Feb 2026 78,741.106−$7,929.26
long2 Feb 2026 76,968.206 Feb 2026 62,909.904−$14,058.30
long8 Feb 2026 69,289.4028 Mar 2026 66,407.3048−$2,882.09
long28 May 2026 74,449.303 Jun 2026 66,760.806−$7,688.47
long4 Jun 2026 64,142.8025 Jun 2026 61,078.0021−$3,064.75
long26 Jun 2026 59,794.6022 Aug 2026 78,338.0057$18,543.40

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
[KL] RSI 14 + 10 Strategy this page—v4 strategy+4.2%2739.7%
SuperTREX strategy by RafaelZionirsi atrv4 strategy−3.8%36.1%
MA cross strategy by Glenn234rsi atrv5 strategy−606.2%35656.0%
VWMA_withATRstops_strategy by ediks123rsi atrv4 strategyNo trades on this market
Mathias & Christer Timeframe RSI by mattehalenrsi atrv4 strategy−0.7%180.7%
Estrategia Larry Connors [JoseMetal] by JoseMetalrsi atrv5 strategy+2.7%242.4%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 18 msWith a workaround 1,000 bars in 34 msNot measured
PineTSNo v5 and v6 only—Not 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. 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/// © DojiEmoji//@version=4strategy("[KL] RSI 14 + 10 Strategy v2.1",overlay=true,pyramiding=1)// changes in Version 2.1:// 1) Fixed a bug (related to TSL)backtest_timeframe_start = input(defval = timestamp("01 Apr 2016 13:30 +0000"), title = "Backtest Start Time", type = input.time)USE_ENDTIME = input(false,title="Define the ending period for backtests (If false, will test up to most recent candle)")backtest_timeframe_end = input(defval = timestamp("19 Mar 2021 19:30 +0000"), title = "Backtest End Time", type = input.time)TARGET_PROFIT_MODE = input(false,title="Exit when Risk:Reward met")REWARD_RATIO = input(3,title="Risk:[Reward] (i.e. 3) for exit")// Trailing stop loss {TSL_ON = input(true,title="Use trailing stop loss")var entry_price = float(0)ATR_multi_len = 26ATR_multi = input(2, "ATR multiplier for stop loss")ATR_buffer = atr(ATR_multi_len) * ATR_multi//plotchar(ATR_buffer, "ATR Buffer", "", location = location.top)risk_reward_buffer = (atr(ATR_multi_len) * ATR_multi) * REWARD_RATIOtake_profit_long = low > entry_price + risk_reward_buffertake_profit_short = low < entry_price - risk_reward_buffervar trailing_SL_buffer = float(0)var stop_loss_price = float(0)stop_loss_price := max(stop_loss_price, close - trailing_SL_buffer)// plot TSL linetrail_profit_line_color = color.greenif strategy.position_size == 0  or not TSL_ON    trail_profit_line_color := color.black    stop_loss_price := close - trailing_SL_bufferplot(stop_loss_price,color=trail_profit_line_color)// }// RSI {RSI_LOW = input(40,title="RSI entry")RSI_HIGH = input(70,title="RSI exit")rsi14 = rsi(close, 14)rsi10 = rsi(close, 10)// }if time >= backtest_timeframe_start and (time <= backtest_timeframe_end or not USE_ENDTIME)    buy_condition = rsi14 <= RSI_LOW and rsi10 < rsi14    exit_condition = rsi14 >= RSI_HIGH and rsi10 > rsi14    //ENTRY:    if buy_condition        if strategy.position_size == 0            entry_price := close            trailing_SL_buffer := ATR_buffer            stop_loss_price := close - ATR_buffer                msg = "entry"        if strategy.position_size > 0            msg := "pyramiding"        strategy.entry("Long",strategy.long, comment=msg)    //EXIT:    // Case (A) hits trailing stop    if TSL_ON and strategy.position_size > 0 and close <= stop_loss_price        if close > entry_price            strategy.close("Long", comment="take profit [trailing]")        else if close <= entry_price             strategy.close("Long", comment="stop loss")    // Case (B) take targeted profit relative to risk     if strategy.position_size > 0 and TARGET_PROFIT_MODE        if take_profit_long            strategy.close("Long", comment="take profits [risk:reward]")    // Case (C)    if strategy.position_size > 0 and exit_condition        if take_profit_long            strategy.close("Long", comment="exit[rsi]")// Also included an additional script (Study script) - "RSI[14 + 10] Double Indicators"// The following script is a modification of the original RSI indicator built into TradingView// The reason that it is not included in the Strategy script is because the plotting scales are different.// // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// // © DojiEmoji// //@version=4// study(title="RSI[14 + 10] Double Indicators", shorttitle="RSI", format=format.price, precision=2, resolution="")// len1 = input(14, minval=1, title="RSI A Length")// src1 = input(close, "RSI A Source", type = input.source)// rsi1 = rsi(src1,len1)// plot(rsi1, "RSI", color=#ffffff)// len2 = input(10, minval=1, title="RSI B Length")// src2 = input(close, "RSI B Source", type = input.source)// rsi2 = rsi(src2,len2)// plot(rsi2, "RSI", color=#fb8c00)// band1 = hline(70, "Upper Band", color=#C0C0C0)// band0 = hline(30, "Lower Band", color=#C0C0C0)// fill(band1, band0, color=#9915FF, transp=90, title="Background")