Pine Script v5 · Strategy
8 Day Run - Momentum Strategy
A Pine Script v5 strategy built on SMA (close, 5). 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 0.0004 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 8 Day Run - Momentum Strategy repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 5 of 5 trades.
- How did 8 Day Run - Momentum Strategy do on BTCUSDT 1D with default settings?
- +31.44%
- From 26 Jan 2024 to 21 Oct 2026, over 24 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does 8 Day Run - Momentum Strategy run in Pine Script v6?
- No
- The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L17:C38: 'bgcolor' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download.
- Does 8 Day Run - Momentum Strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does 8 Day Run - Momentum Strategy run in Zeal Terminal?
- Yes
- It compiles in 15 ms and runs 1,000 bars in 17 ms, in the browser.
BTCUSDT · 1D · default settings
- SMA
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +31.44%
- $15,719.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 24
- 17 won · 7 lost
- Profitable
- 70.8%
- of closed trades
- Profit factor
- 1.92
- gross profit ÷ gross loss
- Max drawdown
- 20.98%
- −$14,036.10
One run with the author's default settings, $50,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
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
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 12, 13, 20, 21. 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.
The script declares no settings.
What it calculates
- SMAclose, 5
SMA · line 6
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 | BuyTriggerBuy[1] and TrendDown | On | 12 |
| Close EL | close > SMA | On | 13 |
| Open ES short | SellTriggerSell[1] and TrendUp | On | 20 |
| Close ES | close < SMA | On | 21 |
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 | +31.4% | +102.5% | 24 | 71% | 1.92 | 21.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +1.7% | +5.5% | 24 | 71% | 1.12 | 13.4% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −0.7% | +9.8% | 23 | 61% | 0.77 | 2.9% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.0% | +8.4% | 22 | 64% | 0.98 | 0.6% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.1% | +16.7% | 32 | 59% | 1.35 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.0% | +21.5% | 28 | 57% | 0.34 | 0.1% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.4% | +148.3% | 26 | 58% | 1.99 | 0.3% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.1% | +17.1% | 29 | 59% | 0.74 | 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 | 5 | 60% | $1,664.45 |
| Sideways market | 15 | 80% | $10,368.30 |
| Falling market | 4 | 50% | $3,686.29 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
20.4%
The 95th percentile of the worst drawdown when the same 24 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 13.7% to 20.4%; the tick is what actually happened, 13.8%. Order luck alone moves it this much.
All 24 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 20 Feb 2024 51,774.70 | 21 Feb 2024 52,258.80 | 1 | $483.66 |
| long | 6 Mar 2024 63,724.00 | 7 Mar 2024 66,074.00 | 1 | $2,349.51 |
| long | 15 Mar 2024 71,388.90 | 21 Mar 2024 67,840.50 | 6 | −$3,548.99 |
| short | 20 Apr 2024 63,818.00 | 25 Apr 2024 64,289.60 | 5 | −$472.08 |
| short | 18 Jun 2024 66,504.30 | 19 Jun 2024 65,175.30 | 1 | $1,328.48 |
| short | 28 Jun 2024 61,706.50 | 29 Jun 2024 60,427.80 | 1 | $1,278.13 |
| long | 24 Jul 2024 65,936.00 | 27 Jul 2024 67,908.00 | 3 | $1,971.46 |
| short | 9 Aug 2024 61,686.00 | 12 Aug 2024 58,712.60 | 3 | $2,972.93 |
| long | 26 Sep 2024 63,152.00 | 27 Sep 2024 65,174.00 | 1 | $2,021.47 |
| long | 22 Oct 2024 67,377.50 | 25 Oct 2024 68,198.30 | 3 | $820.23 |
| long | 26 Nov 2024 93,010.00 | 28 Nov 2024 95,863.10 | 2 | $2,852.34 |
| short | 11 Feb 2025 97,430.80 | 12 Feb 2025 95,778.20 | 1 | $1,651.84 |
| short | 2 Mar 2025 86,064.50 | 4 Mar 2025 86,221.20 | 2 | −$157.31 |
| long | 28 Apr 2025 93,749.30 | 29 Apr 2025 95,011.20 | 1 | $1,261.13 |
| long | 15 Aug 2025 118,295.00 | 23 Aug 2025 116,936.00 | 8 | −$1,360.03 |
| short | 23 Aug 2025 116,936.00 | 25 Aug 2025 113,494.00 | 2 | $3,441.49 |
| short | 29 Sep 2025 112,164.00 | 8 Oct 2025 121,333.00 | 9 | −$9,169.93 |
| long | 8 Oct 2025 121,333.00 | 9 Oct 2025 123,306.00 | 1 | $1,972.07 |
| short | 25 Nov 2025 88,300.00 | 1 Dec 2025 90,360.00 | 6 | −$2,060.71 |
| short | 28 Jan 2026 89,250.00 | 30 Jan 2026 84,650.20 | 2 | $4,599.13 |
| short | 9 Feb 2026 70,330.40 | 11 Feb 2026 68,841.30 | 2 | $1,488.54 |
| long | 19 Mar 2026 71,246.60 | 24 Mar 2026 70,906.40 | 5 | −$340.67 |
| short | 8 Jun 2026 63,332.00 | 10 Jun 2026 61,730.00 | 2 | $1,601.51 |
| long | 29 Aug 2026 77,845.90 | 1 Sep 2026 78,581.30 | 3 | $734.79 |
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 |
|---|---|---|---|---|---|
| 8 Day Run - Momentum Strategy this page | — | v5 strategy | +31.4% | 24 | 21.0% |
| Follow the Crypto Shorts by xtradernet | sma | v4 strategy | No trades on this market | ||
| buy down and sell high trend 200 sma and ma cross by willi130503 | sma | v4 strategy | No trades on this market | ||
| Mayer Multiple Strategy by xtradernet | sma | v4 strategy | No trades on this market | ||
| Moving Average Cross Strategy early Closing by Geduldtrader | sma | v4 strategy | +73.8% | 20 | 151.5% |
| MFI Simple Strategy by OztheWoz | sma | v5 strategy | −0.2% | 28 | 3.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 12, 13, 20, 21). 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.
Same 24 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 12: when = Buy → if block
- Line 13: when = close > SMA → if block
- Line 20: when = Sell → if block
- Line 21: when = close < SMA → if block
⋯Buy = TriggerBuy[1] and TrendDown -strategy.entry("EL", strategy.long, when = Buy)+if Buy+ strategy.entry("EL", strategy.long)-strategy.close(id = "EL", when = close > SMA)+if close > SMA+ strategy.close(id = "EL")// 1) color background when "run" begins and 2) change color when buy signal occurs⋯Sell = TriggerSell[1] and TrendUp-strategy.entry("ES", strategy.short, when = Sell)+if Sell+ strategy.entry("ES", strategy.short)-strategy.close(id = "ES", when = close < SMA)+if close < SMA+ strategy.close(id = "ES")// 1) color background when "run" begins and 2) change color when sell signal occurs⋯Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L17:C38: 'bgcolor' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © Marcuscor-//@version=5+//@version=6// Inpsired by Linda Bradford Raschke: a strategy for trading momentum in futures markets⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 15 ms | Yes 1,000 bars in 17 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/// © Marcuscor//@version=5// Inpsired by Linda Bradford Raschke: a strategy for trading momentum in futures marketsstrategy("8D Run", initial_capital = 50000, commission_value = 0.0004) SMA = ta.sma(close,5)TrendUp = close >= SMATrendDown = close <= SMA//logic to longTriggerBuy = ta.barssince(close < SMA) >= 8Buy = TriggerBuy[1] and TrendDown strategy.entry("EL", strategy.long, when = Buy)strategy.close(id = "EL", when = close > SMA)// 1) color background when "run" begins and 2) change color when buy signal occursbgcolor(TriggerBuy? color.green : na, transp = 90)bgcolor(Buy ? color.green : na, transp = 70)// logic to short TriggerSell = ta.barssince(close > SMA) >= 8Sell = TriggerSell[1] and TrendUpstrategy.entry("ES", strategy.short, when = Sell)strategy.close(id = "ES", when = close < SMA)// 1) color background when "run" begins and 2) change color when sell signal occursbgcolor(TriggerSell ? color.red : na, transp = 90)bgcolor(Sell ? color.red : na, transp = 70)