Pine Script v4 · Strategy
Daily PercentR Strategy
A Pine Script v4 strategy built on Highest (3) and Lowest (3). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 4 settings; defaults include Low Marker -87, High Marker -20 and Length 3.
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 Daily PercentR Strategy repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 124 of 124 trades.
- How did Daily PercentR Strategy do on BTCUSDT 1D with default settings?
- +42.04%
- From 26 Jan 2024 to 21 Oct 2026, over 396 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Daily PercentR Strategy 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 Daily PercentR Strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Daily PercentR Strategy run in Zeal Terminal?
- Yes
- It compiles in 11 ms and runs 1,000 bars in 57 ms, in the browser.
BTCUSDT · 1D · default settings
- Upper Band
- Middle Level
- Lower Band
- %R
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +42.04%
- $42,042.40
- Buy and hold
- +102.5%
- same period
- Closed trades
- 396
- 210 won · 186 lost
- Profitable
- 53.0%
- of closed trades
- Profit factor
- 1.17
- gross profit ÷ gross loss
- Max drawdown
- 29.95%
- −$53,253.30
One run with the author's default settings, $100,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.
-
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.
-
Note
Uses transp =, which v5 removed line 22
transp = on line 22. v5 folds the transparency into the colour with color.new(c, transp).
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.
- Upgrading to v5 renames security → request.security, highest → ta.highest, lowest → ta.lowest, floor → math.floor.
Same 396 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 1: //@version=4 → //@version=5
- Line 5: security → request.security
- Line 6: security → request.security
- Line 7: security → request.security
- Line 8: security → request.security
- Line 9: input(type = input.integer) → input.int()
7 more edits
- Line 10: input(type = input.integer) → input.int()
- Line 11: input(type = input.integer) → input.int()
- Line 12: input(type = input.source) → input.source()
- Line 14: highest → ta.highest
- Line 15: lowest → ta.lowest
- Line 22: transp = 0 → color.new(#3A6CA8, 0)
- Line 24: floor → math.floor
-//@version=4+//@version=5// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯strategy("Daily PercentR Strategy", overlay=false)-D_High = security(syminfo.tickerid, 'D', high[1])+D_High = request.security(syminfo.tickerid, 'D', high[1])-D_Low = security(syminfo.tickerid, 'D', low[1])+D_Low = request.security(syminfo.tickerid, 'D', low[1])-D_Close = security(syminfo.tickerid, 'D', close[1])+D_Close = request.security(syminfo.tickerid, 'D', close[1])-D_Open = security(syminfo.tickerid, 'D', open[1])+D_Open = request.security(syminfo.tickerid, 'D', open[1])-LowMarker = input(-87,"Low Marker",input.integer)+LowMarker = input.int(-87,"Low Marker")-HighMarker = input(-20,"High Marker",input.integer)+HighMarker = input.int(-20,"High Marker")-length = input(title="Length", type=input.integer, defval=3)+length = input.int(title="Length", defval=3)-src = input(close, "Source", type = input.source)+src = input.source(close, "Source")_pr(length) =>- max = highest(length)+ max = ta.highest(length)- min = lowest(length)+ min = ta.lowest(length) 100 * (src - max) / (max - min)⋯fill(obPlot, osPlot, title="Background", color=color.new(#9915ff, 90))-plot(percentR, title="%R", color=#3A6CA8, transp=0)+plot(percentR, title="%R", color=color.new(#3A6CA8, 0))// Go Long - if percentR is not overbought/sold-ordersize=floor(strategy.equity/close) +ordersize=math.floor(strategy.equity/close) if percentR<HighMarker and percentR>LowMarker and time>timestamp(2021,0,0,0,0)⋯Clean v5
VerifiedNothing to change.
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: 396 before, 311 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.
-//@version=5+//@version=6// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯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 |
|---|---|---|---|
| Low Marker | -87 | int | Upper Band entry Long line 25 |
| High Marker | -20 | int | Lower Band entry Long line 25 |
| Length | 3 | int (written input.integer) | max min percentR |
| Source | close | source | line 16 |
What it calculates
- Highest (
highest,ta.highestin v5)Length (3)max · line 14 - Lowest (
lowest,ta.lowestin v5)Length (3)min · line 15
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 | percentR<HighMarker and percentR>LowMarker and time>timestamp(2021,0,0,0,0) | On | 26 |
| Close Long | low[0]<high[0] | On | 29 |
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 data4 security call(s), none with lookahead on.
- 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 | +42.0% | +102.5% | 396 | 53% | 1.17 | 29.9% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +5.9% | +5.5% | 405 | 54% | 1.08 | 8.7% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +1.1% | +9.8% | 403 | 52% | 1.09 | 1.9% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.4% | +8.4% | 423 | 55% | 1.15 | 0.5% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.0% | +16.7% | 396 | 49% | 1.02 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.0% | +21.5% | 404 | 50% | 1.06 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.0% | +148.3% | 405 | 55% | 1.00 | 0.5% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.2% | +17.1% | 389 | 49% | 0.80 | 0.2% | 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 | 136 | 58% | $51,391.00 |
| Sideways market | 167 | 51% | $8,589.96 |
| Falling market | 93 | 48% | −$17,938.60 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
25.5%
The 95th percentile of the worst drawdown when the same 396 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 11.8% to 25.5%; the tick is what actually happened, 28.4%. Order luck alone moves it this much.
The first 150 of 396 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 29 Jan 2024 42,031.10 | 30 Jan 2024 43,302.70 | 1 | $1,271.66 |
| long | 31 Jan 2024 42,941.10 | 1 Feb 2024 42,580.00 | 1 | −$361.10 |
| long | 2 Feb 2024 43,082.90 | 3 Feb 2024 43,200.00 | 1 | $117.04 |
| long | 4 Feb 2024 43,011.10 | 5 Feb 2024 42,582.90 | 1 | −$428.22 |
| long | 6 Feb 2024 42,708.70 | 7 Feb 2024 43,099.00 | 1 | $390.26 |
| long | 14 Feb 2024 49,699.60 | 15 Feb 2024 51,795.20 | 1 | $2,095.57 |
| long | 16 Feb 2024 51,880.00 | 17 Feb 2024 52,124.10 | 1 | $244.09 |
| long | 18 Feb 2024 51,642.60 | 19 Feb 2024 52,137.70 | 1 | $495.04 |
| long | 20 Feb 2024 51,774.70 | 21 Feb 2024 52,258.80 | 1 | $484.08 |
| long | 22 Feb 2024 51,849.40 | 23 Feb 2024 51,288.40 | 1 | −$560.96 |
| long | 25 Feb 2024 51,568.20 | 26 Feb 2024 51,728.80 | 1 | $160.64 |
| long | 1 Mar 2024 61,131.00 | 2 Mar 2024 62,387.90 | 1 | $1,256.91 |
| long | 3 Mar 2024 61,987.30 | 4 Mar 2024 63,114.00 | 1 | $1,126.69 |
| long | 6 Mar 2024 63,724.00 | 7 Mar 2024 66,074.00 | 1 | $2,350.03 |
| long | 8 Mar 2024 66,823.20 | 9 Mar 2024 68,124.20 | 1 | $1,301.02 |
| long | 10 Mar 2024 68,313.30 | 11 Mar 2024 68,955.90 | 1 | $642.60 |
| long | 13 Mar 2024 71,452.00 | 14 Mar 2024 73,072.40 | 1 | $1,620.40 |
| long | 15 Mar 2024 71,388.90 | 16 Mar 2024 69,499.80 | 1 | −$1,889.10 |
| long | 18 Mar 2024 68,393.50 | 19 Mar 2024 67,610.00 | 1 | −$783.47 |
| long | 22 Mar 2024 65,501.30 | 23 Mar 2024 63,796.60 | 1 | −$1,704.64 |
| long | 24 Mar 2024 63,990.00 | 25 Mar 2024 67,210.00 | 1 | $3,219.98 |
| long | 27 Mar 2024 69,988.00 | 28 Mar 2024 69,470.00 | 1 | −$518.00 |
| long | 29 Mar 2024 70,780.60 | 30 Mar 2024 69,850.50 | 1 | −$930.07 |
| long | 31 Mar 2024 69,582.20 | 1 Apr 2024 71,280.00 | 1 | $1,697.83 |
| long | 2 Apr 2024 69,649.80 | 3 Apr 2024 65,464.00 | 1 | −$4,185.82 |
| long | 4 Apr 2024 65,963.30 | 5 Apr 2024 68,487.80 | 1 | $2,524.53 |
| long | 6 Apr 2024 67,820.60 | 7 Apr 2024 68,896.00 | 1 | $1,075.37 |
| long | 8 Apr 2024 69,360.40 | 9 Apr 2024 71,620.00 | 1 | $2,259.62 |
| long | 10 Apr 2024 69,146.00 | 11 Apr 2024 70,631.10 | 1 | $1,485.08 |
| long | 12 Apr 2024 70,006.20 | 13 Apr 2024 67,116.50 | 1 | −$2,889.70 |
| long | 14 Apr 2024 63,924.50 | 15 Apr 2024 65,661.90 | 1 | $1,737.33 |
| long | 16 Apr 2024 63,420.00 | 17 Apr 2024 63,793.40 | 1 | $373.41 |
| long | 18 Apr 2024 61,277.40 | 19 Apr 2024 63,470.10 | 1 | $2,192.71 |
| long | 20 Apr 2024 63,818.00 | 21 Apr 2024 64,940.60 | 1 | $1,122.57 |
| long | 24 Apr 2024 66,414.00 | 25 Apr 2024 64,289.60 | 1 | −$2,124.42 |
| long | 26 Apr 2024 64,498.30 | 27 Apr 2024 63,770.00 | 1 | −$728.33 |
| long | 28 Apr 2024 63,462.00 | 29 Apr 2024 63,118.60 | 1 | −$343.36 |
| long | 1 May 2024 60,672.00 | 2 May 2024 58,365.00 | 1 | −$2,307.04 |
| long | 3 May 2024 59,060.60 | 4 May 2024 62,882.00 | 1 | $3,821.41 |
| long | 7 May 2024 63,165.20 | 8 May 2024 62,312.10 | 1 | −$853.11 |
| long | 10 May 2024 63,074.00 | 11 May 2024 60,800.00 | 1 | −$2,274.01 |
| long | 12 May 2024 60,826.00 | 13 May 2024 61,484.00 | 1 | $658.01 |
| long | 15 May 2024 61,577.50 | 16 May 2024 66,206.50 | 1 | $4,629.02 |
| long | 17 May 2024 65,235.20 | 18 May 2024 67,024.00 | 1 | $1,788.79 |
| long | 20 May 2024 66,274.00 | 21 May 2024 71,446.60 | 1 | $5,172.62 |
| long | 22 May 2024 70,148.30 | 23 May 2024 69,166.60 | 1 | −$981.72 |
| long | 24 May 2024 67,969.70 | 25 May 2024 68,550.00 | 1 | $580.33 |
| long | 26 May 2024 69,290.60 | 27 May 2024 68,507.70 | 1 | −$782.89 |
| long | 28 May 2024 69,436.40 | 29 May 2024 68,398.40 | 1 | −$1,038.03 |
| long | 30 May 2024 67,652.40 | 31 May 2024 68,352.20 | 1 | $699.76 |
| long | 1 Jun 2024 67,540.00 | 2 Jun 2024 67,766.80 | 1 | $226.83 |
| long | 3 Jun 2024 67,765.60 | 4 Jun 2024 68,809.90 | 1 | $1,044.27 |
| long | 7 Jun 2024 70,799.10 | 8 Jun 2024 69,355.60 | 1 | −$1,443.46 |
| long | 9 Jun 2024 69,310.50 | 10 Jun 2024 69,648.10 | 1 | $337.69 |
| long | 11 Jun 2024 69,540.00 | 12 Jun 2024 67,314.20 | 1 | −$2,225.77 |
| long | 13 Jun 2024 68,264.00 | 14 Jun 2024 66,773.00 | 1 | −$1,490.97 |
| long | 15 Jun 2024 66,044.00 | 16 Jun 2024 66,228.30 | 1 | $184.26 |
| long | 17 Jun 2024 66,676.90 | 18 Jun 2024 66,504.30 | 1 | −$172.53 |
| long | 19 Jun 2024 65,175.30 | 20 Jun 2024 64,974.40 | 1 | −$200.95 |
| long | 21 Jun 2024 64,870.00 | 22 Jun 2024 64,143.60 | 1 | −$726.43 |
| long | 23 Jun 2024 64,262.00 | 24 Jun 2024 63,210.00 | 1 | −$1,052.00 |
| long | 25 Jun 2024 60,293.30 | 26 Jun 2024 61,806.00 | 1 | $1,512.71 |
| long | 27 Jun 2024 60,865.00 | 28 Jun 2024 61,706.50 | 1 | $841.48 |
| long | 29 Jun 2024 60,427.80 | 30 Jun 2024 60,986.70 | 1 | $558.84 |
| long | 2 Jul 2024 62,900.00 | 3 Jul 2024 62,135.50 | 1 | −$764.54 |
| long | 4 Jul 2024 60,208.60 | 5 Jul 2024 57,050.00 | 1 | −$3,158.55 |
| long | 6 Jul 2024 56,628.80 | 7 Jul 2024 58,230.10 | 1 | $1,601.34 |
| long | 8 Jul 2024 55,857.80 | 9 Jul 2024 56,714.60 | 1 | $856.80 |
| long | 11 Jul 2024 57,725.80 | 12 Jul 2024 57,339.90 | 1 | −$385.96 |
| long | 13 Jul 2024 57,889.10 | 14 Jul 2024 59,204.00 | 1 | $1,314.92 |
| long | 18 Jul 2024 64,088.00 | 19 Jul 2024 63,987.90 | 1 | −$100.07 |
| long | 23 Jul 2024 67,532.00 | 24 Jul 2024 65,936.00 | 1 | −$1,596.00 |
| long | 26 Jul 2024 65,799.90 | 27 Jul 2024 67,908.00 | 1 | $2,108.05 |
| long | 28 Jul 2024 67,896.50 | 29 Jul 2024 68,249.90 | 1 | $353.39 |
| long | 31 Jul 2024 66,188.00 | 1 Aug 2024 64,628.00 | 1 | −$1,559.99 |
| long | 2 Aug 2024 65,354.00 | 3 Aug 2024 61,498.30 | 1 | −$3,855.68 |
| long | 4 Aug 2024 60,698.00 | 5 Aug 2024 58,161.00 | 1 | −$2,536.99 |
| long | 6 Aug 2024 54,018.80 | 7 Aug 2024 56,022.00 | 1 | $2,003.18 |
| long | 8 Aug 2024 55,133.80 | 9 Aug 2024 61,686.00 | 1 | $6,552.24 |
| long | 10 Aug 2024 60,838.00 | 11 Aug 2024 60,923.50 | 1 | $85.52 |
| long | 13 Aug 2024 59,346.60 | 14 Aug 2024 60,587.20 | 1 | $1,240.52 |
| long | 15 Aug 2024 58,683.40 | 16 Aug 2024 57,541.10 | 1 | −$1,142.34 |
| long | 17 Aug 2024 58,874.60 | 18 Aug 2024 59,492.00 | 1 | $617.40 |
| long | 19 Aug 2024 58,427.30 | 20 Aug 2024 59,438.50 | 1 | $1,011.15 |
| long | 21 Aug 2024 59,013.80 | 22 Aug 2024 61,156.00 | 1 | $2,142.23 |
| long | 23 Aug 2024 60,375.80 | 24 Aug 2024 64,037.20 | 1 | $3,661.41 |
| long | 28 Aug 2024 59,415.00 | 29 Aug 2024 59,034.90 | 1 | −$380.10 |
| long | 30 Aug 2024 59,359.00 | 31 Aug 2024 59,124.00 | 1 | −$235.01 |
| long | 1 Sep 2024 58,974.00 | 2 Sep 2024 57,301.80 | 1 | −$1,672.23 |
| long | 4 Sep 2024 57,487.70 | 5 Sep 2024 57,970.90 | 1 | $483.16 |
| long | 6 Sep 2024 56,180.00 | 7 Sep 2024 53,963.00 | 1 | −$2,217.03 |
| long | 8 Sep 2024 54,160.90 | 9 Sep 2024 54,869.90 | 1 | $709.09 |
| long | 10 Sep 2024 57,042.00 | 11 Sep 2024 57,636.00 | 1 | $593.98 |
| long | 12 Sep 2024 57,338.00 | 13 Sep 2024 58,132.30 | 1 | $794.31 |
| long | 16 Sep 2024 59,132.00 | 17 Sep 2024 58,214.00 | 1 | −$918.01 |
| long | 18 Sep 2024 60,314.00 | 19 Sep 2024 61,760.00 | 1 | $1,445.99 |
| long | 22 Sep 2024 63,349.00 | 23 Sep 2024 63,578.80 | 1 | $229.79 |
| long | 24 Sep 2024 63,340.00 | 25 Sep 2024 64,262.70 | 1 | $922.71 |
| long | 26 Sep 2024 63,152.00 | 27 Sep 2024 65,174.00 | 1 | $2,021.98 |
| long | 30 Sep 2024 65,602.00 | 1 Oct 2024 63,327.60 | 1 | −$2,274.41 |
| long | 4 Oct 2024 60,752.70 | 5 Oct 2024 62,086.00 | 1 | $1,333.28 |
| long | 8 Oct 2024 62,224.00 | 9 Oct 2024 62,160.50 | 1 | −$63.51 |
| long | 11 Oct 2024 60,326.40 | 12 Oct 2024 62,540.00 | 1 | $2,213.59 |
| long | 18 Oct 2024 67,421.80 | 19 Oct 2024 68,428.00 | 1 | $1,006.21 |
| long | 20 Oct 2024 68,378.00 | 21 Oct 2024 69,032.00 | 1 | $654.01 |
| long | 22 Oct 2024 67,377.50 | 23 Oct 2024 67,426.00 | 1 | $48.51 |
| long | 24 Oct 2024 66,668.60 | 25 Oct 2024 68,198.30 | 1 | $1,529.62 |
| long | 26 Oct 2024 66,698.30 | 27 Oct 2024 67,092.80 | 1 | $394.44 |
| long | 28 Oct 2024 68,021.70 | 29 Oct 2024 69,962.20 | 1 | $1,940.52 |
| long | 31 Oct 2024 72,344.80 | 1 Nov 2024 70,292.00 | 1 | −$2,052.74 |
| long | 2 Nov 2024 69,496.00 | 3 Nov 2024 69,374.70 | 1 | −$121.26 |
| long | 4 Nov 2024 68,776.00 | 5 Nov 2024 67,850.00 | 1 | −$925.98 |
| long | 6 Nov 2024 69,372.00 | 7 Nov 2024 75,572.00 | 1 | $6,199.98 |
| long | 14 Nov 2024 90,375.20 | 15 Nov 2024 87,325.60 | 1 | −$3,049.62 |
| long | 16 Nov 2024 91,032.10 | 17 Nov 2024 90,588.00 | 1 | −$444.10 |
| long | 18 Nov 2024 89,856.00 | 19 Nov 2024 90,464.10 | 1 | $608.09 |
| long | 20 Nov 2024 92,310.80 | 21 Nov 2024 94,286.60 | 1 | $1,975.76 |
| long | 24 Nov 2024 97,672.40 | 25 Nov 2024 97,900.10 | 1 | $227.65 |
| long | 27 Nov 2024 91,965.20 | 28 Nov 2024 95,863.10 | 1 | $3,897.95 |
| long | 29 Nov 2024 95,644.00 | 30 Nov 2024 97,460.00 | 1 | $1,816.01 |
| long | 1 Dec 2024 96,408.00 | 2 Dec 2024 97,185.20 | 1 | $777.18 |
| long | 3 Dec 2024 95,840.60 | 4 Dec 2024 95,849.70 | 1 | $9.08 |
| long | 6 Dec 2024 96,945.60 | 7 Dec 2024 99,740.80 | 1 | $2,795.21 |
| long | 8 Dec 2024 99,832.00 | 9 Dec 2024 101,110.00 | 1 | $1,277.61 |
| long | 10 Dec 2024 97,276.50 | 11 Dec 2024 96,593.00 | 1 | −$683.48 |
| long | 13 Dec 2024 100,004.00 | 14 Dec 2024 101,424.00 | 1 | $1,419.95 |
| long | 15 Dec 2024 101,420.00 | 16 Dec 2024 104,464.00 | 1 | $3,043.99 |
| long | 17 Dec 2024 106,059.00 | 18 Dec 2024 106,134.00 | 1 | $75.09 |
| long | 20 Dec 2024 97,461.90 | 21 Dec 2024 97,805.40 | 1 | $343.58 |
| long | 22 Dec 2024 97,292.00 | 23 Dec 2024 95,186.30 | 1 | −$2,105.72 |
| long | 24 Dec 2024 94,881.50 | 25 Dec 2024 98,663.60 | 1 | $3,782.11 |
| long | 27 Dec 2024 95,791.60 | 28 Dec 2024 94,299.00 | 1 | −$1,492.57 |
| long | 29 Dec 2024 95,300.00 | 30 Dec 2024 93,738.20 | 1 | −$1,561.81 |
| long | 31 Dec 2024 92,792.10 | 1 Jan 2025 93,576.00 | 1 | $783.95 |
| long | 2 Jan 2025 94,591.80 | 3 Jan 2025 96,984.80 | 1 | $2,393.01 |
| long | 6 Jan 2025 98,363.60 | 7 Jan 2025 102,236.00 | 1 | $3,871.99 |
| long | 9 Jan 2025 95,060.60 | 10 Jan 2025 92,552.50 | 1 | −$2,508.12 |
| long | 11 Jan 2025 94,726.10 | 12 Jan 2025 94,600.00 | 1 | −$126.11 |
| long | 13 Jan 2025 94,545.10 | 14 Jan 2025 94,536.10 | 1 | −$8.96 |
| long | 20 Jan 2025 101,332.00 | 21 Jan 2025 102,260.00 | 1 | $928.43 |
| long | 22 Jan 2025 106,144.00 | 23 Jan 2025 103,707.00 | 1 | −$2,437.16 |
| long | 24 Jan 2025 103,910.00 | 25 Jan 2025 104,871.00 | 1 | $960.16 |
| long | 26 Jan 2025 104,747.00 | 27 Jan 2025 102,620.00 | 1 | −$2,126.85 |
| long | 28 Jan 2025 102,083.00 | 29 Jan 2025 101,336.00 | 1 | −$747.31 |
| long | 31 Jan 2025 104,723.00 | 1 Feb 2025 102,430.00 | 1 | −$2,293.38 |
| long | 3 Feb 2025 97,700.60 | 4 Feb 2025 101,329.00 | 1 | $3,627.92 |
| long | 5 Feb 2025 97,763.10 | 6 Feb 2025 96,612.40 | 1 | −$1,150.70 |
| long | 7 Feb 2025 96,554.40 | 8 Feb 2025 96,506.80 | 1 | −$47.55 |
| long | 9 Feb 2025 96,444.80 | 10 Feb 2025 96,462.80 | 1 | $18.00 |
| long | 11 Feb 2025 97,430.80 | 12 Feb 2025 95,778.20 | 1 | −$1,652.61 |
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 |
|---|---|---|---|---|---|
| Daily PercentR Strategy this page | — | v4 strategy | +42.0% | 396 | 29.9% |
| Alex Days HiLo Rajib by 14rajib | highest lowest | v4 strategy | No trades on this market | ||
| Donchian Strat EXMO by pskoroplas | highest lowest | v4 strategy | +12.1% | 22 | 68.0% |
| Average Highest High and Lowest Low Swinger Strategy by exlux99 | lowest highest | v4 strategy | +6.4% | 20 | 49.6% |
| Highest High and Lowest Low Channel Strategy by ceyhun | highest lowest | v5 strategy | −3.7% | 26 | 7.9% |
| Donchian Channels System [racer8] by racer8 | highest lowest | v4 strategy | −3.2% | 36 | 43.6% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 11 ms | Yes 1,000 bars in 57 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.
//@version=4// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © zweiprozent original strategy by larry williamsstrategy("Daily PercentR Strategy", overlay=false)D_High = security(syminfo.tickerid, 'D', high[1])D_Low = security(syminfo.tickerid, 'D', low[1])D_Close = security(syminfo.tickerid, 'D', close[1])D_Open = security(syminfo.tickerid, 'D', open[1])LowMarker = input(-87,"Low Marker",input.integer)HighMarker = input(-20,"High Marker",input.integer)length = input(title="Length", type=input.integer, defval=3)src = input(close, "Source", type = input.source)_pr(length) => max = highest(length) min = lowest(length) 100 * (src - max) / (max - min)percentR = _pr(length)obPlot = hline(LowMarker, title="Upper Band", color=#606060)hline(-50, title="Middle Level", linestyle=hline.style_dotted, color=#606060)osPlot = hline(HighMarker, title="Lower Band", color=#606060)fill(obPlot, osPlot, title="Background", color=color.new(#9915ff, 90))plot(percentR, title="%R", color=#3A6CA8, transp=0)// Go Long - if percentR is not overbought/soldordersize=floor(strategy.equity/close) if percentR<HighMarker and percentR>LowMarker and time>timestamp(2021,0,0,0,0) strategy.entry("Long", strategy.long,comment="Long")//exit at end of sessionif low[0]<high[0] strategy.close("Long", comment="exit")