Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

RSI Centered Pivots

A Pine Script v4 strategy built on RSI (close, 19), Pivotlow (rsi, 2) and Pivothigh (rsi, 2). It has 3 order rules, 1 entry among them, and trades long only with the default settings. Exits use a stop loss. Each trade is one contract and pays 0.1% commission. 1 setting; defaults include Length 19.

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 RSI Centered Pivots repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did RSI Centered Pivots do on BTCUSDT 1D with default settings?
+98.02%
From 26 Jan 2024 to 21 Oct 2026, over 4 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can RSI Centered Pivots be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
Does RSI Centered Pivots use a stop loss?
Yes
strategy.exit sets a stop on line 17.
Does RSI Centered Pivots run in Zeal Terminal?
Yes
It compiles in 8 ms and runs 1,000 bars in 22 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • HLine
  • HLine
  • 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 (1)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctPlot$24,261$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. Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 14) so the engine trades the way the script says.
Net profit
+98.02%
$9,802.23
Buy and hold
+102.5%
same period
Closed trades
4
2 won · 2 lost
Profitable
50.0%
of closed trades
Profit factor
1.75
gross profit ÷ gross loss
Max drawdown
160.20%
−$32,878.40

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.

  • Note

    Uses an argument v6 removed

    when = on line 14, 15. The upgraded version below moves each call inside an if block.

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames rsi → ta.rsi, pivotlow → ta.pivotlow, pivothigh → ta.pivothigh.
  • 2 strategy calls use the when = argument (line 14, 15). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

Same 4 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 7: rsi → ta.rsi
  • Line 8: pivotlow → ta.pivotlow
  • Line 9: pivothigh → ta.pivothigh
  • Line 14: strategy.entry(…, true) → strategy.entry(…, strategy.long)
⋯// © OztheWoz-//@version=4+//@version=5strategy("RSI Fractals", initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.1, slippage=3)⋯len = input(19, "Length")-rsi = rsi(close, len)+rsi = ta.rsi(close, len)-fractup = pivotlow(rsi, 2, 2)+fractup = ta.pivotlow(rsi, 2, 2)-fractdn = pivothigh(rsi, 2, 2)+fractdn = ta.pivothigh(rsi, 2, 2)plot(rsi)⋯plotshape(fractup, style=shape.triangleup, location=location.bottom, color=color.green, offset=-2)-strategy.entry("Long", true, 1, when=fractup)+strategy.entry("Long", strategy.long, 1, when=fractup)strategy.close("Long", when=(rsi >= 80))⋯

Clean v5

VerifiedDownload the v5 script

Same 4 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 6: input() → input.int()
  • Line 14: when = fractup → if block
  • Line 15: when = (rsi >= 80) → if block
⋯// study("RSI Fractals")-len = input(19, "Length")+len = input.int(19, "Length")rsi = ta.rsi(close, len)⋯plotshape(fractup, style=shape.triangleup, location=location.bottom, color=color.green, offset=-2)-strategy.entry("Long", strategy.long, 1, when=fractup)+if fractup+    strategy.entry("Long", strategy.long, 1)-strategy.close("Long", when=(rsi >= 80))+if (rsi >= 80)+    strategy.close("Long")stoploss = close[1] - (close[1] * 0.5/100)⋯

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: 4 before, 0 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.

⋯// © OztheWoz-//@version=5+//@version=6strategy("RSI Fractals", initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.1, slippage=3)⋯

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
Length19intrsi

What it calculates

  • RSI (rsi, ta.rsi in v5)close, Length (19)rsi · line 7
  • Pivotlow (pivotlow, ta.pivotlow in v5)rsi, 2, 2fractup · line 8
  • Pivothigh (pivothigh, ta.pivothigh in v5)rsi, 2, 2fractdn · line 9

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 datalenLengthsetting · 19rsiRSI→ rsifractupPivotlow→ fractupfractdnPivothigh→ fractdnstoplossstoplossvalueentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeexit:Longexit Longstrategy.exitplot:10plotplothline:11hlinehlinehline:12hlinehlineplotshape:13plotshapeplotshape

Order rules

OrderFires whenBy defaultLine
Open Long longfractupOn14
Close Long(rsi >= 80)On15
Exit Long stopevery barOn17

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.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • 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+98.0%+102.5%450%1.75160.2%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−61.0%+5.5%333%0.59240.3%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−9.4%+9.8%683%0.2321.6%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−2.6%+8.4%10%0.008.4%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.3%+16.7%250%0.721.3%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.1%+21.5%333%0.110.3%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+3.8%+148.3%475%6.732.2%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.1%+17.1%367%1.141.6%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 market450%$9,882.48
Sideways market0—$0.00
Falling market0—$0.00

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

42.0%

The 95th percentile of the worst drawdown when the same 4 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 38.4% to 42.0%; the tick is what actually happened, 38.4%. Order luck alone moves it this much.

0%48%
All 4 trades
SideEntryExitBarsP&L
long17 Feb 2024 52,124.1018 Feb 2024 51,642.601−$585.29
long26 Feb 2024 51,728.9027 Feb 2024 54,476.401$2,641.36
long5 Mar 2024 68,245.7012 Nov 2024 88,648.00252$20,245.30
long17 Nov 2024 90,588.0022 Aug 2026 78,338.00643−$12,418.90

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
RSI Centered Pivots this page—v4 strategy+98.0%4160.2%
RSI5_50 with Divergence by mohaneersi pivotlow pivothighv4 strategy+443.3%25411.3%
RSI Divergence X Ichimoku Cloud X 200EMA by tradethrillsrsi pivotlow pivothighv4 strategy−196,793.0%71,854.6%
Pivot Point Breakout by EduardoMattjepivotlow pivothighv5 strategy+93.0%2532.3%
Monthly Returns of a Strategy in a Chart by QuantNomadpivothigh pivotlowv5 strategy+21.0%7613.0%
ZigZag by Zeal Terminalpivothigh pivotlowv5 indicatorindicator

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 8 msWith a workaround 1,000 bars in 22 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 14) so the engine trades the way the script says.

“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. PineTS runs Pine Script v5 and v6 only.

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/// © OztheWoz//@version=4strategy("RSI Fractals", initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.1, slippage=3)// study("RSI Fractals")len = input(19, "Length")rsi = rsi(close, len)fractup = pivotlow(rsi, 2, 2)fractdn = pivothigh(rsi, 2, 2)plot(rsi)hline(80, color=color.gray)hline(20, color=color.gray)plotshape(fractup, style=shape.triangleup, location=location.bottom, color=color.green, offset=-2)strategy.entry("Long", true, 1, when=fractup)strategy.close("Long", when=(rsi >= 80))stoploss = close[1] - (close[1] * 0.5/100)strategy.exit("Long", "Exit Long", stop=stoploss)// alertcondition(fractup, "RSI Fractal Up",   "RSI Fractal V \nExpect Reversal Bearish")// alertcondition(fractdn, "RSI Fractal Down", "RSI Fractal ^ \nExpect Reversal Bullish")// alertcondition((rsi >= 80), "RSI Overbought",  "RSI Overbought \nSell Before Bearish Reversal")// alertcondition((rsi <= 20), "RSI Underbought", "RSI Underbought \nSell Before Bullish Reversal")