Zeal Terminal Open in Zeal Terminal

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

SettingDefaultType and rangeFeeds
Minimum number of barsThe minimum number of bars before updating lowest low / highest high9inthighestHigh lowestLow
Number of broken lowsOnestring · 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")timetruetime
Final Time (no label in the script)timestamp("31 Dec 2030 23:59 +0000")timetruetime

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.

highhighprice databarsMinimum number of barssetting · 9lowlowprice datatimetimeprice datastartTimeStart Timesetting · timestamp("27 Jul 2…finalTimeFinal Timesetting · timestamp("31 Dec 2…highestHighHighest→ highestHighlowestLowLowest→ lowestLowprevLowprevLowvalueprevHighprevHighvalueprevLow2prevLow2valueprevLow3prevLow3valueprevLow4prevLow4valuetruetimetruetimeconditionentry:longOpen longstrategy.entryclose:longClose longstrategy.closeplot:46Lowest Low Lineplotplot:47Highest High Lineplot

Order rules

OrderFires whenBy defaultLine
Open long longtruetime and prevLow > 0 and lowestLow < prevLowOn28
Open long longtruetime and prevLow > 0 and lowestLow < prevLow and prevLow < prevLow2On31
Open long longtruetime and prevLow > 0 and lowestLow < prevLow and prevLow < prevLow2 and prevLow2 < prevLow3On34
Open long longtruetime and prevLow > 0 and lowestLow < prevLow and prevLow < prevLow2 and prevLow2 < prevLow3 and prevLow3 < prevLow4On37
Close longtruetime and prevHigh > 0 and highestHigh > prevHighOn39

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.

8/8trades 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+0.9%+102.5%2966%1.115.8%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.5%+5.5%3667%0.842.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+4.0%+9.8%3373%1.316.7%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.5%+8.4%3776%1.103.4%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+5.3%+16.7%3263%1.366.9%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−1.5%+21.5%2959%0.684.1%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+9.1%+148.3%3471%2.195.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.1%+17.1%3571%1.022.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 barsTradesWonP&L
Rising market1182%$476.34
Sideways market1354%−$277.29
Falling market560%−$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.

0%6%
All 29 trades
SideEntryExitBarsP&L
long17 Mar 2024 65,300.7026 Mar 2024 69,880.009$69.27
long4 Apr 2024 65,963.309 Apr 2024 71,620.005$85.48
long14 Apr 2024 63,924.507 May 2024 63,165.2023−$12.87
long12 Jun 2024 67,314.2015 Jul 2024 60,797.9033−$98.91
long2 Aug 2024 65,354.0022 Aug 2024 61,156.0020−$65.26
long31 Aug 2024 59,124.0014 Sep 2024 60,498.0014$22.37
long2 Oct 2024 60,804.9015 Oct 2024 66,084.0013$85.95
long6 Dec 2024 96,945.6016 Dec 2024 104,464.0010$77.35
long21 Dec 2024 97,805.407 Jan 2025 102,236.0017$45.19
long10 Jan 2025 92,552.5018 Jan 2025 104,077.008$126.20
long28 Jan 2025 102,083.0022 Feb 2025 96,182.0025−$60.52
long25 Feb 2025 91,552.9020 Mar 2025 86,845.9023−$53.60
long30 Mar 2025 82,648.5013 Apr 2025 85,276.9014$31.66
long31 May 2025 103,985.0010 Jun 2025 110,263.0010$61.02
long21 Jun 2025 103,298.0027 Jun 2025 106,947.006$35.58
long26 Jul 2025 117,614.0011 Aug 2025 119,294.0016$13.94
long19 Aug 2025 116,227.0011 Sep 2025 113,960.0023−$21.03
long23 Sep 2025 112,651.002 Oct 2025 118,595.009$53.70
long11 Oct 2025 112,775.0027 Oct 2025 114,559.0016$15.61
long31 Oct 2025 108,323.004 Dec 2025 93,429.9034−$143.86
long15 Dec 2025 88,172.203 Jan 2026 89,995.1019$20.39
long21 Jan 2026 88,427.703 Mar 2026 68,830.1041−$228.64
long22 Mar 2026 68,918.107 Apr 2026 68,853.6016−$1.74
long16 May 2026 79,113.2015 Jun 2026 65,746.4030−$170.59
long24 Jun 2026 62,734.605 Jul 2026 63,144.0011$5.66
long29 Jul 2026 63,915.0010 Aug 2026 64,901.6012$14.47
long14 Aug 2026 63,490.9020 Aug 2026 69,334.806$90.32
long3 Sep 2026 77,340.004 Sep 2026 81,270.401$49.96
long12 Sep 2026 77,225.7019 Sep 2026 80,883.907$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.

ScriptSharesTypeNetTradesMax drawdown
Merovinh - Mean Reversion Lowest low this page—v5 strategy+0.9%295.8%
Alex Days HiLo Rajib by 14rajibhighest lowestv4 strategyNo trades on this market
Donchian Strat EXMO by pskoroplashighest lowestv4 strategy+12.1%2268.0%
Average Highest High and Lowest Low Swinger Strategy by exlux99lowest highestv4 strategy+6.4%2049.6%
Highest High and Lowest Low Channel Strategy by ceyhunhighest lowestv5 strategy−3.7%267.9%
Donchian Channels System [racer8] by racer8highest lowestv4 strategy−3.2%3643.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.

Clean v5

VerifiedDownload the v5 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

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 20 msWith a workaround 1,000 bars in 32 msNot measured
PineTSNot testedNot testedNot 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")