Pine Script v5 · Strategy
DC Breakout Strategy - This is simplicity at its finest.
A Pine Script v5 strategy built on SMA (close, 8), Highest (high[1], 20) and Lowest (low[1], 20). 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 is one contract and pays no commission. 17 settings; defaults include Length Fast MA 8, Length Slow MA 32 and Source Fast MA close.
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 DC Breakout Strategy - This is simplicity at its finest. repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 18 of 18 trades.
- How did DC Breakout Strategy - This is simplicity at its finest. do on BTCUSDT 1D with default settings?
- +10.84%
- From 26 Jan 2024 to 21 Oct 2026, over 57 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does DC Breakout Strategy - This is simplicity at its finest. 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: 57 before, 57 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 DC Breakout Strategy - This is simplicity at its finest. use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does DC Breakout Strategy - This is simplicity at its finest. run in Zeal Terminal?
- Yes
- It compiles in 18 ms and runs 1,000 bars in 50 ms, in the browser.
BTCUSDT · 1D · default settings
- Fast MA
- Slow MA
- Upper
- Lower
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +10.84%
- $108,357.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 57
- 23 won · 34 lost
- Profitable
- 40.4%
- of closed trades
- Profit factor
- 1.60
- gross profit ÷ gross loss
- Max drawdown
- 8.32%
- −$87,404.20
One run with the author's default settings, $1,000,000 starting capital, commission as the script sets it. 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
3 settings do nothing
“Backtest Start Date”, “Backtest End Date”, “ Color Lower Channel” are declared but never read.
-
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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| backtest window | |||
| Backtest Start Date | timestamp("01 Jan 2017 00:00 +0000") | time | unused |
| Backtest End Date | timestamp("01 Jan 2100 00:00 +0000") | time | unused |
| Moving Average Inputs | |||
| Length Fast MA | 8 | int · min 1 | fast |
| Length Slow MA | 32 | int · min 1 | slow |
| Color Fast MA | color.new(color.red, 0) | color | Fast MA |
| Color Slow MA | color.new(color.purple, 0) | color | Slow MA |
| Source Fast MA | close | source | fast |
| Source Slow MA | close | source | slow |
| Donchian Channels Inputs | |||
| Length Upper Channel | 20 | int · min 1 | h1 |
| Length Lower Channel | 20 | int · min 1 | l1 |
| Fill Color | color.new(color.gray, 100) | color | fill |
| Color Upper Channel | color.new(color.white, 0) | color | Upper Lower |
| Color Lower Channel | color.new(color.white, 0) | color | unused |
| ATR Position Size Inputs | |||
| Leverage Used | 1 | int · min 1 | amount |
| Point Value/ATR Multipliers from Entry | 4 | int · min 1 | amount |
| ATR Period | 14 | int · min 1 | atr |
| Risk Per Trade | 0.01 | float | amount |
What it calculates
- SMASource Fast MA (close), Length Fast MA (8)
fast · line 15 - SMASource Slow MA (close), Length Slow MA (32)
slow · line 16 - Highesthigh[1], Length Upper Channel (20)
h1 · line 22 - Lowestlow[1], Length Lower Channel (20)
l1 · line 23 - ATRATR Period (14)
atr · line 35 - Crossoverfast, slow
entrycondition1 · line 38 - Crossunderfast, slow
sellcondition1 · line 40
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 | (close > h1 and entrycondition2) | On | 44 |
| Close long | (sellcondition1 and sellcondition2) | On | 46 |
| Open short short | (close < l1 and sellcondition2) | On | 48 |
| Close short | (entrycondition1 and entrycondition2) | On | 50 |
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 | +10.8% | +102.5% | 57 | 40% | 1.60 | 8.3% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +22.2% | +5.5% | 46 | 28% | 2.49 | 7.8% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +10.7% | +9.8% | 52 | 48% | 1.77 | 5.4% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +16.1% | +8.4% | 41 | 41% | 2.49 | 6.6% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.9% | +16.7% | 62 | 37% | 1.06 | 8.1% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +33.4% | +21.5% | 45 | 44% | 3.85 | 6.9% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +19.3% | +148.3% | 45 | 36% | 2.05 | 12.2% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −15.6% | +17.1% | 60 | 28% | 0.40 | 18.8% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
Settings heatmap
Two settings that feed the entry signal, moved around their defaults. The best in-sample pair (Length Fast MA 14, Length Slow MA 27) made +12.0% before 26 Dec 2025 and +2.8% after it, worse than the defaults' +4.7% after. Tuning on the past did not carry forward. 86% of the 64 combinations made money in-sample and 94% out-of-sample.
| Length Slow MA ↓ · Length Fast MA → | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 14 |
|---|---|---|---|---|---|---|---|---|
| 16 | +5% | +9% | +7% | +8% | +11% | +10% | +8% | +11% |
| 19 | +7% | +6% | +9% | +8% | +6% | +9% | +10% | +11% |
| 22 | +3% | +6% | +5% | +4% | +5% | +3% | +1% | +4% |
| 27 | +3% | +1% | +0% | +3% | +4% | +5% | +6% | +12% |
| 32 | +2% | +2% | +5% | +7% | +6% | +5% | +5% | +7% |
| 38 | +2% | +2% | +1% | +2% | +1% | −0% | −1% | +0% |
| 45 | +1% | +1% | −1% | −1% | +1% | +1% | +1% | −0% |
| 54 | +1% | −1% | −2% | −2% | −0% | +5% | +5% | +6% |
| Length Slow MA ↓ · Length Fast MA → | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 14 |
|---|---|---|---|---|---|---|---|---|
| 16 | +4% | +5% | +6% | +6% | +3% | +3% | +3% | +3% |
| 19 | +5% | +4% | +6% | +5% | +5% | +5% | +5% | +5% |
| 22 | +6% | +5% | +5% | +6% | +5% | +4% | +5% | +4% |
| 27 | +5% | +4% | +5% | +6% | +5% | +4% | +4% | +3% |
| 32 | +5% | +5% | +6% | +6% | +5% | +3% | +3% | +3% |
| 38 | +8% | +8% | +9% | +9% | +5% | +3% | +3% | +5% |
| 45 | +8% | +4% | +3% | +2% | +1% | −1% | −0% | −2% |
| 54 | +2% | +2% | +2% | +2% | +2% | +1% | +1% | −3% |
Net P&L of trades opened in each period, as a share of starting capital. marks the defaults and the best in-sample cell. Hover a cell for its trade count. 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 | 12 | 33% | $22,773.40 |
| Sideways market | 32 | 38% | $69,059.50 |
| Falling market | 13 | 54% | $16,524.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
7.2%
The 95th percentile of the worst drawdown when the same 57 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 3.0% to 7.2%; the tick is what actually happened, 7.3%. Order luck alone moves it this much.
All 57 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 27 Feb 2024 54,476.50 | 8 Apr 2024 69,360.40 | 41 | $23,638.50 |
| long | 28 Feb 2024 57,037.30 | 8 Apr 2024 69,360.40 | 40 | $18,274.50 |
| long | 29 Feb 2024 62,432.10 | 8 Apr 2024 69,360.40 | 39 | $8,297.65 |
| short | 2 May 2024 58,365.00 | 18 May 2024 67,024.00 | 16 | −$6,763.36 |
| long | 18 May 2024 67,024.00 | 16 Jun 2024 66,228.30 | 29 | −$724.30 |
| long | 21 May 2024 71,446.60 | 16 Jun 2024 66,228.30 | 26 | −$4,726.38 |
| short | 24 Jun 2024 63,210.00 | 19 Jul 2024 63,987.90 | 25 | −$1,075.12 |
| short | 25 Jun 2024 60,293.30 | 19 Jul 2024 63,987.90 | 24 | −$4,539.92 |
| short | 5 Jul 2024 57,050.00 | 19 Jul 2024 63,987.90 | 14 | −$8,311.26 |
| long | 20 Jul 2024 66,660.00 | 6 Aug 2024 54,018.80 | 17 | −$12,323.30 |
| long | 22 Jul 2024 68,165.40 | 6 Aug 2024 54,018.80 | 15 | −$14,218.00 |
| short | 6 Aug 2024 54,018.80 | 27 Aug 2024 62,834.00 | 21 | −$6,977.44 |
| short | 7 Sep 2024 53,963.00 | 19 Sep 2024 61,760.00 | 12 | −$7,271.03 |
| long | 19 Sep 2024 61,760.00 | 11 Oct 2024 60,326.40 | 22 | −$1,495.24 |
| long | 20 Sep 2024 62,948.00 | 11 Oct 2024 60,326.40 | 21 | −$2,742.69 |
| long | 27 Sep 2024 65,174.00 | 11 Oct 2024 60,326.40 | 14 | −$5,434.61 |
| long | 16 Oct 2024 67,074.10 | 26 Dec 2024 99,429.60 | 71 | $36,940.30 |
| long | 19 Oct 2024 68,428.00 | 26 Dec 2024 99,429.60 | 68 | $37,444.20 |
| long | 21 Oct 2024 69,032.00 | 26 Dec 2024 99,429.60 | 66 | $39,520.60 |
| long | 18 Jan 2025 104,077.00 | 7 Feb 2025 96,554.40 | 20 | −$4,899.91 |
| short | 25 Feb 2025 91,552.90 | 28 Mar 2025 87,232.00 | 31 | $3,401.49 |
| short | 26 Feb 2025 88,680.40 | 28 Mar 2025 87,232.00 | 30 | $1,061.11 |
| short | 27 Feb 2025 84,250.10 | 28 Mar 2025 87,232.00 | 29 | −$2,025.77 |
| short | 7 Apr 2025 78,430.00 | 18 Apr 2025 84,947.90 | 11 | −$4,618.61 |
| long | 23 Apr 2025 93,443.00 | 6 Jun 2025 101,509.00 | 44 | $5,891.32 |
| long | 2 May 2025 96,489.90 | 6 Jun 2025 101,509.00 | 35 | $4,305.20 |
| long | 9 May 2025 103,262.00 | 6 Jun 2025 101,509.00 | 28 | −$1,489.94 |
| short | 6 Jun 2025 101,509.00 | 12 Jun 2025 108,645.00 | 6 | −$6,184.63 |
| long | 10 Jul 2025 111,234.00 | 5 Aug 2025 115,055.00 | 26 | $3,810.06 |
| long | 11 Jul 2025 116,010.00 | 5 Aug 2025 115,055.00 | 25 | −$857.88 |
| long | 12 Jul 2025 117,528.00 | 5 Aug 2025 115,055.00 | 24 | −$2,172.98 |
| long | 14 Aug 2025 123,306.00 | 22 Aug 2025 112,500.00 | 8 | −$9,585.40 |
| short | 26 Aug 2025 110,112.00 | 15 Sep 2025 115,268.00 | 20 | −$3,972.61 |
| short | 30 Aug 2025 108,377.00 | 15 Sep 2025 115,268.00 | 16 | −$5,207.17 |
| long | 17 Sep 2025 116,789.00 | 28 Sep 2025 109,636.00 | 11 | −$7,377.99 |
| long | 4 Oct 2025 122,232.00 | 16 Oct 2025 110,763.00 | 12 | −$10,652.30 |
| short | 5 Nov 2025 101,497.00 | 15 Dec 2025 88,172.20 | 40 | $8,372.12 |
| short | 15 Nov 2025 94,594.00 | 15 Dec 2025 88,172.20 | 30 | $3,762.95 |
| short | 18 Nov 2025 92,215.10 | 15 Dec 2025 88,172.20 | 27 | $2,440.14 |
| long | 5 Jan 2026 91,529.70 | 26 Jan 2026 86,670.40 | 21 | −$4,992.74 |
| long | 6 Jan 2026 93,859.70 | 26 Jan 2026 86,670.40 | 20 | −$7,208.68 |
| long | 14 Jan 2026 95,414.00 | 26 Jan 2026 86,670.40 | 12 | −$8,622.17 |
| short | 26 Jan 2026 86,670.40 | 7 Mar 2026 68,114.00 | 40 | $19,037.70 |
| short | 30 Jan 2026 84,650.20 | 7 Mar 2026 68,114.00 | 36 | $15,743.00 |
| short | 1 Feb 2026 78,741.10 | 7 Mar 2026 68,114.00 | 34 | $8,529.27 |
| long | 17 Mar 2026 74,884.70 | 29 Mar 2026 66,377.00 | 12 | −$7,086.01 |
| long | 14 Apr 2026 74,418.00 | 21 May 2026 77,552.20 | 37 | $3,016.61 |
| long | 18 Apr 2026 77,072.00 | 21 May 2026 77,552.20 | 33 | $462.41 |
| long | 5 May 2026 79,861.00 | 21 May 2026 77,552.20 | 16 | −$2,648.80 |
| short | 23 May 2026 75,539.50 | 10 Jul 2026 63,230.00 | 48 | $15,382.40 |
| short | 29 May 2026 73,617.50 | 10 Jul 2026 63,230.00 | 42 | $13,060.50 |
| short | 2 Jun 2026 71,408.90 | 10 Jul 2026 63,230.00 | 38 | $10,479.30 |
| long | 15 Jul 2026 65,044.00 | 3 Aug 2026 63,570.00 | 19 | −$1,799.63 |
| long | 22 Jul 2026 66,556.10 | 3 Aug 2026 63,570.00 | 12 | −$4,065.74 |
| long | 21 Aug 2026 73,027.00 | 18 Sep 2026 76,417.00 | 28 | $4,735.65 |
| long | 22 Aug 2026 78,338.00 | 18 Sep 2026 76,417.00 | 27 | −$2,260.80 |
| long | 22 Sep 2026 86,620.00 | 15 Oct 2026 81,682.00 | 23 | −$4,917.81 |
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 |
|---|---|---|---|---|---|
| DC Breakout Strategy - This is simplicity at its finest. this page | — | v5 strategy | +10.8% | 57 | 8.3% |
| Trend Following with Donchian Channels and MACD by Robrecht99 | highest lowest sma atr | v5 strategy | −1.0% | 12 | 2.7% |
| BuyHigh-SellLow Strategy by Trendoscope | sma highest lowest atr | v4 strategy | +12.4% | 4 | 6.7% |
| ATR + STC + MA by Romedius | lowest highest atr sma | v5 strategy | −1.2% | 15 | 3.3% |
| -NoSKi Hammer-Star -w angle of ema Backtester - by noski1 | atr sma highest lowest | v5 strategy | does not run in Zeal Terminal | ||
| AlignedMA and Cumulative HighLow Strategy V2 by Trendoscope | sma atr highest lowest | v4 strategy | −40.8% | 16 | 50.9% |
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.
- 3 settings use the untyped input() (line 11, 12, 34). 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 57 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 11: input() → input.source()
- Line 12: input() → input.source()
- Line 34: input() → input.float()
⋯len2 = input.int(32, minval=1, title="Length Slow MA", group="Moving Average Inputs")-src1 = input(close, title="Source Fast MA")+src1 = input.source(close, title="Source Fast MA")-src2 = input(close, title="Source Slow MA")+src2 = input.source(close, title="Source Slow MA")maFast = input.color(color.new(color.red, 0), title = "Color Fast MA", group = "Moving Average Inputs", inline = "maFast")⋯length = input.int(title = "ATR Period", defval = 14, minval = 1, group ="ATR Position Size Inputs")-risk = input(title = "Risk Per Trade", defval = 0.01, group = "ATR Position Size Inputs")+risk = input.float(title = "Risk Per Trade", defval = 0.01, group = "ATR Position Size Inputs")atr = ta.atr(length)⋯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: 57 before, 57 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.
⋯// © Robrecht99-//@version=5+//@version=6strategy("Simplicity at its finest", overlay=true, margin_long=0, margin_short=0, pyramiding=3)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 18 ms | Yes 1,000 bars in 50 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
“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/// © Robrecht99//@version=5strategy("Simplicity at its finest", overlay=true, margin_long=0, margin_short=0, pyramiding=3)// Backtest Range //Start = input.time(defval = timestamp("01 Jan 2017 00:00 +0000"), title = "Backtest Start Date", group = "backtest window")Finish = input.time(defval = timestamp("01 Jan 2100 00:00 +0000"), title = "Backtest End Date", group = "backtest window")// Moving Averages //len1 = input.int(8, minval=1, title="Length Fast MA", group="Moving Average Inputs")len2 = input.int(32, minval=1, title="Length Slow MA", group="Moving Average Inputs")src1 = input(close, title="Source Fast MA")src2 = input(close, title="Source Slow MA")maFast = input.color(color.new(color.red, 0), title = "Color Fast MA", group = "Moving Average Inputs", inline = "maFast")maSlow = input.color(color.new(color.purple, 0), title = "Color Slow MA", group = "Moving Average Inputs", inline = "maSlow")fast = ta.sma(src1, len1)slow = ta.sma(src2, len2)plot(fast, color=maFast, title="Fast MA")plot(slow, color=maSlow, title="Slow MA")// Donchian Channels //Length1 = input.int(title="Length Upper Channel", defval=20, minval=1, group="Donchian Channels Inputs")Length2 = input.int(title="Length Lower Channel", defval=20, minval=1, group="Donchian Channels Inputs")h1 = ta.highest(high[1], Length1)l1 = ta.lowest(low[1], Length2)fillColor = input.color(color.new(color.gray, 100), title = "Fill Color", group = "Donchian Channels Inputs")upperColor = input.color(color.new(color.white, 0), title = " Color Upper Channel", group = "Donchian Channels Inputs", inline = "upper")lowerColor = input.color(color.new(color.white, 0), title = " Color Lower Channel", group = "Donchian Channels Inputs", inline = "lower")u = plot(h1, "Upper", color=upperColor)l = plot(l1, "Lower", color=upperColor)fill(u, l, color=fillColor)// ATR and Position Size //leverage = input.int(title = "Leverage Used", defval = 1, minval = 1, group = "ATR Position Size Inputs")pointvalue = input.int(title = "Point Value/ATR Multipliers from Entry", defval = 4, minval = 1, group = "ATR Position Size Inputs")length = input.int(title = "ATR Period", defval = 14, minval = 1, group ="ATR Position Size Inputs")risk = input(title = "Risk Per Trade", defval = 0.01, group = "ATR Position Size Inputs")atr = ta.atr(length)amount = (risk * strategy.initial_capital / (pointvalue * atr * leverage))// Buy and Sell Conditions //entrycondition1 = ta.crossover(fast, slow)entrycondition2 = fast > slowsellcondition1 = ta.crossunder(fast, slow)sellcondition2 = slow > fast// Buy and Sell Signals //if (close > h1 and entrycondition2) strategy.entry("long", strategy.long, qty=amount)if (sellcondition1 and sellcondition2) strategy.close(id="long")if (close < l1 and sellcondition2) strategy.entry("short", strategy.short, qty=amount)if (entrycondition1 and entrycondition2) strategy.close(id="short")