Pine Script v5 · Strategy
Open Drive
A Pine Script v5 strategy built on Highest (5), Lowest (5) and SMA (close, 3). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a profit target and no stop loss. Each trade is one contract and pays 3.8 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 Open Drive repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Open Drive do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its code limits trading to a session window, which can leave these candles out. On BTCUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
- Does Open Drive run in Pine Script v6?
- No
- The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L90:C3: 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 Open Drive use a stop loss?
- No
- Its exits set a profit target but no stop.
- Does Open Drive run in Zeal Terminal?
- Yes
- It compiles in 32 ms and runs 1,000 bars in 48 ms, in the browser.
BTCUSDT · 1D · default settings
- OD_up
- OD_down
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
One run with the author's default settings, $40,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
No stop loss
strategy.exit is used without a stop, loss or trailing stop.
-
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
- Highest5
fbhi · line 19 - Lowest5
fblo · line 20 - SMAclose, 3
ma · line 71
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 el long | OD_Up | On | 103 |
| Exit ex limit | ta.barssince(OD_Up)> 3 | On | 105 |
| Open es short | OD_Down | On | 108 |
| Exit ex limit | ta.barssince(OD_Down)> 3 | On | 110 |
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.
- 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.0% | +102.5% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −13.1% | +5.5% | 6 | 33% | 0.14 | 16.7% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.4% | +8.4% | 5 | 20% | 0.36 | 0.5% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.1% | +21.5% | 3 | 0% | 0.00 | 0.1% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.4% | +17.1% | 4 | 0% | 0.00 | 0.4% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
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 |
|---|---|---|---|---|---|
| Open Drive this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| ChBrkOutStrategySMA by anshuanshu333 | sma highest lowest | v4 strategy | −4.5% | 42 | 20.9% |
| KDJ Strategy @ionvolution by ionvolution | sma highest lowest | v5 strategy | No trades on this market | ||
| Trading range display with Box by potatoshop | sma highest lowest | v5 strategy | +0.7% | 27 | 3.9% |
| Trend Bounce [racer8] by racer8 | highest lowest sma | v4 strategy | +2.4% | 22 | 32.2% |
| Lawyers Trend Pro Strategy by ErdemDemir | sma lowest highest | v4 strategy | +12.1% | 102 | 41.7% |
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 @L90:C3: 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.
⋯// © Marcns_-//@version=5+//@version=6// a script that highlights open drives around cash market opens throughout the day⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 32 ms | With a workaround 1,000 bars in 48 ms | Not measured |
| PineTS | Not tested | Not tested | Not 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/// © Marcns_//@version=5// a script that highlights open drives around cash market opens throughout the day// this indicator identifies the following cash open, open drives 0700 - 0715 / 0800 - 0815 / 1300 - 1315 / 1430 - 1445 // an open drive is when a cash market opens and price runs either up or down away from the opening price, often this will be the high or the low the remainer of the session or day// and often identify a trend sessionstrategy("Open Drive", commission_type = strategy.commission.cash_per_contract, commission_value = 3.8, initial_capital = 40000 )// open drive filter times - all times GMTeu_sev = time(timeframe.period, "0700-0715", "GB")eu_eig = time(timeframe.period, "0800-0815", "GB")us_one = time(timeframe.period, "1300-1315", "GB")us_two = time(timeframe.period, "1430-1445", "GB")// identify bar that opens at low and closes at high + vice versa // bar needs to open at one extreme and close at another TrndExThreshold_Open = 0.15TrndExThreshold_Close = 0.15// add a bar range expansion filter - range of bar correlates to volume, high volume = wider range. This script will be able to filter for a break of a 5 bar range +100% or -100%fbhi = ta.highest(5)fblo = ta.lowest(5)fbr = (fbhi - fblo)RangeEx_up = 0.0if high >= (fbhi[1] + fbr[1]) RangeEx_up := 1.0else na// range ex downRangeEx_do = 0.0if low <= (fblo[1] - fbr[1]) RangeEx_do := 1.0else na//#1 open within 5% of lowOpenAtLow = 0.0 if (close > open) and (open-low) / (high-low) < TrndExThreshold_Open OpenAtLow := 1.0else na //#2 close within 5% of high CloseAtHigh = 0.0if (close > open) and (high-close) / (high-low) < TrndExThreshold_Close CloseAtHigh := 1.0else na OD_Up = 0.0if (OpenAtLow + CloseAtHigh + RangeEx_up == 3.0) and ( eu_sev or eu_eig or us_one or us_two) OD_Up := 1else naplot(OD_Up, title = "OD_up")OpenAtHigh = 0.0 if (close < open) and (high-open) / (high-low) < TrndExThreshold_Open OpenAtHigh := 1.0else na //#2 close within 5% of high CloseAtLow = 0.0if (close < open) and (close-low) / (high-low) < TrndExThreshold_Close CloseAtLow := 1.0else na OD_Down = 0.0if (OpenAtHigh + CloseAtLow + RangeEx_do == 3.0) and ( eu_sev or eu_eig or us_one or us_two) OD_Down := -1else naplot(OD_Down, title = "OD_down", color = color.red)//3smama = ta.sma(close,3)// one time framing - highlight bars the make a series of lower highs or higher lows to identify trend // one time frame up otf_u = 0.0if close > ma and close[1] > ma[1] otf_u := 1else na// one time frame down otf_d = 0.0if close < ma and close[1] < ma[1] otf_d := 1else na//bgcolor(otf_u ? color.rgb(76, 175, 79, 70) : na)//bgcolor(otf_d ? color.rgb(255, 82, 82, 66) : na)// record high and low of entry bar into variable for absolute stop// buy stopbs = 0.0if OD_Up bs := low[1]else na// sell stopss = 0.0if OD_Down ss := high[1]else na// strategy entry and exits // longif OD_Up strategy.entry("el", strategy.long, 2)if ta.barssince(OD_Up)> 3 strategy.exit(id = "ex" , from_entry = "el", limit = close)// short if OD_Down strategy.entry("es", strategy.short, 2)if ta.barssince(OD_Down)> 3 strategy.exit(id = "ex" , from_entry = "es", limit = close)