Pine Script v4 · Strategy
Buy-and-hold strategy stats
A Pine Script v4 strategy with no technical-analysis calculation. It has 2 order rules, 1 entry 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. 3 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 Buy-and-hold strategy stats repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 299 of 299 trades.
- How did Buy-and-hold strategy stats do on BTCUSDT 1D with default settings?
- +102.53%
- From 26 Jan 2024 to 21 Oct 2026, over 999 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Buy-and-hold strategy stats be converted to Pine Script v5?
- Yes
- The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
- Does Buy-and-hold strategy stats use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Buy-and-hold strategy stats run in Zeal Terminal?
- Yes
- It compiles in 5 ms and runs 1,000 bars in 20 ms, in the browser.
BTCUSDT · 1D · default settings
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +102.53%
- $10,252.70
- Buy and hold
- +102.5%
- same period
- Closed trades
- 999
- 507 won · 492 lost
- Profitable
- 50.8%
- of closed trades
- Profit factor
- 1.06
- gross profit ÷ gross loss
- Max drawdown
- 53.63%
- −$15,985.80
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.
-
Check
Every trade uses all the equity
default_qty_value is 100% of equity.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
Upgrade and export
Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.
Same 999 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 5: input(type = input.time) → input.time()
- Line 6: input(type = input.time) → input.time()
- Line 7: input(type = input.bool) → input.bool()
⋯// © TradersForecast-//@version=4+//@version=5strategy("Buy-and-hold strategy stats", overlay=true, pyramiding=1, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, process_orders_on_close=true)-minDate = input(timestamp("01 Jan 2010 0:0 -0500"), title = "Start Date/Time", type = input.time)+minDate = input.time(timestamp("01 Jan 2010 0:0 -0500"), title = "Start Date/Time")-maxDate = input(timestamp("01 Jan 2030 0:0 -0500"), title = "End Date/Time", type = input.time)+maxDate = input.time(timestamp("01 Jan 2030 0:0 -0500"), title = "End Date/Time")-revTrd = input(false, title="Short position? (else it defaults to LONG)", type=input.bool)+revTrd = input.bool(false, title="Short position? (else it defaults to LONG)")strategy.close_all()⋯Clean v5
VerifiedNothing to change.
Does it run in Pine Script v6?
Yes
Same 999 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.
⋯// © TradersForecast-//@version=5+//@version=6strategy("Buy-and-hold strategy stats", overlay=true, pyramiding=1, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, process_orders_on_close=true)⋯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 |
|---|---|---|---|
| Start Date/Time | timestamp("01 Jan 2010 0:0 -0500") | time | entry My Long Entry Id line 9 |
| End Date/Time | timestamp("01 Jan 2030 0:0 -0500") | time | entry My Long Entry Id line 9 |
| Short position? (else it defaults to LONG) | false | bool | entry My Long Entry Id |
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 |
|---|---|---|---|
| Close | every bar | On | 8 |
| Open My Long Entry Id revTrd ? strategy.short : strategy.long | time >= minDate and time <= maxDate | On | 10 |
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 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | +102.5% | +102.5% | 999 | 51% | 1.06 | 53.6% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +5.5% | +5.5% | 999 | 51% | 1.02 | 29.7% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +9.8% | +9.8% | 999 | 51% | 1.01 | 68.8% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +8.4% | +8.4% | 999 | 51% | 1.03 | 36.5% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +16.7% | +16.7% | 999 | 50% | 1.01 | 77.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +21.5% | +21.5% | 999 | 48% | 1.05 | 38.8% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +148.3% | +148.3% | 999 | 53% | 1.07 | 58.9% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +17.1% | +17.1% | 999 | 52% | 1.06 | 27.4% | 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 | 344 | 52% | $11,241.20 |
| Sideways market | 431 | 49% | −$3,774.99 |
| Falling market | 224 | 52% | $2,786.48 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
62.2%
The 95th percentile of the worst drawdown when the same 999 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 33.8% to 62.2%; the tick is what actually happened, 53.0%. Order luck alone moves it this much.
The first 150 of 999 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 26 Jan 2024 41,823.50 | 27 Jan 2024 42,120.60 | 1 | $71.04 |
| long | 27 Jan 2024 42,120.60 | 28 Jan 2024 42,031.10 | 1 | −$21.42 |
| long | 28 Jan 2024 42,031.10 | 29 Jan 2024 43,302.70 | 1 | $304.05 |
| long | 29 Jan 2024 43,302.70 | 30 Jan 2024 42,941.10 | 1 | −$86.46 |
| long | 30 Jan 2024 42,941.10 | 31 Jan 2024 42,580.00 | 1 | −$86.34 |
| long | 31 Jan 2024 42,580.00 | 1 Feb 2024 43,082.90 | 1 | $120.25 |
| long | 1 Feb 2024 43,082.90 | 2 Feb 2024 43,200.00 | 1 | $27.99 |
| long | 2 Feb 2024 43,200.00 | 3 Feb 2024 43,011.10 | 1 | −$45.17 |
| long | 3 Feb 2024 43,011.10 | 4 Feb 2024 42,582.90 | 1 | −$102.39 |
| long | 4 Feb 2024 42,582.90 | 5 Feb 2024 42,708.70 | 1 | $30.08 |
| long | 5 Feb 2024 42,708.70 | 6 Feb 2024 43,098.90 | 1 | $93.31 |
| long | 6 Feb 2024 43,098.90 | 7 Feb 2024 44,349.60 | 1 | $299.03 |
| long | 7 Feb 2024 44,349.60 | 8 Feb 2024 45,288.70 | 1 | $224.53 |
| long | 8 Feb 2024 45,288.70 | 9 Feb 2024 47,132.80 | 1 | $440.93 |
| long | 9 Feb 2024 47,132.80 | 10 Feb 2024 47,751.10 | 1 | $147.84 |
| long | 10 Feb 2024 47,751.10 | 11 Feb 2024 48,300.00 | 1 | $131.24 |
| long | 11 Feb 2024 48,300.00 | 12 Feb 2024 49,917.30 | 1 | $386.69 |
| long | 12 Feb 2024 49,917.30 | 13 Feb 2024 49,699.60 | 1 | −$52.05 |
| long | 13 Feb 2024 49,699.60 | 14 Feb 2024 51,795.20 | 1 | $501.05 |
| long | 14 Feb 2024 51,795.20 | 15 Feb 2024 51,880.00 | 1 | $20.28 |
| long | 15 Feb 2024 51,880.00 | 16 Feb 2024 52,124.10 | 1 | $58.37 |
| long | 16 Feb 2024 52,124.10 | 17 Feb 2024 51,642.60 | 1 | −$115.12 |
| long | 17 Feb 2024 51,642.60 | 18 Feb 2024 52,137.70 | 1 | $118.36 |
| long | 18 Feb 2024 52,137.70 | 19 Feb 2024 51,774.70 | 1 | −$86.78 |
| long | 19 Feb 2024 51,774.70 | 20 Feb 2024 52,258.80 | 1 | $115.75 |
| long | 20 Feb 2024 52,258.80 | 21 Feb 2024 51,849.40 | 1 | −$97.89 |
| long | 21 Feb 2024 51,849.40 | 22 Feb 2024 51,288.40 | 1 | −$134.13 |
| long | 22 Feb 2024 51,288.40 | 23 Feb 2024 50,744.20 | 1 | −$130.13 |
| long | 23 Feb 2024 50,744.20 | 24 Feb 2024 51,568.20 | 1 | $197.03 |
| long | 24 Feb 2024 51,568.20 | 25 Feb 2024 51,728.80 | 1 | $38.41 |
| long | 25 Feb 2024 51,728.80 | 26 Feb 2024 54,476.50 | 1 | $656.96 |
| long | 26 Feb 2024 54,476.50 | 27 Feb 2024 57,037.30 | 1 | $612.30 |
| long | 27 Feb 2024 57,037.30 | 28 Feb 2024 62,432.10 | 1 | $1,289.89 |
| long | 28 Feb 2024 62,432.10 | 29 Feb 2024 61,131.00 | 1 | −$311.10 |
| long | 29 Feb 2024 61,131.00 | 1 Mar 2024 62,387.90 | 1 | $300.53 |
| long | 1 Mar 2024 62,387.90 | 2 Mar 2024 61,987.30 | 1 | −$95.79 |
| long | 2 Mar 2024 61,987.30 | 3 Mar 2024 63,114.00 | 1 | $269.39 |
| long | 3 Mar 2024 63,114.00 | 4 Mar 2024 68,245.70 | 1 | $1,227.00 |
| long | 4 Mar 2024 68,245.70 | 5 Mar 2024 63,724.00 | 1 | −$1,081.14 |
| long | 5 Mar 2024 63,724.00 | 6 Mar 2024 66,074.00 | 1 | $561.89 |
| long | 6 Mar 2024 66,074.00 | 7 Mar 2024 66,823.20 | 1 | $179.12 |
| long | 7 Mar 2024 66,823.20 | 8 Mar 2024 68,124.20 | 1 | $311.07 |
| long | 8 Mar 2024 68,124.20 | 9 Mar 2024 68,313.30 | 1 | $45.21 |
| long | 9 Mar 2024 68,313.30 | 10 Mar 2024 68,955.90 | 1 | $153.65 |
| long | 10 Mar 2024 68,955.90 | 11 Mar 2024 72,078.10 | 1 | $746.52 |
| long | 11 Mar 2024 72,078.10 | 12 Mar 2024 71,452.00 | 1 | −$149.70 |
| long | 12 Mar 2024 71,452.00 | 13 Mar 2024 73,072.40 | 1 | $387.44 |
| long | 13 Mar 2024 73,072.40 | 14 Mar 2024 71,388.90 | 1 | −$402.52 |
| long | 14 Mar 2024 71,388.90 | 15 Mar 2024 69,499.90 | 1 | −$451.68 |
| long | 15 Mar 2024 69,499.90 | 16 Mar 2024 65,300.60 | 1 | −$1,004.03 |
| long | 16 Mar 2024 65,300.60 | 17 Mar 2024 68,393.50 | 1 | $739.50 |
| long | 17 Mar 2024 68,393.50 | 18 Mar 2024 67,610.00 | 1 | −$187.33 |
| long | 18 Mar 2024 67,610.00 | 19 Mar 2024 61,937.40 | 1 | −$1,356.32 |
| long | 19 Mar 2024 61,937.40 | 20 Mar 2024 67,840.50 | 1 | $1,411.43 |
| long | 20 Mar 2024 67,840.50 | 21 Mar 2024 65,501.30 | 1 | −$559.31 |
| long | 21 Mar 2024 65,501.30 | 22 Mar 2024 63,796.60 | 1 | −$407.58 |
| long | 22 Mar 2024 63,796.60 | 23 Mar 2024 63,990.00 | 1 | $46.23 |
| long | 23 Mar 2024 63,990.00 | 24 Mar 2024 67,210.00 | 1 | $769.90 |
| long | 24 Mar 2024 67,210.00 | 25 Mar 2024 69,880.00 | 1 | $638.40 |
| long | 25 Mar 2024 69,880.00 | 26 Mar 2024 69,988.00 | 1 | $25.82 |
| long | 26 Mar 2024 69,988.00 | 27 Mar 2024 69,470.00 | 1 | −$123.86 |
| long | 27 Mar 2024 69,470.00 | 28 Mar 2024 70,780.60 | 1 | $313.37 |
| long | 28 Mar 2024 70,780.60 | 29 Mar 2024 69,850.50 | 1 | −$222.38 |
| long | 29 Mar 2024 69,850.50 | 30 Mar 2024 69,582.20 | 1 | −$64.16 |
| long | 30 Mar 2024 69,582.20 | 31 Mar 2024 71,280.00 | 1 | $405.95 |
| long | 31 Mar 2024 71,280.00 | 1 Apr 2024 69,649.80 | 1 | −$389.78 |
| long | 1 Apr 2024 69,649.80 | 2 Apr 2024 65,464.00 | 1 | −$1,000.83 |
| long | 2 Apr 2024 65,464.00 | 3 Apr 2024 65,963.30 | 1 | $119.38 |
| long | 3 Apr 2024 65,963.30 | 4 Apr 2024 68,487.80 | 1 | $603.61 |
| long | 4 Apr 2024 68,487.80 | 5 Apr 2024 67,820.60 | 1 | −$159.52 |
| long | 5 Apr 2024 67,820.60 | 6 Apr 2024 68,896.00 | 1 | $257.12 |
| long | 6 Apr 2024 68,896.00 | 7 Apr 2024 69,360.40 | 1 | $111.04 |
| long | 7 Apr 2024 69,360.40 | 8 Apr 2024 71,620.00 | 1 | $540.27 |
| long | 8 Apr 2024 71,620.00 | 9 Apr 2024 69,146.00 | 1 | −$591.53 |
| long | 9 Apr 2024 69,146.00 | 10 Apr 2024 70,631.10 | 1 | $355.08 |
| long | 10 Apr 2024 70,631.10 | 11 Apr 2024 70,006.20 | 1 | −$149.40 |
| long | 11 Apr 2024 70,006.20 | 12 Apr 2024 67,116.50 | 1 | −$690.93 |
| long | 12 Apr 2024 67,116.50 | 13 Apr 2024 63,924.50 | 1 | −$763.21 |
| long | 13 Apr 2024 63,924.50 | 14 Apr 2024 65,661.80 | 1 | $415.40 |
| long | 14 Apr 2024 65,661.80 | 15 Apr 2024 63,420.00 | 1 | −$536.03 |
| long | 15 Apr 2024 63,420.00 | 16 Apr 2024 63,793.40 | 1 | $89.28 |
| long | 16 Apr 2024 63,793.40 | 17 Apr 2024 61,277.40 | 1 | −$601.58 |
| long | 17 Apr 2024 61,277.40 | 18 Apr 2024 63,470.10 | 1 | $524.28 |
| long | 18 Apr 2024 63,470.10 | 19 Apr 2024 63,818.00 | 1 | $83.19 |
| long | 19 Apr 2024 63,818.00 | 20 Apr 2024 64,940.60 | 1 | $268.41 |
| long | 20 Apr 2024 64,940.60 | 21 Apr 2024 64,941.20 | 1 | $0.13 |
| long | 21 Apr 2024 64,941.20 | 22 Apr 2024 66,819.30 | 1 | $449.07 |
| long | 22 Apr 2024 66,819.30 | 23 Apr 2024 66,414.00 | 1 | −$96.91 |
| long | 23 Apr 2024 66,414.00 | 24 Apr 2024 64,289.60 | 1 | −$507.95 |
| long | 24 Apr 2024 64,289.60 | 25 Apr 2024 64,498.30 | 1 | $49.91 |
| long | 25 Apr 2024 64,498.30 | 26 Apr 2024 63,770.00 | 1 | −$174.14 |
| long | 26 Apr 2024 63,770.00 | 27 Apr 2024 63,462.00 | 1 | −$73.65 |
| long | 27 Apr 2024 63,462.00 | 28 Apr 2024 63,118.60 | 1 | −$82.10 |
| long | 28 Apr 2024 63,118.60 | 29 Apr 2024 63,866.00 | 1 | $178.70 |
| long | 29 Apr 2024 63,866.00 | 30 Apr 2024 60,672.00 | 1 | −$763.68 |
| long | 30 Apr 2024 60,672.00 | 1 May 2024 58,365.00 | 1 | −$551.61 |
| long | 1 May 2024 58,365.00 | 2 May 2024 59,060.60 | 1 | $166.33 |
| long | 2 May 2024 59,060.60 | 3 May 2024 62,882.00 | 1 | $913.70 |
| long | 3 May 2024 62,882.00 | 4 May 2024 63,892.00 | 1 | $241.50 |
| long | 4 May 2024 63,892.00 | 5 May 2024 64,012.00 | 1 | $28.68 |
| long | 5 May 2024 64,012.00 | 6 May 2024 63,165.20 | 1 | −$202.47 |
| long | 6 May 2024 63,165.20 | 7 May 2024 62,312.10 | 1 | −$203.98 |
| long | 7 May 2024 62,312.10 | 8 May 2024 61,193.00 | 1 | −$267.56 |
| long | 8 May 2024 61,193.00 | 9 May 2024 63,074.00 | 1 | $449.74 |
| long | 9 May 2024 63,074.00 | 10 May 2024 60,800.00 | 1 | −$543.72 |
| long | 10 May 2024 60,800.00 | 11 May 2024 60,826.00 | 1 | $6.22 |
| long | 11 May 2024 60,826.00 | 12 May 2024 61,484.00 | 1 | $157.33 |
| long | 12 May 2024 61,484.00 | 13 May 2024 62,940.10 | 1 | $348.15 |
| long | 13 May 2024 62,940.10 | 14 May 2024 61,577.50 | 1 | −$325.80 |
| long | 14 May 2024 61,577.50 | 15 May 2024 66,206.50 | 1 | $1,106.80 |
| long | 15 May 2024 66,206.50 | 16 May 2024 65,235.20 | 1 | −$232.24 |
| long | 16 May 2024 65,235.20 | 17 May 2024 67,024.00 | 1 | $427.70 |
| long | 17 May 2024 67,024.00 | 18 May 2024 66,915.20 | 1 | −$26.01 |
| long | 18 May 2024 66,915.20 | 19 May 2024 66,274.00 | 1 | −$153.31 |
| long | 19 May 2024 66,274.00 | 20 May 2024 71,446.60 | 1 | $1,236.77 |
| long | 20 May 2024 71,446.60 | 21 May 2024 70,148.30 | 1 | −$310.42 |
| long | 21 May 2024 70,148.30 | 22 May 2024 69,166.60 | 1 | −$234.73 |
| long | 22 May 2024 69,166.60 | 23 May 2024 67,969.60 | 1 | −$286.19 |
| long | 23 May 2024 67,969.60 | 24 May 2024 68,550.00 | 1 | $138.76 |
| long | 24 May 2024 68,550.00 | 25 May 2024 69,290.60 | 1 | $177.07 |
| long | 25 May 2024 69,290.60 | 26 May 2024 68,507.70 | 1 | −$187.19 |
| long | 26 May 2024 68,507.70 | 27 May 2024 69,436.40 | 1 | $222.07 |
| long | 27 May 2024 69,436.40 | 28 May 2024 68,398.40 | 1 | −$248.19 |
| long | 28 May 2024 68,398.40 | 29 May 2024 67,652.40 | 1 | −$178.36 |
| long | 29 May 2024 67,652.40 | 30 May 2024 68,352.20 | 1 | $167.31 |
| long | 30 May 2024 68,352.20 | 31 May 2024 67,540.00 | 1 | −$194.19 |
| long | 31 May 2024 67,540.00 | 1 Jun 2024 67,766.90 | 1 | $54.24 |
| long | 1 Jun 2024 67,766.90 | 2 Jun 2024 67,765.60 | 1 | −$0.29 |
| long | 2 Jun 2024 67,765.60 | 3 Jun 2024 68,809.90 | 1 | $249.69 |
| long | 3 Jun 2024 68,809.90 | 4 Jun 2024 70,537.80 | 1 | $413.15 |
| long | 4 Jun 2024 70,537.80 | 5 Jun 2024 71,108.00 | 1 | $136.32 |
| long | 5 Jun 2024 71,108.00 | 6 Jun 2024 70,799.10 | 1 | −$73.87 |
| long | 6 Jun 2024 70,799.10 | 7 Jun 2024 69,355.60 | 1 | −$345.13 |
| long | 7 Jun 2024 69,355.60 | 8 Jun 2024 69,310.50 | 1 | −$10.79 |
| long | 8 Jun 2024 69,310.50 | 9 Jun 2024 69,648.10 | 1 | $80.74 |
| long | 9 Jun 2024 69,648.10 | 10 Jun 2024 69,540.00 | 1 | −$25.86 |
| long | 10 Jun 2024 69,540.00 | 11 Jun 2024 67,314.20 | 1 | −$532.18 |
| long | 11 Jun 2024 67,314.20 | 12 Jun 2024 68,264.00 | 1 | $227.09 |
| long | 12 Jun 2024 68,264.00 | 13 Jun 2024 66,773.00 | 1 | −$356.49 |
| long | 13 Jun 2024 66,773.00 | 14 Jun 2024 66,044.00 | 1 | −$174.31 |
| long | 14 Jun 2024 66,044.00 | 15 Jun 2024 66,228.30 | 1 | $44.06 |
| long | 15 Jun 2024 66,228.30 | 16 Jun 2024 66,676.90 | 1 | $107.27 |
| long | 16 Jun 2024 66,676.90 | 17 Jun 2024 66,504.30 | 1 | −$41.25 |
| long | 17 Jun 2024 66,504.30 | 18 Jun 2024 65,175.30 | 1 | −$317.77 |
| long | 18 Jun 2024 65,175.30 | 19 Jun 2024 64,974.40 | 1 | −$48.05 |
| long | 19 Jun 2024 64,974.40 | 20 Jun 2024 64,870.00 | 1 | −$24.96 |
| long | 20 Jun 2024 64,870.00 | 21 Jun 2024 64,143.60 | 1 | −$173.69 |
| long | 21 Jun 2024 64,143.60 | 22 Jun 2024 64,262.00 | 1 | $28.32 |
| long | 22 Jun 2024 64,262.00 | 23 Jun 2024 63,210.00 | 1 | −$251.53 |
| long | 23 Jun 2024 63,210.00 | 24 Jun 2024 60,293.30 | 1 | −$697.38 |
Similar scripts
No other indicator or strategy here shares enough of its calculations.
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 5 ms | Yes 1,000 bars in 20 ms | Not measured |
| PineTS | No v5 and v6 only | — | 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. PineTS runs Pine Script v5 and v6 only.
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/// © TradersForecast//@version=4strategy("Buy-and-hold strategy stats", overlay=true, pyramiding=1, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, process_orders_on_close=true)minDate = input(timestamp("01 Jan 2010 0:0 -0500"), title = "Start Date/Time", type = input.time)maxDate = input(timestamp("01 Jan 2030 0:0 -0500"), title = "End Date/Time", type = input.time)revTrd = input(false, title="Short position? (else it defaults to LONG)", type=input.bool)strategy.close_all()if time >= minDate and time <= maxDate strategy.entry("My Long Entry Id", revTrd ? strategy.short : strategy.long)