Pine Script v5 · Strategy
I11L - Meanreverter 4h
A Pine Script v5 strategy built on RSI (close, 40) and SMA (momentumRSI, 10). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits use a profit target and no stop loss. Each trade commits 10000 in cash and pays no commission. 5 settings; defaults include Frequency 10, RSI Frequency 40 and Buy Zone Distance 5.
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 I11L - Meanreverter 4h repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 7 of 7 trades.
- How did I11L - Meanreverter 4h do on BTCUSDT 1D with default settings?
- +24.14%
- From 26 Jan 2024 to 21 Oct 2026, over 30 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does I11L - Meanreverter 4h 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: 30 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 I11L - Meanreverter 4h use a stop loss?
- No
- Its exits set a profit target but no stop.
- Does I11L - Meanreverter 4h run in Zeal Terminal?
- Yes
- It compiles in 18 ms and runs 1,000 bars in 37 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Plot
- Plot
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +24.14%
- $2,413.59
- Buy and hold
- +102.5%
- same period
- Closed trades
- 30
- 20 won · 10 lost
- Profitable
- 66.7%
- of closed trades
- Profit factor
- 1.46
- gross profit ÷ gross loss
- Max drawdown
- 44.40%
- −$6,707.83
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
No stop loss
strategy.exit is used without a stop, loss or trailing stop.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
5 settings have no label
In the settings dialog frequency (line 6), rsiFrequency (line 7), buyZoneDistance (line 8), avgDownATRSum (line 9), useAbsoluteRSIBarrier (line 10) 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Frequency (no label in the script) | 10 | int | momentumRSI_slow |
| RSI Frequency (no label in the script) | 40 | int | momentumRSI |
| Buy Zone Distance (no label in the script) | 5 | int | isBuy isShort plot |
| Avg Down ATRSum (no label in the script) | 3 | int | isBuy isShort |
| Use Absolute RSIBarrier (no label in the script) | true | bool | isShort momentumRSISoftClose plot |
What it calculates
- RSIclose, RSI Frequency (40)
momentumRSI · line 12 - SMAmomentumRSI, Frequency (10)
momentumRSI_slow · line 13
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 | (isBuy) | On | 29 |
| Exit Close limit | (isClose) | On | 33 |
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 | +24.1% | +102.5% | 30 | 67% | 1.46 | 44.4% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −14.8% | +5.5% | 30 | 70% | 0.66 | 65.3% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +81.8% | +9.8% | 34 | 62% | 1.73 | 70.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −24.7% | +8.4% | 28 | 61% | 0.55 | 81.5% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +78.9% | +16.7% | 32 | 66% | 1.49 | 57.7% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +22.2% | +21.5% | 35 | 77% | 1.60 | 56.4% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +95.4% | +148.3% | 32 | 81% | 2.59 | 32.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +8.5% | +17.1% | 35 | 80% | 1.24 | 39.1% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
Settings heatmap
Two settings that feed the entry signal, moved around their defaults. The best in-sample pair (Frequency 10, RSI Frequency 56) made +106.9% before 26 Dec 2025 and −8.2% after it, against −17.2% for the defaults. 95% of the 64 combinations made money in-sample and 16% out-of-sample.
| RSI Frequency ↓ · Frequency → | 5 | 6 | 7 | 9 | 10 | 12 | 14 | 17 |
|---|---|---|---|---|---|---|---|---|
| 20 | +42% | +44% | +47% | +74% | +50% | +45% | +50% | +63% |
| 24 | +57% | +51% | +43% | +70% | +62% | +71% | +82% | +64% |
| 28 | +44% | +51% | +54% | +77% | +75% | +94% | +80% | +63% |
| 34 | +46% | +51% | +56% | +64% | +59% | +75% | +79% | +85% |
| 40 | +40% | +49% | +73% | +62% | +41% | +68% | +86% | +71% |
| 48 | +75% | +77% | +90% | +73% | +80% | +81% | +69% | +73% |
| 56 | +41% | +64% | +79% | +105% | +107% | +104% | +86% | +70% |
| 68 | +6% | −0% | −14% | +5% | +6% | +14% | −3% | +14% |
| RSI Frequency ↓ · Frequency → | 5 | 6 | 7 | 9 | 10 | 12 | 14 | 17 |
|---|---|---|---|---|---|---|---|---|
| 20 | +9% | +15% | +12% | −1% | −9% | −23% | −22% | −16% |
| 24 | −4% | −4% | −15% | −21% | −19% | −30% | −28% | −30% |
| 28 | −7% | −7% | −9% | −2% | −16% | −16% | −18% | −20% |
| 34 | −33% | −27% | −23% | −27% | −28% | −18% | −20% | −32% |
| 40 | −1% | −21% | −22% | −17% | −17% | −15% | −14% | −14% |
| 48 | −14% | −14% | −15% | −8% | −8% | −11% | −11% | −21% |
| 56 | −11% | −9% | −10% | −10% | −8% | −8% | −11% | −14% |
| 68 | +28% | −6% | +28% | +11% | +11% | +11% | +11% | +12% |
Net P&L of trades opened in each period, as a share of starting capital. marks the defaults and the best in-sample cell. Hover a cell for its trade count. 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 | 13 | 85% | $3,425.22 |
| Sideways market | 12 | 50% | −$716.87 |
| Falling market | 5 | 60% | −$294.76 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
22.8%
The 95th percentile of the worst drawdown when the same 30 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 11.2% to 22.8%; the tick is what actually happened, 25.0%. Order luck alone moves it this much.
All 30 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 16 Mar 2024 69,499.80 | 26 Mar 2024 69,880.00 | 10 | $54.70 |
| long | 3 Apr 2024 65,464.00 | 9 Apr 2024 71,620.00 | 6 | $940.37 |
| long | 14 Apr 2024 63,924.50 | 22 Apr 2024 64,941.20 | 8 | $159.04 |
| long | 1 May 2024 60,672.00 | 4 May 2024 62,882.00 | 3 | $364.25 |
| long | 14 Jun 2024 66,773.00 | 16 Jul 2024 64,724.10 | 32 | −$306.84 |
| long | 25 Jun 2024 60,293.30 | 16 Jul 2024 64,724.10 | 21 | $734.88 |
| long | 3 Aug 2024 61,498.30 | 24 Aug 2024 64,037.20 | 21 | $412.84 |
| long | 2 Sep 2024 57,301.80 | 14 Sep 2024 60,498.00 | 12 | $557.79 |
| long | 2 Oct 2024 60,804.90 | 12 Oct 2024 62,540.00 | 10 | $285.35 |
| long | 26 Nov 2024 93,010.00 | 5 Dec 2024 98,587.30 | 9 | $599.65 |
| long | 19 Dec 2024 100,204.00 | 3 Jan 2025 96,984.80 | 15 | −$321.27 |
| long | 10 Jan 2025 92,552.50 | 15 Jan 2025 96,560.90 | 5 | $433.09 |
| long | 3 Feb 2025 97,700.60 | 13 Feb 2025 97,870.00 | 10 | $17.34 |
| long | 25 Feb 2025 91,552.90 | 22 Apr 2025 87,516.20 | 56 | −$440.91 |
| long | 7 Apr 2025 78,430.00 | 22 Apr 2025 87,516.20 | 15 | $1,158.51 |
| long | 30 May 2025 105,590.00 | 8 Jun 2025 105,552.00 | 9 | −$3.56 |
| long | 22 Jun 2025 102,120.00 | 24 Jun 2025 105,334.00 | 2 | $314.72 |
| long | 1 Aug 2025 115,764.00 | 8 Aug 2025 117,472.00 | 7 | $147.54 |
| long | 19 Aug 2025 116,227.00 | 9 Sep 2025 112,065.00 | 21 | −$358.08 |
| long | 23 Sep 2025 112,651.00 | 30 Sep 2025 114,312.00 | 7 | $147.44 |
| long | 11 Oct 2025 112,774.00 | 27 Oct 2025 114,559.00 | 16 | $158.27 |
| long | 4 Nov 2025 106,583.00 | 14 Jan 2026 95,414.00 | 71 | −$1,047.92 |
| long | 17 Nov 2025 94,261.40 | 14 Jan 2026 95,414.00 | 58 | $122.27 |
| long | 21 Jan 2026 88,427.70 | 14 Apr 2026 74,418.00 | 83 | −$1,584.31 |
| long | 1 Feb 2026 78,741.10 | 14 Apr 2026 74,418.00 | 72 | −$549.03 |
| long | 17 May 2026 78,148.10 | 26 May 2026 77,322.00 | 9 | −$105.70 |
| long | 29 May 2026 73,617.50 | 20 Aug 2026 69,334.80 | 83 | −$581.75 |
| long | 3 Jun 2026 66,760.80 | 20 Aug 2026 69,334.80 | 78 | $385.55 |
| long | 11 Sep 2026 76,568.70 | 19 Sep 2026 80,883.90 | 8 | $563.56 |
| long | 9 Oct 2026 81,754.50 | 21 Oct 2026 83,028.10 | 12 | $155.79 |
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 |
|---|---|---|---|---|---|
| I11L - Meanreverter 4h this page | — | v5 strategy | +24.1% | 30 | 44.4% |
| SRJ RSI Outperformer Strategy by Sapt_Jash | rsi sma | v5 strategy | +0.6% | 8 | 2.4% |
| RSI SMA Crossover Strategy by reees | rsi sma | v5 strategy | +39.8% | 42 | 30.8% |
| Short In Downtrend Below MA100 (Coinrule) by Coinrule | sma rsi | v4 strategy | −34.5% | 99 | 45.4% |
| Simple RSI and SMA Long and Short (by Coinrule) by Coinrule | rsi sma | v5 strategy | −3.0% | 2 | 17.7% |
| Maximized Moving Average Crossing (by Coinrule) by Coinrule | sma rsi | v4 strategy | −6.6% | 9 | 13.3% |
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: 30 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.
⋯// © I11L-//@version=5+//@version=6strategy("I11L - Meanreverter 4h", overlay=false, pyramiding=3, default_qty_value=10000, initial_capital=10000, default_qty_type=strategy.cash,process_orders_on_close=false, calc_on_every_tick=false)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 18 ms | Yes 1,000 bars in 37 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/// © I11L//@version=5strategy("I11L - Meanreverter 4h", overlay=false, pyramiding=3, default_qty_value=10000, initial_capital=10000, default_qty_type=strategy.cash,process_orders_on_close=false, calc_on_every_tick=false) frequency = input.int(10)rsiFrequency = input.int(40)buyZoneDistance = input.int(5)avgDownATRSum = input.int(3)useAbsoluteRSIBarrier = input.bool(true)barrierLevel = 50//input.int(50)momentumRSI = ta.rsi(close,rsiFrequency)momentumRSI_slow = ta.sma(momentumRSI,frequency) isBuy = momentumRSI < momentumRSI_slow*(1-buyZoneDistance/100) and (strategy.position_avg_price - math.sum(ta.atr(20),avgDownATRSum)*strategy.opentrades > close or strategy.opentrades == 0 ) //and (momentumRSI < barrierLevel or not(useAbsoluteRSIBarrier))isShort = momentumRSI > momentumRSI_slow*(1+buyZoneDistance/100) and (strategy.position_avg_price - math.sum(ta.atr(20),avgDownATRSum)*strategy.opentrades > close or strategy.opentrades == 0 ) and (momentumRSI > barrierLevel or not(useAbsoluteRSIBarrier))momentumRSISoftClose = (momentumRSI > momentumRSI_slow) and (momentumRSI > barrierLevel or not(useAbsoluteRSIBarrier))isClose = momentumRSISoftCloseplot(momentumRSI,color=isClose ? color.red : momentumRSI < momentumRSI_slow*(1-buyZoneDistance/100) ? color.green : color.white)plot(momentumRSI_slow,color=color.gray)plot(barrierLevel,color=useAbsoluteRSIBarrier ? color.white : color.rgb(0,0,0,0))plot(momentumRSI_slow*(1-buyZoneDistance/100),color=color.gray)plot(momentumRSI_slow*(1+buyZoneDistance/100),color=color.gray)plot(momentumRSI_slow*(1+(buyZoneDistance*2)/100),color=color.gray)// plot(strategy.wintrades - strategy.losstrades) if(isBuy) strategy.entry("Buy",strategy.long, comment="#"+str.tostring(strategy.opentrades+1))// if(isShort)// strategy.entry("Sell",strategy.short, comment="#"+str.tostring(strategy.opentrades+1))if(isClose) strategy.exit("Close",limit=close)