Pine Script v5 · Strategy
Breakeven Line Demo
A Pine Script v5 strategy with no technical-analysis calculation. It has 3 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 0.27% of equity and pays no commission. It has no settings.
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 Breakeven Line Demo repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 2 of 2 trades.
- How did Breakeven Line Demo do on BTCUSDT 1D with default settings?
- +0.25%
- From 26 Jan 2024 to 21 Oct 2026, over 7 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does Breakeven Line Demo run in Pine Script v6?
- No
- The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L27:C28: cannot use 'float' as a condition — Pine Script v6 does not cast 'int' or 'float' to 'bool' implicitly. Wrap it in bool(). The v6 version is shown for reference and is not offered as a download.
- Does Breakeven Line Demo use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Breakeven Line Demo run in Zeal Terminal?
- Yes
- It compiles in 15 ms and runs 1,000 bars in 40 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +0.25%
- $25.35
- Buy and hold
- +102.5%
- same period
- Closed trades
- 7
- 5 won · 2 lost
- Profitable
- 71.4%
- of closed trades
- Profit factor
- 2.95
- gross profit ÷ gross loss
- Max drawdown
- 1.11%
- −$111.44
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.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
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.
The script declares no settings.
What it calculates
No technical-analysis calculation: the script works on prices and settings directly.
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 Buy long | sevenReds | On | 11 |
| Open Sell short | sevenGreens | On | 13 |
| Close Close | (hour == 5 and minute == 0 ) or (hour == 11 and minute == 0) or (hour == 17 and minute == 0 ) or (hour == 23 and minute == 0) | On | 15 |
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.3% | +102.5% | 7 | 71% | 2.95 | 1.1% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.1% | +5.5% | 12 | 42% | 0.40 | 0.3% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +0.9% | +9.8% | 7 | 100% | — | 0.4% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.1% | +8.4% | 5 | 60% | 6.75 | 0.1% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +1.3% | +16.7% | 7 | 100% | — | 0.2% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.8% | +21.5% | 5 | 100% | — | 0.1% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 1.7% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.3% | +17.1% | 6 | 100% | — | 0.1% | 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 | 4 | 50% | $6.31 |
| Sideways market | 3 | 100% | $19.04 |
| Falling market | 0 | — | $0.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
0.1%
The 95th percentile of the worst drawdown when the same 7 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 0.1% to 0.1%; the tick is what actually happened, 0.1%. Order luck alone moves it this much.
All 7 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 12 Feb 2024 48,300.00 | 7 Jun 2026 60,884.60 | 846 | −$7.03 |
| short | 13 Feb 2024 49,917.30 | 7 Jun 2026 60,884.60 | 845 | −$5.93 |
| short | 12 Nov 2024 88,648.00 | 7 Jun 2026 60,884.60 | 572 | $8.42 |
| short | 7 Jan 2025 102,236.00 | 7 Jun 2026 60,884.60 | 516 | $10.85 |
| short | 26 Apr 2025 94,638.70 | 7 Jun 2026 60,884.60 | 407 | $9.58 |
| short | 16 Mar 2026 72,815.30 | 7 Jun 2026 60,884.60 | 83 | $4.42 |
| short | 17 Mar 2026 74,884.70 | 7 Jun 2026 60,884.60 | 82 | $5.04 |
Similar scripts
No other indicator or strategy here shares enough of its calculations.
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
VerifiedNothing to change.
Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L27:C28: cannot use 'float' as a condition — Pine Script v6 does not cast 'int' or 'float' to 'bool' implicitly. Wrap it in bool(). The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © Eliza123123-//@version=5+//@version=6strategy("Breakeven Line Demo", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value = 0.27,⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 15 ms | With a workaround 1,000 bars in 40 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
Zeal Terminal's engine currently reads an order side written as direction = strategy.long, direction = strategy.short as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 11, 13) 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.
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/// © Eliza123123//@version=5strategy("Breakeven Line Demo", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value = 0.27, pyramiding=999, initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.00)// Generic signal (not a viable strategy don't use, just some code I wrote quick for demo purposes only)red = open > close, green = open < closesevenReds = red and red[1] and red[2] and red[3] and red[4] and red[5] and red[6]sevenGreens = green and green[1] and green[2] and green[3] and green[4] and green[5] and green[6]if sevenReds strategy.entry('Buy', direction=strategy.long)if sevenGreens strategy.entry('Sell', direction=strategy.short)if (hour == 5 and minute == 0 ) or (hour == 11 and minute == 0) or (hour == 17 and minute == 0 ) or (hour == 23 and minute == 0) strategy.close_all("Close")// Breakeven line for visualising breakeven price on stacked orders. var breakEvenLine = 0.0if strategy.opentrades > 0 breakEvenLine := strategy.position_avg_priceelse breakEvenLine := 0.0color breakEvenLineColor = naif strategy.position_size > 0 breakEvenLineColor := #15FF00if strategy.position_size < 0 breakEvenLineColor := #FF000Dplot(breakEvenLine, color = breakEvenLine and breakEvenLine[1] > 0 ? breakEvenLineColor : na, linewidth = 2, style = plot.style_circles)