Pine Script v4 · Strategy
Day of Week Custom Buy-Sell Strategy
A Pine Script v4 strategy with no technical-analysis calculation. It has 3 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 commits 1.0% of equity and pays no commission. 6 settings; defaults include From Month 6, From day 14 and From Year 2021.
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 Day of Week Custom Buy-Sell Strategy repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 42 of 42 trades.
- How did Day of Week Custom Buy-Sell Strategy do on BTCUSDT 1D with default settings?
- +0.84%
- From 26 Jan 2024 to 21 Oct 2026, over 142 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Day of Week Custom Buy-Sell 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 Day of Week Custom Buy-Sell Strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Day of Week Custom Buy-Sell Strategy run in Zeal Terminal?
- Yes
- It compiles in 20 ms and runs 1,000 bars in 78 ms, in the browser.
BTCUSDT · 1D · default settings
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +0.84%
- $253.21
- Buy and hold
- +102.5%
- same period
- Closed trades
- 142
- 74 won · 68 lost
- Profitable
- 52.1%
- of closed trades
- Profit factor
- 1.40
- gross profit ÷ gross loss
- Max drawdown
- 0.38%
- −$115.13
One run with the author's default settings, $30,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.
-
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 32, 34. The upgraded version below moves each call inside an if block.
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.
- 2 strategy calls use the when = argument (line 32, 34). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 142 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 2: //@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/-//@version=4+//@version=5strategy("Day of Week Custom Buy/Sell Strategy", overlay=true, currency=currency.USD, default_qty_value=1.0,initial_capital=30000.00,default_qty_type=strategy.percent_of_equity)⋯Same 142 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 4: input() → input.int()
- Line 5: input() → input.int()
- Line 6: input() → input.int()
- Line 7: input() → input.int()
- Line 8: input() → input.int()
- Line 9: input() → input.int()
9 more edits
- Line 13: input() → input.string()
- Line 15: input() → input.string()
- Line 17: input() → input.string()
- Line 19: input() → input.string()
- Line 21: input() → input.string()
- Line 23: input() → input.string()
- Line 25: input() → input.string()
- Line 32: when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)) → if block
- Line 34: when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)) → if block
⋯strategy("Day of Week Custom Buy/Sell Strategy", overlay=true, currency=currency.USD, default_qty_value=1.0,initial_capital=30000.00,default_qty_type=strategy.percent_of_equity)-frommonth = input(defval = 6, minval = 01, maxval = 12, title = "From Month")+frommonth = input.int(defval = 6, minval = 01, maxval = 12, title = "From Month")-fromday = input(defval = 14, minval = 01, maxval = 31, title = "From day")+fromday = input.int(defval = 14, minval = 01, maxval = 31, title = "From day")-fromyear = input(defval = 2021, minval = 1900, maxval = 2100, title = "From Year")+fromyear = input.int(defval = 2021, minval = 1900, maxval = 2100, title = "From Year")-tomonth = input(defval = 12, minval = 01, maxval = 12, title = "To Month")+tomonth = input.int(defval = 12, minval = 01, maxval = 12, title = "To Month")-today = input(defval = 31, minval = 01, maxval = 31, title = "To day")+today = input.int(defval = 31, minval = 01, maxval = 31, title = "To day")-toyear = input(defval = 2100, minval = 1900, maxval = 2100, title = "To Year")+toyear = input.int(defval = 2100, minval = 1900, maxval = 2100, title = "To Year")timeframes = array.new_int(7, 1)⋯array.set(timeframes,0,7)-array.set(timeframes_options,0, input(defval='None', options=['Long','Short','None'], title='sunday'))+array.set(timeframes_options,0, input.string(defval='None', options=['Long','Short','None'], title='sunday'))array.set(timeframes,1,1)-array.set(timeframes_options,1, input(defval='Long', options=['Long','Short','None'], title='monday'))+array.set(timeframes_options,1, input.string(defval='Long', options=['Long','Short','None'], title='monday'))array.set(timeframes,2,2)-array.set(timeframes_options,2, input(defval='Long', options=['Long','Short','None'], title='tuesday'))+array.set(timeframes_options,2, input.string(defval='Long', options=['Long','Short','None'], title='tuesday'))array.set(timeframes,3,3)-array.set(timeframes_options,3, input(defval='Long', options=['Long','Short','None'], title='wednesday'))+array.set(timeframes_options,3, input.string(defval='Long', options=['Long','Short','None'], title='wednesday'))array.set(timeframes,4,4)-array.set(timeframes_options,4, input(defval='None', options=['Long','Short','None'], title='thursday'))+array.set(timeframes_options,4, input.string(defval='None', options=['Long','Short','None'], title='thursday'))array.set(timeframes,5,5)-array.set(timeframes_options,5, input(defval='None', options=['Long','Short','None'], title='friday'))+array.set(timeframes_options,5, input.string(defval='None', options=['Long','Short','None'], title='friday'))array.set(timeframes,6,6)-array.set(timeframes_options,6, input(defval='None', options=['Long','Short','None'], title='saturday'))+array.set(timeframes_options,6, input.string(defval='None', options=['Long','Short','None'], title='saturday'))for i = 0 to array.size(timeframes) - 1⋯ if array.get(timeframes_options, i) == 'Long'- strategy.entry("Long", strategy.long, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)))+ if (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00))+ strategy.entry("Long", strategy.long) else if array.get(timeframes_options, i) == 'Short'- strategy.entry("Short", strategy.short, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)))+ if (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00))+ strategy.entry("Short", strategy.short)Does it run in Pine Script v6?
Yes
Same 142 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.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/-//@version=5+//@version=6strategy("Day of Week Custom Buy/Sell Strategy", overlay=true, currency=currency.USD, default_qty_value=1.0,initial_capital=30000.00,default_qty_type=strategy.percent_of_equity)⋯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 |
|---|---|---|---|
| From Month | 6 | int · min 01 · max 12 | entry Long entry Short |
| From day | 14 | int · min 01 · max 31 | entry Long entry Short |
| From Year | 2021 | int · min 1900 · max 2100 | entry Long entry Short |
| To Month | 12 | int · min 01 · max 12 | entry Long entry Short |
| To day | 31 | int · min 01 · max 31 | entry Long entry Short |
| To Year | 2100 | int · min 1900 · max 2100 | entry Long entry Short |
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 | dayofweek == array.get(timeframes, i) and array.get(timeframes_options, i) != array.get(timeframes_options, i==0?6:i-1) | On | 29 |
| Open Long long | (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)) | On | 32 |
| Open Short short | (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)) | On | 34 |
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 | +0.8% | +102.5% | 142 | 52% | 1.40 | 0.4% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.1% | +5.5% | 144 | 55% | 0.89 | 0.2% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +0.9% | +9.8% | 142 | 54% | 1.29 | 0.6% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.0% | +8.4% | 144 | 53% | 0.93 | 0.2% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.2% | +16.7% | 142 | 51% | 1.05 | 0.8% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.1% | +21.5% | 144 | 52% | 0.93 | 0.2% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.6% | +148.3% | 142 | 52% | 1.26 | 0.5% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.1% | +17.1% | 144 | 56% | 0.86 | 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 | 50 | 50% | $163.10 |
| Sideways market | 59 | 44% | −$153.19 |
| Falling market | 33 | 70% | $243.30 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
0.6%
The 95th percentile of the worst drawdown when the same 142 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 0.2% to 0.6%; the tick is what actually happened, 0.3%. Order luck alone moves it this much.
All 142 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 29 Jan 2024 42,031.10 | 1 Feb 2024 42,580.00 | 3 | $3.92 |
| long | 5 Feb 2024 42,582.90 | 8 Feb 2024 44,349.60 | 3 | $12.45 |
| long | 12 Feb 2024 48,300.00 | 15 Feb 2024 51,795.20 | 3 | $21.72 |
| long | 19 Feb 2024 52,137.70 | 22 Feb 2024 51,849.40 | 3 | −$1.66 |
| long | 26 Feb 2024 51,728.80 | 29 Feb 2024 62,432.10 | 3 | $62.15 |
| long | 4 Mar 2024 63,114.00 | 7 Mar 2024 66,074.00 | 3 | $14.12 |
| long | 11 Mar 2024 68,955.90 | 14 Mar 2024 73,072.40 | 3 | $17.98 |
| long | 18 Mar 2024 68,393.50 | 21 Mar 2024 67,840.50 | 3 | −$2.44 |
| long | 25 Mar 2024 67,210.00 | 28 Mar 2024 69,470.00 | 3 | $10.13 |
| long | 1 Apr 2024 71,280.00 | 4 Apr 2024 65,963.30 | 3 | −$22.48 |
| long | 8 Apr 2024 69,360.40 | 11 Apr 2024 70,631.10 | 3 | $5.52 |
| long | 15 Apr 2024 65,661.90 | 18 Apr 2024 61,277.40 | 3 | −$20.11 |
| long | 22 Apr 2024 64,941.20 | 25 Apr 2024 64,289.60 | 3 | −$3.02 |
| long | 29 Apr 2024 63,118.60 | 2 May 2024 58,365.00 | 3 | −$22.67 |
| long | 6 May 2024 64,012.00 | 9 May 2024 61,193.00 | 3 | −$13.24 |
| long | 13 May 2024 61,484.00 | 16 May 2024 66,206.50 | 3 | $23.09 |
| long | 20 May 2024 66,274.00 | 23 May 2024 69,166.60 | 3 | $13.13 |
| long | 27 May 2024 68,507.70 | 30 May 2024 67,652.40 | 3 | −$3.76 |
| long | 3 Jun 2024 67,765.60 | 6 Jun 2024 71,108.00 | 3 | $14.84 |
| long | 10 Jun 2024 69,648.10 | 13 Jun 2024 68,264.00 | 3 | −$5.98 |
| long | 17 Jun 2024 66,676.90 | 20 Jun 2024 64,974.40 | 3 | −$7.69 |
| long | 24 Jun 2024 63,210.00 | 27 Jun 2024 60,865.00 | 3 | −$11.17 |
| long | 1 Jul 2024 62,772.00 | 4 Jul 2024 60,208.60 | 3 | −$12.29 |
| long | 8 Jul 2024 55,857.80 | 11 Jul 2024 57,725.80 | 3 | $10.06 |
| long | 15 Jul 2024 60,797.90 | 18 Jul 2024 64,088.00 | 3 | $16.28 |
| long | 22 Jul 2024 68,165.40 | 25 Jul 2024 65,376.00 | 3 | −$12.32 |
| long | 29 Jul 2024 68,249.90 | 1 Aug 2024 64,628.00 | 3 | −$15.97 |
| long | 5 Aug 2024 58,161.00 | 8 Aug 2024 55,133.80 | 3 | −$15.65 |
| long | 12 Aug 2024 58,712.60 | 15 Aug 2024 58,683.40 | 3 | −$0.15 |
| long | 19 Aug 2024 58,427.30 | 22 Aug 2024 61,156.00 | 3 | $14.04 |
| long | 26 Aug 2024 64,220.00 | 29 Aug 2024 59,034.90 | 3 | −$24.28 |
| long | 2 Sep 2024 57,301.80 | 5 Sep 2024 57,970.90 | 3 | $3.51 |
| long | 9 Sep 2024 54,869.90 | 12 Sep 2024 57,338.00 | 3 | $13.52 |
| long | 16 Sep 2024 59,132.00 | 19 Sep 2024 61,760.00 | 3 | $13.36 |
| long | 23 Sep 2024 63,578.80 | 26 Sep 2024 63,152.00 | 3 | −$2.02 |
| long | 30 Sep 2024 65,602.00 | 3 Oct 2024 60,649.30 | 3 | −$22.70 |
| long | 7 Oct 2024 62,819.90 | 10 Oct 2024 60,636.00 | 3 | −$10.45 |
| long | 14 Oct 2024 62,870.00 | 17 Oct 2024 67,620.00 | 3 | $22.70 |
| long | 21 Oct 2024 69,032.00 | 24 Oct 2024 66,668.60 | 3 | −$10.29 |
| long | 28 Oct 2024 68,021.70 | 31 Oct 2024 72,344.80 | 3 | $19.10 |
| long | 4 Nov 2024 68,776.00 | 7 Nov 2024 75,572.00 | 3 | $29.71 |
| long | 11 Nov 2024 80,370.00 | 14 Nov 2024 90,375.20 | 3 | $37.47 |
| long | 18 Nov 2024 89,856.00 | 21 Nov 2024 94,286.60 | 3 | $14.86 |
| long | 25 Nov 2024 97,900.10 | 28 Nov 2024 95,863.10 | 3 | −$6.27 |
| long | 2 Dec 2024 97,185.20 | 5 Dec 2024 98,587.30 | 3 | $4.35 |
| long | 9 Dec 2024 101,110.00 | 12 Dec 2024 101,125.00 | 3 | $0.05 |
| long | 16 Dec 2024 104,464.00 | 19 Dec 2024 100,204.00 | 3 | −$12.30 |
| long | 23 Dec 2024 95,186.30 | 26 Dec 2024 99,429.60 | 3 | $13.44 |
| long | 30 Dec 2024 93,738.20 | 2 Jan 2025 94,591.80 | 3 | $2.75 |
| long | 6 Jan 2025 98,363.60 | 9 Jan 2025 95,060.60 | 3 | −$10.13 |
| long | 13 Jan 2025 94,545.10 | 16 Jan 2025 100,497.00 | 3 | $18.98 |
| long | 20 Jan 2025 101,332.00 | 23 Jan 2025 103,707.00 | 3 | $7.07 |
| long | 27 Jan 2025 102,620.00 | 30 Jan 2025 103,733.00 | 3 | $3.27 |
| long | 3 Feb 2025 97,700.60 | 6 Feb 2025 96,612.40 | 3 | −$3.36 |
| long | 10 Feb 2025 96,462.80 | 13 Feb 2025 97,870.00 | 3 | $4.40 |
| long | 17 Feb 2025 96,118.10 | 20 Feb 2025 96,644.40 | 3 | $1.65 |
| long | 24 Feb 2025 96,258.00 | 27 Feb 2025 84,250.10 | 3 | −$37.65 |
| long | 3 Mar 2025 94,270.00 | 6 Mar 2025 90,606.00 | 3 | −$11.71 |
| long | 10 Mar 2025 80,734.50 | 13 Mar 2025 83,680.10 | 3 | $10.99 |
| long | 17 Mar 2025 82,574.50 | 20 Mar 2025 86,845.90 | 3 | $15.59 |
| long | 24 Mar 2025 86,082.50 | 27 Mar 2025 86,909.20 | 3 | $2.90 |
| long | 31 Mar 2025 82,390.00 | 3 Apr 2025 82,516.30 | 3 | $0.46 |
| long | 7 Apr 2025 78,430.00 | 10 Apr 2025 82,615.20 | 3 | $16.09 |
| long | 14 Apr 2025 83,760.00 | 17 Apr 2025 84,030.40 | 3 | $0.97 |
| long | 21 Apr 2025 85,179.20 | 24 Apr 2025 93,691.10 | 3 | $30.15 |
| long | 28 Apr 2025 93,749.30 | 1 May 2025 94,172.00 | 3 | $1.36 |
| long | 5 May 2025 94,277.60 | 8 May 2025 97,030.50 | 3 | $8.82 |
| long | 12 May 2025 104,118.00 | 15 May 2025 103,508.00 | 3 | −$1.77 |
| long | 19 May 2025 106,454.00 | 22 May 2025 109,644.00 | 3 | $9.05 |
| long | 26 May 2025 109,004.00 | 29 May 2025 107,782.00 | 3 | −$3.39 |
| long | 2 Jun 2025 105,643.00 | 5 Jun 2025 104,697.00 | 3 | −$2.71 |
| long | 9 Jun 2025 105,734.00 | 12 Jun 2025 108,645.00 | 3 | $8.32 |
| long | 16 Jun 2025 105,594.00 | 19 Jun 2025 104,887.00 | 3 | −$2.02 |
| long | 23 Jun 2025 100,964.00 | 26 Jun 2025 107,341.00 | 3 | $19.09 |
| long | 30 Jun 2025 108,357.00 | 3 Jul 2025 108,850.00 | 3 | $1.37 |
| long | 7 Jul 2025 109,204.00 | 10 Jul 2025 111,234.00 | 3 | $5.62 |
| long | 14 Jul 2025 119,087.00 | 17 Jul 2025 118,630.00 | 3 | −$1.16 |
| long | 21 Jul 2025 117,265.00 | 24 Jul 2025 118,756.00 | 3 | $3.85 |
| long | 28 Jul 2025 119,416.00 | 31 Jul 2025 117,840.00 | 3 | −$3.99 |
| long | 4 Aug 2025 114,209.00 | 7 Aug 2025 114,992.00 | 3 | $2.07 |
| long | 11 Aug 2025 119,294.00 | 14 Aug 2025 123,306.00 | 3 | $10.17 |
| long | 18 Aug 2025 117,405.00 | 21 Aug 2025 114,271.00 | 3 | −$8.08 |
| long | 25 Aug 2025 113,494.00 | 28 Aug 2025 111,262.00 | 3 | −$5.95 |
| long | 1 Sep 2025 108,246.00 | 4 Sep 2025 111,706.00 | 3 | $9.67 |
| long | 8 Sep 2025 111,137.00 | 11 Sep 2025 113,960.00 | 3 | $7.68 |
| long | 15 Sep 2025 115,268.00 | 18 Sep 2025 116,448.00 | 3 | $3.10 |
| long | 22 Sep 2025 115,232.00 | 25 Sep 2025 113,307.00 | 3 | −$5.06 |
| long | 29 Sep 2025 112,164.00 | 2 Oct 2025 118,595.00 | 3 | $17.35 |
| long | 6 Oct 2025 123,482.00 | 9 Oct 2025 123,306.00 | 3 | −$0.43 |
| long | 13 Oct 2025 114,959.00 | 16 Oct 2025 110,763.00 | 3 | −$11.05 |
| long | 20 Oct 2025 108,643.00 | 23 Oct 2025 107,567.00 | 3 | −$3.00 |
| long | 27 Oct 2025 114,559.00 | 30 Oct 2025 110,021.00 | 3 | −$11.99 |
| long | 3 Nov 2025 110,541.00 | 6 Nov 2025 103,885.00 | 3 | −$18.21 |
| long | 10 Nov 2025 104,723.00 | 13 Nov 2025 101,654.00 | 3 | −$8.86 |
| long | 17 Nov 2025 94,261.40 | 20 Nov 2025 91,555.00 | 3 | −$8.68 |
| long | 24 Nov 2025 86,830.00 | 27 Nov 2025 90,484.00 | 3 | $12.72 |
| long | 1 Dec 2025 90,360.00 | 4 Dec 2025 93,429.90 | 3 | $10.27 |
| long | 8 Dec 2025 90,395.30 | 11 Dec 2025 92,015.40 | 3 | $5.42 |
| long | 15 Dec 2025 88,172.20 | 18 Dec 2025 86,243.20 | 3 | −$6.62 |
| long | 22 Dec 2025 88,658.90 | 25 Dec 2025 87,669.40 | 3 | −$3.37 |
| long | 29 Dec 2025 87,952.70 | 1 Jan 2026 87,648.20 | 3 | −$1.05 |
| long | 5 Jan 2026 91,529.70 | 8 Jan 2026 91,364.20 | 3 | −$0.55 |
| long | 12 Jan 2026 91,013.70 | 15 Jan 2026 96,951.80 | 3 | $19.73 |
| long | 19 Jan 2026 93,673.10 | 22 Jan 2026 89,454.70 | 3 | −$13.62 |
| long | 26 Jan 2026 86,670.40 | 29 Jan 2026 89,300.00 | 3 | $9.17 |
| long | 2 Feb 2026 76,968.20 | 5 Feb 2026 73,165.80 | 3 | −$14.94 |
| long | 9 Feb 2026 70,330.40 | 12 Feb 2026 67,082.50 | 3 | −$13.96 |
| long | 16 Feb 2026 68,832.60 | 19 Feb 2026 66,461.00 | 3 | −$10.41 |
| long | 23 Feb 2026 67,643.40 | 26 Feb 2026 67,988.00 | 3 | $1.54 |
| long | 2 Mar 2026 65,776.50 | 5 Mar 2026 72,666.80 | 3 | $31.65 |
| long | 9 Mar 2026 65,971.20 | 12 Mar 2026 70,191.90 | 3 | $19.35 |
| long | 16 Mar 2026 72,815.30 | 19 Mar 2026 71,246.60 | 3 | −$6.52 |
| long | 23 Mar 2026 67,859.00 | 26 Mar 2026 71,336.50 | 3 | $15.50 |
| long | 30 Mar 2026 66,010.90 | 2 Apr 2026 68,113.90 | 3 | $9.64 |
| long | 6 Apr 2026 69,034.20 | 9 Apr 2026 71,069.90 | 3 | $8.93 |
| long | 13 Apr 2026 70,741.60 | 16 Apr 2026 74,810.00 | 3 | $17.42 |
| long | 20 Apr 2026 73,801.80 | 23 Apr 2026 78,178.20 | 3 | $17.97 |
| long | 27 Apr 2026 78,657.60 | 30 Apr 2026 75,780.00 | 3 | −$11.09 |
| long | 4 May 2026 78,568.60 | 7 May 2026 81,447.00 | 3 | $11.11 |
| long | 11 May 2026 82,210.10 | 14 May 2026 79,313.60 | 3 | −$10.68 |
| long | 18 May 2026 77,457.70 | 21 May 2026 77,552.20 | 3 | $0.37 |
| long | 25 May 2026 77,065.00 | 28 May 2026 74,449.30 | 3 | −$10.29 |
| long | 1 Jun 2026 73,674.40 | 4 Jun 2026 64,142.80 | 3 | −$39.21 |
| long | 8 Jun 2026 63,332.00 | 11 Jun 2026 61,511.00 | 3 | −$8.70 |
| long | 15 Jun 2026 65,746.40 | 18 Jun 2026 64,509.40 | 3 | −$5.69 |
| long | 22 Jun 2026 63,312.00 | 25 Jun 2026 61,078.00 | 3 | −$10.67 |
| long | 29 Jun 2026 59,577.00 | 2 Jul 2026 60,024.00 | 3 | $2.27 |
| long | 6 Jul 2026 63,650.00 | 9 Jul 2026 62,290.00 | 3 | −$6.46 |
| long | 13 Jul 2026 63,780.00 | 16 Jul 2026 64,756.30 | 3 | $4.63 |
| long | 20 Jul 2026 64,722.60 | 23 Jul 2026 66,114.50 | 3 | $6.50 |
| long | 27 Jul 2026 65,400.00 | 30 Jul 2026 63,984.30 | 3 | −$6.55 |
| long | 3 Aug 2026 63,570.00 | 6 Aug 2026 64,665.20 | 3 | $5.21 |
| long | 10 Aug 2026 64,901.60 | 13 Aug 2026 63,480.00 | 3 | −$6.62 |
| long | 17 Aug 2026 62,900.00 | 20 Aug 2026 69,334.80 | 3 | $30.93 |
| long | 24 Aug 2026 77,734.00 | 27 Aug 2026 79,023.80 | 3 | $5.02 |
| long | 31 Aug 2026 77,682.00 | 3 Sep 2026 77,340.00 | 3 | −$1.33 |
| long | 7 Sep 2026 80,341.80 | 10 Sep 2026 78,306.40 | 3 | −$7.67 |
| long | 14 Sep 2026 76,842.00 | 17 Sep 2026 76,206.00 | 3 | −$2.51 |
| long | 21 Sep 2026 81,178.00 | 24 Sep 2026 84,397.60 | 3 | $12.00 |
| long | 28 Sep 2026 84,472.00 | 1 Oct 2026 83,623.60 | 3 | −$3.04 |
| long | 5 Oct 2026 86,530.00 | 8 Oct 2026 83,321.80 | 3 | −$11.22 |
| long | 12 Oct 2026 83,773.10 | 15 Oct 2026 81,682.00 | 3 | −$7.55 |
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 20 ms | Yes 1,000 bars in 78 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
The engine and this page's reading of the source count a different number of settings, so one of them has missed one.
“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///@version=4strategy("Day of Week Custom Buy/Sell Strategy", overlay=true, currency=currency.USD, default_qty_value=1.0,initial_capital=30000.00,default_qty_type=strategy.percent_of_equity)frommonth = input(defval = 6, minval = 01, maxval = 12, title = "From Month")fromday = input(defval = 14, minval = 01, maxval = 31, title = "From day")fromyear = input(defval = 2021, minval = 1900, maxval = 2100, title = "From Year")tomonth = input(defval = 12, minval = 01, maxval = 12, title = "To Month")today = input(defval = 31, minval = 01, maxval = 31, title = "To day")toyear = input(defval = 2100, minval = 1900, maxval = 2100, title = "To Year")timeframes = array.new_int(7, 1)timeframes_options = array.new_string(7, 'None')array.set(timeframes,0,7)array.set(timeframes_options,0, input(defval='None', options=['Long','Short','None'], title='sunday'))array.set(timeframes,1,1)array.set(timeframes_options,1, input(defval='Long', options=['Long','Short','None'], title='monday'))array.set(timeframes,2,2)array.set(timeframes_options,2, input(defval='Long', options=['Long','Short','None'], title='tuesday'))array.set(timeframes,3,3)array.set(timeframes_options,3, input(defval='Long', options=['Long','Short','None'], title='wednesday'))array.set(timeframes,4,4)array.set(timeframes_options,4, input(defval='None', options=['Long','Short','None'], title='thursday'))array.set(timeframes,5,5)array.set(timeframes_options,5, input(defval='None', options=['Long','Short','None'], title='friday'))array.set(timeframes,6,6)array.set(timeframes_options,6, input(defval='None', options=['Long','Short','None'], title='saturday'))for i = 0 to array.size(timeframes) - 1 if dayofweek == array.get(timeframes, i) and array.get(timeframes_options, i) != array.get(timeframes_options, i==0?6:i-1) strategy.close_all() if dayofweek == array.get(timeframes, i) and array.get(timeframes_options, i)!='None' and array.get(timeframes_options, i) != array.get(timeframes_options, i==0?6:i-1) if array.get(timeframes_options, i) == 'Long' strategy.entry("Long", strategy.long, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00))) else if array.get(timeframes_options, i) == 'Short' strategy.entry("Short", strategy.short, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)))