Zeal Terminal Open in Zeal Terminal

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
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (5)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctPlot$12,414$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.
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.

SettingDefaultType and rangeFeeds
Frequency (no label in the script)10intmomentumRSI_slow
RSI Frequency (no label in the script)40intmomentumRSI
Buy Zone Distance (no label in the script)5intisBuy isShort plot
Avg Down ATRSum (no label in the script)3intisBuy isShort
Use Absolute RSIBarrier (no label in the script)trueboolisShort 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.

closecloseprice datarsiFrequencyRSI Frequencysetting · 40frequencyFrequencysetting · 10buyZoneDistanceBuy Zone Distancesetting · 5avgDownATRSumAvg Down ATRSumsetting · 3momentumRSIRSI→ momentumRSImomentumRSI_slowSMA→ momentumRSI_slowisCloseisClosevalueisBuyisBuyconditionisShortisShortconditionmomentumRSISoftClosemomentumRSISoftCloseconditionentry:BuyOpen Buystrategy.entryexit:Closeexit Closestrategy.exitplot:19plotplotplot:20plotplotplot:21plotplotplot:22plotplotplot:23plotplotplot:24plotplot

Order rules

OrderFires whenBy defaultLine
Open Buy long(isBuy)On29
Exit Close limit(isClose)On33

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.

7/7trades 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+24.1%+102.5%3067%1.4644.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−14.8%+5.5%3070%0.6665.3%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+81.8%+9.8%3462%1.7370.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−24.7%+8.4%2861%0.5581.5%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+78.9%+16.7%3266%1.4957.7%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+22.2%+21.5%3577%1.6056.4%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+95.4%+148.3%3281%2.5932.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+8.5%+17.1%3580%1.2439.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.

Before 26 Dec 2025 · in-sample
RSI Frequency ↓ · Frequency →567910121417
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%
From 26 Dec 2025 · out-of-sample
RSI Frequency ↓ · Frequency →567910121417
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 barsTradesWonP&L
Rising market1385%$3,425.22
Sideways market1250%−$716.87
Falling market560%−$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.

0%29%
All 30 trades
SideEntryExitBarsP&L
long16 Mar 2024 69,499.8026 Mar 2024 69,880.0010$54.70
long3 Apr 2024 65,464.009 Apr 2024 71,620.006$940.37
long14 Apr 2024 63,924.5022 Apr 2024 64,941.208$159.04
long1 May 2024 60,672.004 May 2024 62,882.003$364.25
long14 Jun 2024 66,773.0016 Jul 2024 64,724.1032−$306.84
long25 Jun 2024 60,293.3016 Jul 2024 64,724.1021$734.88
long3 Aug 2024 61,498.3024 Aug 2024 64,037.2021$412.84
long2 Sep 2024 57,301.8014 Sep 2024 60,498.0012$557.79
long2 Oct 2024 60,804.9012 Oct 2024 62,540.0010$285.35
long26 Nov 2024 93,010.005 Dec 2024 98,587.309$599.65
long19 Dec 2024 100,204.003 Jan 2025 96,984.8015−$321.27
long10 Jan 2025 92,552.5015 Jan 2025 96,560.905$433.09
long3 Feb 2025 97,700.6013 Feb 2025 97,870.0010$17.34
long25 Feb 2025 91,552.9022 Apr 2025 87,516.2056−$440.91
long7 Apr 2025 78,430.0022 Apr 2025 87,516.2015$1,158.51
long30 May 2025 105,590.008 Jun 2025 105,552.009−$3.56
long22 Jun 2025 102,120.0024 Jun 2025 105,334.002$314.72
long1 Aug 2025 115,764.008 Aug 2025 117,472.007$147.54
long19 Aug 2025 116,227.009 Sep 2025 112,065.0021−$358.08
long23 Sep 2025 112,651.0030 Sep 2025 114,312.007$147.44
long11 Oct 2025 112,774.0027 Oct 2025 114,559.0016$158.27
long4 Nov 2025 106,583.0014 Jan 2026 95,414.0071−$1,047.92
long17 Nov 2025 94,261.4014 Jan 2026 95,414.0058$122.27
long21 Jan 2026 88,427.7014 Apr 2026 74,418.0083−$1,584.31
long1 Feb 2026 78,741.1014 Apr 2026 74,418.0072−$549.03
long17 May 2026 78,148.1026 May 2026 77,322.009−$105.70
long29 May 2026 73,617.5020 Aug 2026 69,334.8083−$581.75
long3 Jun 2026 66,760.8020 Aug 2026 69,334.8078$385.55
long11 Sep 2026 76,568.7019 Sep 2026 80,883.908$563.56
long9 Oct 2026 81,754.5021 Oct 2026 83,028.1012$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.

ScriptSharesTypeNetTradesMax drawdown
I11L - Meanreverter 4h this page—v5 strategy+24.1%3044.4%
SRJ RSI Outperformer Strategy by Sapt_Jashrsi smav5 strategy+0.6%82.4%
RSI SMA Crossover Strategy by reeesrsi smav5 strategy+39.8%4230.8%
Short In Downtrend Below MA100 (Coinrule) by Coinrulesma rsiv4 strategy−34.5%9945.4%
Simple RSI and SMA Long and Short (by Coinrule) by Coinrulersi smav5 strategy−3.0%217.7%
Maximized Moving Average Crossing (by Coinrule) by Coinrulesma rsiv4 strategy−6.6%913.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

Verified

Nothing 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

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 18 msYes 1,000 bars in 37 msNot measured
PineTSNot testedNot testedNot 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)