Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Pivot Point Breakout

A Pine Script v5 strategy built on Pivotlow (3, 3) and Pivothigh (3, 3). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 7 settings; defaults include Order direction LONG, Left 3 and Right 3.

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 Pivot Point Breakout repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 6 of 6 trades.
How did Pivot Point Breakout do on BTCUSDT 1D with default settings?
+93.01%
From 26 Jan 2024 to 21 Oct 2026, over 25 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Pivot Point Breakout 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: 25 before, 25 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 Pivot Point Breakout use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Pivot Point Breakout run in Zeal Terminal?
Yes
It compiles in 17 ms and runs 1,000 bars in 38 ms, in the browser.

BTCUSDT · 1D · default settings

  • Last pivot low
  • Last pivot high
  • Pivot low
  • Pivot high
  • 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 (7)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,930,030$2,025,273Equity from $1,000,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
+93.01%
$930,115.00
Buy and hold
+102.5%
same period
Closed trades
25
9 won · 16 lost
Profitable
36.0%
of closed trades
Profit factor
1.72
gross profit ÷ gross loss
Max drawdown
32.29%
−$663,151.00

One run with the author's default settings, $1,000,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.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    2 settings have no label

    In the settings dialog startDate (line 21), endDate (line 22) 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.

  • Note

    Uses an argument v6 removed

    when = on line 43, 44, 46, 47. The upgraded version below moves each call inside an if block.

Settings

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

SettingDefaultType and rangeFeeds
Order directionLONGstring · options [BOTH, LONG, SHORT]entry Long close Short entry Short close Long
Pivot high
Left3int · min 0highPivot
Right3int · min 0highPivot plotshape
Pivot low
Left3int · min 0lowPivot
Right3int · min 0lowPivot plotshape
Date selection
Start Date (no label in the script)0timevalidTrade
End Date (no label in the script)0timevalidTrade

What it calculates

  • PivotlowLeft (3), Right (3)lowPivot · line 26
  • PivothighLeft (3), Right (3)highPivot · line 27

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.

leftLowLeftsetting · 3rightLowRightsetting · 3leftHighLeftsetting · 3rightHighRightsetting · 3timetimeprice datastartDateStart Datesetting · 0endDateEnd Datesetting · 0orderDirectionOrder directionsetting · LONGlowPivotPivotlow→ lowPivothighPivotPivothigh→ highPivotlastHighlastHighvaluelastLowlastLowvaluepastLevelpastLevelvaluevalidTradevalidTradevalueentry:LongOpen Longstrategy.entryclose:ShortClose Shortstrategy.closeentry:ShortOpen Shortstrategy.entryclose:LongClose Longstrategy.closeplot:50Last pivot lowplotplot:51Last pivot highplotplotshape:52plotshapeplotshapeplotshape:53plotshapeplotshape

Order rules

OrderFires whenBy defaultLine
Open Long longorderDirection != SHORT and validTradeOn43
Close ShortorderDirection == SHORTOn44
Open Short shortorderDirection != LONG and validTradeOn46
Close LongorderDirection == LONGOn47

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.

6/6trades 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 timingprocess_orders_on_close = true: orders fill at the signal bar's close.

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+93.0%+102.5%2536%1.7232.3%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+2.3%+5.5%2524%1.0710.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+15.1%+9.8%2536%1.1050.1%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+12.4%+8.4%2133%1.3415.6%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+25.1%+16.7%2446%1.1261.5%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+13.9%+21.5%2532%1.3116.1%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+28.7%+148.3%2339%1.2243.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+19.1%+17.1%2348%1.976.3%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 market838%−$227,589.00
Sideways market1233%$770,129.00
Falling market540%$387,575.00

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

How bad could the drawdown be?

39.6%

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

