Pine Script v5 · Strategy
Merovinh - Mean Reversion Lowest low
A Pine Script v5 strategy built on Highest (high, 9) and Lowest (low, 9). It has 5 order rules, 4 entries among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 10% of equity and pays 0.04% commission. 4 settings; defaults include Minimum number of bars 9 and Number of broken lows One.
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 Merovinh - Mean Reversion Lowest low repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 8 of 8 trades.
- How did Merovinh - Mean Reversion Lowest low do on BTCUSDT 1D with default settings?
- +0.93%
- From 26 Jan 2024 to 21 Oct 2026, over 29 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does Merovinh - Mean Reversion Lowest low 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: 29 before, 29 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 Merovinh - Mean Reversion Lowest low use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Merovinh - Mean Reversion Lowest low run in Zeal Terminal?
- Yes
- It compiles in 20 ms and runs 1,000 bars in 32 ms, in the browser.
BTCUSDT · 1D · default settings
- Lowest Low Line
- Highest High Line
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +0.93%
- $93.44
- Buy and hold
- +102.5%
- same period
- Closed trades
- 29
- 19 won · 10 lost
- Profitable
- 65.5%
- of closed trades
- Profit factor
- 1.11
- gross profit ÷ gross loss
- Max drawdown
- 5.84%
- −$608.18
One run with the author's default settings, $10,000 starting capital, commission as the script sets it. A long position was still open at the last bar. 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.
-
Note
2 settings have no label
In the settings dialog startTime (line 16), finalTime (line 17) show an empty name. The labels on this page come from the variable names.
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 |
|---|---|---|---|
| Minimum number of barsThe minimum number of bars before updating lowest low / highest high | 9 | int | highestHigh lowestLow |
| Number of broken lows | One | string · options ['One', 'Two', 'Three', 'Four'] | line 26 line 29 line 32 line 35 |
| Time Period | |||
| Start Time (no label in the script) | timestamp("27 Jul 2021 00:00 +0000") | time | truetime |
| Final Time (no label in the script) | timestamp("31 Dec 2030 23:59 +0000") | time | truetime |
What it calculates
- Highesthigh, Minimum number of bars (9)
highestHigh · line 24 - Lowestlow, Minimum number of bars (9)
lowestLow · line 25
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 long long | truetime and prevLow > 0 and lowestLow < prevLow | On | 28 |
| Open long long | truetime and prevLow > 0 and lowestLow < prevLow and prevLow < prevLow2 | On | 31 |
| Open long long | truetime and prevLow > 0 and lowestLow < prevLow and prevLow < prevLow2 and prevLow2 < prevLow3 | On | 34 |
| Open long long | truetime and prevLow > 0 and lowestLow < prevLow and prevLow < prevLow2 and prevLow2 < prevLow3 and prevLow3 < prevLow4 | On | 37 |
| Close long | truetime and prevHigh > 0 and highestHigh > prevHigh | On | 39 |
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 | +0.9% | +102.5% | 29 | 66% | 1.11 | 5.8% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.5% | +5.5% | 36 | 67% | 0.84 | 2.9% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +4.0% | +9.8% | 33 | 73% | 1.31 | 6.7% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.5% | +8.4% | 37 | 76% | 1.10 | 3.4% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +5.3% | +16.7% | 32 | 63% | 1.36 | 6.9% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −1.5% | +21.5% | 29 | 59% | 0.68 | 4.1% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +9.1% | +148.3% | 34 | 71% | 2.19 | 5.4% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.1% | +17.1% | 35 | 71% | 1.02 | 2.4% | 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 | 11 | 82% | $476.34 |
| Sideways market | 13 | 54% | −$277.29 |
| Falling market | 5 | 60% | −$105.21 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
5.7%
The 95th percentile of the worst drawdown when the same 29 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 2.4% to 5.7%; the tick is what actually happened, 5.0%. Order luck alone moves it this much.
All 29 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 17 Mar 2024 65,300.70 | 26 Mar 2024 69,880.00 | 9 | $69.27 |
| long | 4 Apr 2024 65,963.30 | 9 Apr 2024 71,620.00 | 5 | $85.48 |
| long | 14 Apr 2024 63,924.50 | 7 May 2024 63,165.20 | 23 | −$12.87 |
| long | 12 Jun 2024 67,314.20 | 15 Jul 2024 60,797.90 | 33 | −$98.91 |
| long | 2 Aug 2024 65,354.00 | 22 Aug 2024 61,156.00 | 20 | −$65.26 |
| long | 31 Aug 2024 59,124.00 | 14 Sep 2024 60,498.00 | 14 | $22.37 |
| long | 2 Oct 2024 60,804.90 | 15 Oct 2024 66,084.00 | 13 | $85.95 |
| long | 6 Dec 2024 96,945.60 | 16 Dec 2024 104,464.00 | 10 | $77.35 |
| long | 21 Dec 2024 97,805.40 | 7 Jan 2025 102,236.00 | 17 | $45.19 |
| long | 10 Jan 2025 92,552.50 | 18 Jan 2025 104,077.00 | 8 | $126.20 |
| long | 28 Jan 2025 102,083.00 | 22 Feb 2025 96,182.00 | 25 | −$60.52 |
| long | 25 Feb 2025 91,552.90 | 20 Mar 2025 86,845.90 | 23 | −$53.60 |
| long | 30 Mar 2025 82,648.50 | 13 Apr 2025 85,276.90 | 14 | $31.66 |
| long | 31 May 2025 103,985.00 | 10 Jun 2025 110,263.00 | 10 | $61.02 |
| long | 21 Jun 2025 103,298.00 | 27 Jun 2025 106,947.00 | 6 | $35.58 |
| long | 26 Jul 2025 117,614.00 | 11 Aug 2025 119,294.00 | 16 | $13.94 |
| long | 19 Aug 2025 116,227.00 | 11 Sep 2025 113,960.00 | 23 | −$21.03 |
| long | 23 Sep 2025 112,651.00 | 2 Oct 2025 118,595.00 | 9 | $53.70 |
| long | 11 Oct 2025 112,775.00 | 27 Oct 2025 114,559.00 | 16 | $15.61 |
| long | 31 Oct 2025 108,323.00 | 4 Dec 2025 93,429.90 | 34 | −$143.86 |
| long | 15 Dec 2025 88,172.20 | 3 Jan 2026 89,995.10 | 19 | $20.39 |
| long | 21 Jan 2026 88,427.70 | 3 Mar 2026 68,830.10 | 41 | −$228.64 |
| long | 22 Mar 2026 68,918.10 | 7 Apr 2026 68,853.60 | 16 | −$1.74 |
| long | 16 May 2026 79,113.20 | 15 Jun 2026 65,746.40 | 30 | −$170.59 |
| long | 24 Jun 2026 62,734.60 | 5 Jul 2026 63,144.00 | 11 | $5.66 |
| long | 29 Jul 2026 63,915.00 | 10 Aug 2026 64,901.60 | 12 | $14.47 |
| long | 14 Aug 2026 63,490.90 | 20 Aug 2026 69,334.80 | 6 | $90.32 |
| long | 3 Sep 2026 77,340.00 | 4 Sep 2026 81,270.40 | 1 | $49.96 |
| long | 12 Sep 2026 77,225.70 | 19 Sep 2026 80,883.90 | 7 | $46.75 |
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 |
|---|---|---|---|---|---|
| Merovinh - Mean Reversion Lowest low this page | — | v5 strategy | +0.9% | 29 | 5.8% |
| Alex Days HiLo Rajib by 14rajib | highest lowest | v4 strategy | No trades on this market | ||
| Donchian Strat EXMO by pskoroplas | highest lowest | v4 strategy | +12.1% | 22 | 68.0% |
| Average Highest High and Lowest Low Swinger Strategy by exlux99 | lowest highest | v4 strategy | +6.4% | 20 | 49.6% |
| Highest High and Lowest Low Channel Strategy by ceyhun | highest lowest | v5 strategy | −3.7% | 26 | 7.9% |
| Donchian Channels System [racer8] by racer8 | highest lowest | v4 strategy | −3.2% | 36 | 43.6% |
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.
- 1 setting uses the untyped input() (line 13). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Same 29 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 13: input() → input.int()
⋯GR_TIME = 'Time Period'-bars = input(9, title = "Minimum number of bars", tooltip = "The minimum number of bars before updating lowest low / highest high")+bars = input.int(9, title = "Minimum number of bars", tooltip = "The minimum number of bars before updating lowest low / highest high")numberOfLows = input.string(defval='One', title='Number of broken lows', options=['One', 'Two', 'Three', 'Four'])⋯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: 29 before, 29 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.
⋯// © merovinh-//@version=5+//@version=6strategy(title="Merovinh - Mean Reversion Lowest low",⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 20 ms | With a workaround 1,000 bars in 32 ms | Not measured |
| PineTS | Not tested | Not tested | 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.
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/// © merovinh//@version=5strategy(title="Merovinh - Mean Reversion Lowest low", overlay = true, default_qty_type = strategy.percent_of_equity, initial_capital = 10000, default_qty_value = 10, commission_type = strategy.commission.percent, slippage = 1, commission_value = 0.04)GR_TIME = 'Time Period'bars = input(9, title = "Minimum number of bars", tooltip = "The minimum number of bars before updating lowest low / highest high")numberOfLows = input.string(defval='One', title='Number of broken lows', options=['One', 'Two', 'Three', 'Four'])//PeriodstartTime = input.time(timestamp("27 Jul 2021 00:00 +0000"), "Start date", inline = "period", group = GR_TIME)finalTime = input.time(timestamp("31 Dec 2030 23:59 +0000"), "Final date", inline = "period", group = GR_TIME)var prevLow = .0var prevHigh = .0var prevLow2 = .0var prevLow3 = .0var prevLow4 = .0truetime = time > startTime and time < finalTimehighestHigh = ta.highest(high, bars)lowestLow = ta.lowest(low, bars)if numberOfLows == 'One' if truetime and prevLow > 0 and lowestLow < prevLow strategy.entry('long', strategy.long)if numberOfLows == 'Two' if truetime and prevLow > 0 and lowestLow < prevLow and prevLow < prevLow2 strategy.entry('long', strategy.long)if numberOfLows == 'Three' if truetime and prevLow > 0 and lowestLow < prevLow and prevLow < prevLow2 and prevLow2 < prevLow3 strategy.entry('long', strategy.long)if numberOfLows == 'Four' if truetime and prevLow > 0 and lowestLow < prevLow and prevLow < prevLow2 and prevLow2 < prevLow3 and prevLow3 < prevLow4 strategy.entry('long', strategy.long)if truetime and prevHigh > 0 and highestHigh > prevHigh strategy.close('long')if prevLow != lowestLow prevLow4 := prevLow3 prevLow3 := prevLow2 prevLow2 := prevLow prevLow := lowestLowprevHigh := highestHighplot(lowestLow, color=color.green, linewidth=1, title="Lowest Low Line")plot(highestHigh, color=color.green, linewidth=1, title="Highest High Line")