Pine Script v5 · Strategy
Hobbiecode - Five Day Low RSI Strategy
A Pine Script v5 strategy built on RSI (close, rsi_period). It has 3 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. It has no settings.
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 Hobbiecode - Five Day Low RSI Strategy repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 19 of 19 trades.
- How did Hobbiecode - Five Day Low RSI Strategy do on BTCUSDT 1D with default settings?
- +3.68%
- From 26 Jan 2024 to 21 Oct 2026, over 60 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does Hobbiecode - Five Day Low RSI 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: 60 before, 48 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 Hobbiecode - Five Day Low RSI Strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Hobbiecode - Five Day Low RSI Strategy run in Zeal Terminal?
- Yes
- It compiles in 10 ms and runs 1,000 bars in 18 ms, in the browser.
BTCUSDT · 1D · default settings
- RSI
- Overbought Level
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +3.68%
- $36,829.90
- Buy and hold
- +102.5%
- same period
- Closed trades
- 60
- 42 won · 18 lost
- Profitable
- 70.0%
- of closed trades
- Profit factor
- 1.64
- gross profit ÷ gross loss
- Max drawdown
- 2.00%
- −$20,218.00
One run with the author's default settings, $1,000,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.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
The script declares no settings.
What it calculates
- RSIclose, rsi_period
rsi_val · line 12
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Buy long | (conditionEntry) | On | 16 |
| Close Buy | (strategy.position_size > 0 and rsi_val > rsi_upper) | On | 19 |
| Close Buy | (strategy.position_size > 0 and ta.barssince(conditionEntry) >= 5) | On | 22 |
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.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | +3.7% | +102.5% | 60 | 70% | 1.64 | 2.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +0.7% | +5.5% | 62 | 65% | 1.48 | 1.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −0.2% | +9.8% | 53 | 57% | 0.62 | 0.2% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.0% | +8.4% | 53 | 64% | 1.28 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.0% | +16.7% | 58 | 66% | 1.10 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.0% | +21.5% | 63 | 63% | 1.19 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.0% | +148.3% | 58 | 74% | 2.08 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.0% | +17.1% | 60 | 65% | 1.27 | 0.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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 19 | 79% | $32,187.90 |
| Sideways market | 24 | 63% | −$5,768.12 |
| Falling market | 17 | 71% | $10,410.10 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
2.7%
The 95th percentile of the worst drawdown when the same 60 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 1.1% to 2.7%; the tick is what actually happened, 1.6%. Order luck alone moves it this much.
All 60 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 17 Mar 2024 65,300.60 | 18 Mar 2024 68,393.50 | 1 | $3,092.83 |
| long | 20 Mar 2024 61,937.40 | 21 Mar 2024 67,840.50 | 1 | $5,903.10 |
| long | 3 Apr 2024 65,464.00 | 5 Apr 2024 68,487.80 | 2 | $3,023.81 |
| long | 13 Apr 2024 67,116.50 | 18 Apr 2024 61,277.40 | 5 | −$5,839.14 |
| long | 1 May 2024 60,672.00 | 4 May 2024 62,882.00 | 3 | $2,210.00 |
| long | 12 Jun 2024 67,314.20 | 17 Jun 2024 66,676.90 | 5 | −$637.37 |
| long | 24 Jun 2024 63,210.00 | 28 Jun 2024 61,706.50 | 4 | −$1,503.55 |
| long | 5 Jul 2024 57,050.00 | 7 Jul 2024 58,230.10 | 2 | $1,180.11 |
| long | 1 Aug 2024 64,628.00 | 6 Aug 2024 54,018.80 | 5 | −$10,609.20 |
| long | 16 Aug 2024 57,541.10 | 17 Aug 2024 58,874.60 | 1 | $1,333.54 |
| long | 28 Aug 2024 59,415.00 | 2 Sep 2024 57,301.80 | 5 | −$2,113.23 |
| long | 7 Sep 2024 53,963.00 | 9 Sep 2024 54,869.90 | 2 | $906.98 |
| long | 2 Oct 2024 60,804.90 | 5 Oct 2024 62,086.00 | 3 | $1,281.08 |
| long | 4 Nov 2024 68,776.00 | 6 Nov 2024 69,372.00 | 2 | $596.02 |
| long | 27 Nov 2024 91,965.20 | 28 Nov 2024 95,863.10 | 1 | $3,897.95 |
| long | 20 Dec 2024 97,461.90 | 25 Dec 2024 98,663.60 | 5 | $1,201.72 |
| long | 31 Dec 2024 92,792.10 | 2 Jan 2025 94,591.80 | 2 | $1,799.73 |
| long | 9 Jan 2025 95,060.60 | 11 Jan 2025 94,726.10 | 2 | −$334.51 |
| long | 3 Feb 2025 97,700.60 | 4 Feb 2025 101,329.00 | 1 | $3,627.92 |
| long | 25 Feb 2025 91,552.90 | 2 Mar 2025 86,064.50 | 5 | −$5,488.34 |
| long | 10 Mar 2025 80,734.50 | 12 Mar 2025 82,933.00 | 2 | $2,198.51 |
| long | 30 Mar 2025 82,648.50 | 2 Apr 2025 85,158.40 | 3 | $2,509.82 |
| long | 7 Apr 2025 78,430.00 | 10 Apr 2025 82,615.20 | 3 | $4,185.22 |
| long | 30 May 2025 105,590.00 | 2 Jun 2025 105,643.00 | 3 | $53.18 |
| long | 6 Jun 2025 101,509.00 | 7 Jun 2025 104,288.00 | 1 | $2,779.74 |
| long | 21 Jun 2025 103,298.00 | 24 Jun 2025 105,334.00 | 3 | $2,035.96 |
| long | 2 Jul 2025 105,681.00 | 3 Jul 2025 108,850.00 | 1 | $3,168.46 |
| long | 1 Aug 2025 115,764.00 | 4 Aug 2025 114,209.00 | 3 | −$1,555.26 |
| long | 19 Aug 2025 116,227.00 | 23 Aug 2025 116,936.00 | 4 | $708.95 |
| long | 26 Aug 2025 110,112.00 | 29 Aug 2025 112,567.00 | 3 | $2,454.92 |
| long | 30 Aug 2025 108,377.00 | 2 Sep 2025 109,237.00 | 3 | $860.03 |
| long | 23 Sep 2025 112,651.00 | 25 Sep 2025 113,307.00 | 2 | $656.02 |
| long | 26 Sep 2025 108,994.00 | 29 Sep 2025 112,164.00 | 3 | $3,169.47 |
| long | 11 Oct 2025 112,774.00 | 13 Oct 2025 114,959.00 | 2 | $2,184.32 |
| long | 17 Oct 2025 108,194.00 | 20 Oct 2025 108,643.00 | 3 | $448.50 |
| long | 31 Oct 2025 108,323.00 | 2 Nov 2025 110,098.00 | 2 | $1,775.23 |
| long | 5 Nov 2025 101,497.00 | 8 Nov 2025 103,339.00 | 3 | $1,841.86 |
| long | 14 Nov 2025 99,692.00 | 19 Nov 2025 92,960.80 | 5 | −$6,731.20 |
| long | 21 Nov 2025 86,637.20 | 24 Nov 2025 86,830.00 | 3 | $192.78 |
| long | 2 Dec 2025 86,286.00 | 3 Dec 2025 91,277.90 | 1 | $4,991.87 |
| long | 15 Dec 2025 88,172.20 | 20 Dec 2025 88,136.90 | 5 | −$35.21 |
| long | 20 Jan 2026 92,631.00 | 25 Jan 2026 89,225.30 | 5 | −$3,405.65 |
| long | 26 Jan 2026 86,670.40 | 27 Jan 2026 88,347.10 | 1 | $1,676.72 |
| long | 30 Jan 2026 84,650.20 | 4 Feb 2026 75,770.20 | 5 | −$8,879.95 |
| long | 6 Feb 2026 62,909.90 | 7 Feb 2026 70,580.30 | 1 | $7,670.39 |
| long | 24 Feb 2026 64,656.00 | 26 Feb 2026 67,988.00 | 2 | $3,332.03 |
| long | 9 Mar 2026 65,971.20 | 10 Mar 2026 68,432.20 | 1 | $2,460.96 |
| long | 20 Mar 2026 69,930.00 | 24 Mar 2026 70,906.40 | 4 | $976.44 |
| long | 28 Mar 2026 66,407.30 | 31 Mar 2026 66,797.40 | 3 | $390.10 |
| long | 29 Apr 2026 76,342.80 | 2 May 2026 78,231.10 | 3 | $1,888.35 |
| long | 17 May 2026 78,148.10 | 21 May 2026 77,552.20 | 4 | −$595.81 |
| long | 23 May 2026 75,539.50 | 24 May 2026 76,752.00 | 1 | $1,212.50 |
| long | 29 May 2026 73,617.50 | 3 Jun 2026 66,760.80 | 5 | −$6,856.68 |
| long | 4 Jun 2026 64,142.80 | 8 Jun 2026 63,332.00 | 4 | −$810.74 |
| long | 19 Jun 2026 62,958.00 | 21 Jun 2026 64,298.00 | 2 | $1,340.00 |
| long | 25 Jun 2026 61,078.00 | 30 Jun 2026 60,260.20 | 5 | −$817.80 |
| long | 12 Aug 2026 63,600.00 | 17 Aug 2026 62,900.00 | 5 | −$700.01 |
| long | 11 Sep 2026 76,568.70 | 15 Sep 2026 78,189.20 | 4 | $1,620.47 |
| long | 16 Sep 2026 75,644.50 | 19 Sep 2026 80,883.90 | 3 | $5,239.38 |
| long | 8 Oct 2026 83,321.80 | 11 Oct 2026 82,988.40 | 3 | −$333.46 |
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Hobbiecode - Five Day Low RSI Strategy this page | — | v5 strategy | +3.7% | 60 | 2.0% |
| PlanB Quant Investing 101 v2 by fillippone | rsi lowest | v4 strategy | No trades on this market | ||
| STRATEGY R18-F-BTC by SenatorVonShaft | lowest rsi | v4 strategy | −8.6% | 11 | 14.4% |
| RSI Divergence Strategy by faytterro | rsi lowest | v5 strategy | +102.9% | 41 | 2.0% |
| Dynamic Stop Loss Demo by Tindtily | lowest rsi | v5 strategy | does not run in Zeal Terminal | ||
| Stochastic RSI by Zeal Terminal | rsi lowest | v5 indicator | indicator | ||
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.
- No v6-only features. v6 is not needed to run this script.
Clean v5
VerifiedNothing to change.
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: 60 before, 48 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.
⋯// There is a time stop of five days if the sell criterium is not triggered.-//@version=5+//@version=6strategy("Hobbiecode - Five Day Low RSI Strategy", overlay=true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 10 ms | Yes 1,000 bars in 18 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
“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/// © hobbiecode// If today’s close is below yesterday’s five-day low, go long at the close.// Sell at the close when the two-day RSI closes above 50.// There is a time stop of five days if the sell criterium is not triggered.//@version=5strategy("Hobbiecode - Five Day Low RSI Strategy", overlay=true)// RSI parametersrsi_period = 2rsi_upper = 50// Calculate RSIrsi_val = ta.rsi(close, rsi_period)// Check if today's close is below yesterday's 5 day lowconditionEntry = close < ta.lowest(low[1], 5) and strategy.position_size < 1if (conditionEntry) strategy.entry("Buy", strategy.long)// Check if RSI closes above 50if (strategy.position_size > 0 and rsi_val > rsi_upper) strategy.close("Buy")// If position held for more than 5 days without sell criteria, then close positionif (strategy.position_size > 0 and ta.barssince(conditionEntry) >= 5) strategy.close("Buy")// Plot RSI on chartplot(rsi_val, title="RSI", color=color.red)hline(rsi_upper, title="Overbought Level", color=color.blue)