0%46%
All 25 trades
SideEntryExitBarsP&L
long7 Feb 2024 44,349.6013 Apr 2024 63,924.5066$441,377.00
long6 May 2024 63,165.2011 Jun 2024 67,314.2036$94,677.90
long15 Jul 2024 64,724.101 Aug 2024 65,354.0017$14,948.50
long23 Aug 2024 64,037.204 Sep 2024 57,970.9012−$146,929.00
long13 Sep 2024 60,498.0010 Oct 2024 60,326.4027−$3,982.83
long14 Oct 2024 66,084.005 Dec 2024 96,945.6052$653,852.00
long6 Dec 2024 99,740.8020 Dec 2024 97,805.4014−$39,855.30
long6 Jan 2025 102,236.009 Jan 2025 92,552.503−$190,762.00
long17 Jan 2025 104,077.0027 Jan 2025 102,083.0010−$34,944.10
long21 Feb 2025 96,182.0024 Feb 2025 91,552.903−$86,072.30
long19 Mar 2025 86,845.906 Apr 2025 78,430.0018−$164,965.00
long21 Apr 2025 87,516.2029 May 2025 105,590.0038$317,487.00
long9 Jun 2025 110,263.0020 Jun 2025 103,298.0011−$117,165.00
long2 Jul 2025 108,850.0025 Jul 2025 117,614.0023$139,919.00
long11 Aug 2025 118,686.0022 Aug 2025 116,936.0011−$27,684.80
long10 Sep 2025 113,960.0022 Sep 2025 112,651.0012−$21,249.00
long1 Oct 2025 118,595.0010 Oct 2025 112,775.009−$89,747.90
long26 Oct 2025 114,559.003 Nov 2025 106,583.008−$121,074.00
long3 Dec 2025 93,429.9014 Dec 2025 88,172.2011−$91,043.60
long2 Jan 2026 89,995.1020 Jan 2026 88,427.7018−$26,592.50
long25 Feb 2026 67,988.0027 Mar 2026 66,407.3030−$34,880.40
long6 Apr 2026 68,853.7013 May 2026 79,313.6037$222,604.00
long14 Jul 2026 65,044.001 Sep 2026 77,439.0049$321,656.00
long3 Sep 2026 81,270.4011 Sep 2026 77,225.708−$100,013.00
long18 Sep 2026 80,883.908 Oct 2026 81,754.4020$20,553.30

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
Pivot Point Breakout this page—v5 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
RSI Centered Pivots by OztheWozpivotlow pivothighv4 strategy+98.0%4160.2%
ABCD Strategy by kerok3gpivothigh pivotlowv5 strategy−2.7%43.0%
Steven Primo's bollinger bands strategy by EduardoMattjepivothigh pivotlowv5 strategy−17.7%1528.2%

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.

  • 4 strategy calls use the when = argument (line 43, 44, 46, 47). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

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

  • Line 43: when = orderDirection != SHORT and validTrade → if block
  • Line 44: when = orderDirection == SHORT → if block
  • Line 46: when = orderDirection != LONG and validTrade → if block
  • Line 47: when = orderDirection == LONG → if block
⋯if high > lastHigh-    strategy.entry("Long", strategy.long, when=orderDirection != SHORT and validTrade)+    if orderDirection != SHORT and validTrade+        strategy.entry("Long", strategy.long)-    strategy.close("Short", when=orderDirection == SHORT)+    if orderDirection == SHORT+        strategy.close("Short")if low < lastLow-    strategy.entry("Short", strategy.short, when=orderDirection != LONG and validTrade)+    if orderDirection != LONG and validTrade+        strategy.entry("Short", strategy.short)-    strategy.close("Long", when=orderDirection == LONG)+    if orderDirection == LONG+        strategy.close("Long")    ⋯

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

⋯// © EduardoMattje-//@version=5+//@version=6strategy("Pivot Point Breakout", "PPB", true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, process_orders_on_close=true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 17 msWith a workaround 1,000 bars in 38 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/// © EduardoMattje//@version=5strategy("Pivot Point Breakout", "PPB", true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, process_orders_on_close=true)// Constantsvar L_PIVOT_HIGH = "Pivot high"var L_PIVOT_LOW = "Pivot low"var LEFT = "Left"var RIGHT = "Right"var BOTH = "Both"var LONG = "Long"var SHORT = "Short"var DATES = "Date selection"var DATES_TOOLTIP = "Change it to limit the trades for the given time interval.\n\nLeave it to disable this behaviour."// Inputsvar orderDirection = input.string(LONG, "Order direction", options=[BOTH, LONG, SHORT])var leftHigh = input.int(3, LEFT, minval=0, inline=L_PIVOT_HIGH, group=L_PIVOT_HIGH)var rightHigh = input.int(3, RIGHT, minval=0, inline=L_PIVOT_HIGH, group=L_PIVOT_HIGH)var leftLow = input.int(3, LEFT, minval=0, inline=L_PIVOT_LOW, group=L_PIVOT_LOW)var rightLow = input.int(3, RIGHT, minval=0, inline=L_PIVOT_LOW, group=L_PIVOT_LOW)var startDate = input.time(0, "Starting date", group=DATES)var endDate = input.time(0, "Final date", group=DATES)//var float lastHigh = navar float lastLow = nalowPivot = ta.pivotlow(leftLow, rightLow)highPivot = ta.pivothigh(leftHigh, rightHigh)f_updateLevels(pivot_) =>     var float pastLevel = na        if not na(pivot_)        pastLevel := pivot_        pastLevel    lastLow := f_updateLevels(lowPivot)lastHigh := f_updateLevels(highPivot)// Validates the time intervalvalidTrade = (startDate == 0 ? true : time >= startDate) and (endDate == 0 ? true : time <= endDate)// Ordersif high > lastHigh    strategy.entry("Long", strategy.long, when=orderDirection != SHORT and validTrade)    strategy.close("Short", when=orderDirection == SHORT)if low < lastLow    strategy.entry("Short", strategy.short, when=orderDirection != LONG and validTrade)    strategy.close("Long", when=orderDirection == LONG)    // Plotsplot(lastLow, "Last pivot low", color.red, offset=1)plot(lastHigh, "Last pivot high", color.teal, offset=1)plotshape(lowPivot, "Pivot low", location=location.belowbar, color=color.red, offset=-rightLow)plotshape(highPivot, "Pivot high", color=color.teal, offset=-rightHigh)