Zeal Terminal Open in Zeal Terminal

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
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (6)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$30,263$60,758Equity from $30,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference.
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

Verified

Same 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)⋯

Clean v5

VerifiedDownload the v5 script

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.

Download the v6 script

// 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.

SettingDefaultType and rangeFeeds
From Month6int · min 01 · max 12entry Long entry Short
From day14int · min 01 · max 31entry Long entry Short
From Year2021int · min 1900 · max 2100entry Long entry Short
To Month12int · min 01 · max 12entry Long entry Short
To day31int · min 01 · max 31entry Long entry Short
To Year2100int · min 1900 · max 2100entry 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.

timetimeprice datafromyearFrom Yearsetting · 2021frommonthFrom Monthsetting · 6fromdayFrom daysetting · 14toyearTo Yearsetting · 2100tomonthTo Monthsetting · 12todayTo daysetting · 31close_all:close_all strategy.close_allentry:LongOpen Longstrategy.entryentry:ShortOpen Shortstrategy.entry

Order rules

OrderFires whenBy defaultLine
Close dayofweek == array.get(timeframes, i) and array.get(timeframes_options, i) != array.get(timeframes_options, i==0?6:i-1)On29
Open Long long(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00))On32
Open Short short(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00))On34

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.

42/42trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • 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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+0.8%+102.5%14252%1.400.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.1%+5.5%14455%0.890.2%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.9%+9.8%14254%1.290.6%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.0%+8.4%14453%0.930.2%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.2%+16.7%14251%1.050.8%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.1%+21.5%14452%0.930.2%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.6%+148.3%14252%1.260.5%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−0.1%+17.1%14456%0.860.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 barsTradesWonP&L
Rising market5050%$163.10
Sideways market5944%−$153.19
Falling market3370%$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.

0%1%
All 142 trades
SideEntryExitBarsP&L
long29 Jan 2024 42,031.101 Feb 2024 42,580.003$3.92
long5 Feb 2024 42,582.908 Feb 2024 44,349.603$12.45
long12 Feb 2024 48,300.0015 Feb 2024 51,795.203$21.72
long19 Feb 2024 52,137.7022 Feb 2024 51,849.403−$1.66
long26 Feb 2024 51,728.8029 Feb 2024 62,432.103$62.15
long4 Mar 2024 63,114.007 Mar 2024 66,074.003$14.12
long11 Mar 2024 68,955.9014 Mar 2024 73,072.403$17.98
long18 Mar 2024 68,393.5021 Mar 2024 67,840.503−$2.44
long25 Mar 2024 67,210.0028 Mar 2024 69,470.003$10.13
long1 Apr 2024 71,280.004 Apr 2024 65,963.303−$22.48
long8 Apr 2024 69,360.4011 Apr 2024 70,631.103$5.52
long15 Apr 2024 65,661.9018 Apr 2024 61,277.403−$20.11
long22 Apr 2024 64,941.2025 Apr 2024 64,289.603−$3.02
long29 Apr 2024 63,118.602 May 2024 58,365.003−$22.67
long6 May 2024 64,012.009 May 2024 61,193.003−$13.24
long13 May 2024 61,484.0016 May 2024 66,206.503$23.09
long20 May 2024 66,274.0023 May 2024 69,166.603$13.13
long27 May 2024 68,507.7030 May 2024 67,652.403−$3.76
long3 Jun 2024 67,765.606 Jun 2024 71,108.003$14.84
long10 Jun 2024 69,648.1013 Jun 2024 68,264.003−$5.98
long17 Jun 2024 66,676.9020 Jun 2024 64,974.403−$7.69
long24 Jun 2024 63,210.0027 Jun 2024 60,865.003−$11.17
long1 Jul 2024 62,772.004 Jul 2024 60,208.603−$12.29
long8 Jul 2024 55,857.8011 Jul 2024 57,725.803$10.06
long15 Jul 2024 60,797.9018 Jul 2024 64,088.003$16.28
long22 Jul 2024 68,165.4025 Jul 2024 65,376.003−$12.32
long29 Jul 2024 68,249.901 Aug 2024 64,628.003−$15.97
long5 Aug 2024 58,161.008 Aug 2024 55,133.803−$15.65
long12 Aug 2024 58,712.6015 Aug 2024 58,683.403−$0.15
long19 Aug 2024 58,427.3022 Aug 2024 61,156.003$14.04
long26 Aug 2024 64,220.0029 Aug 2024 59,034.903−$24.28
long2 Sep 2024 57,301.805 Sep 2024 57,970.903$3.51
long9 Sep 2024 54,869.9012 Sep 2024 57,338.003$13.52
long16 Sep 2024 59,132.0019 Sep 2024 61,760.003$13.36
long23 Sep 2024 63,578.8026 Sep 2024 63,152.003−$2.02
long30 Sep 2024 65,602.003 Oct 2024 60,649.303−$22.70
long7 Oct 2024 62,819.9010 Oct 2024 60,636.003−$10.45
long14 Oct 2024 62,870.0017 Oct 2024 67,620.003$22.70
long21 Oct 2024 69,032.0024 Oct 2024 66,668.603−$10.29
long28 Oct 2024 68,021.7031 Oct 2024 72,344.803$19.10
long4 Nov 2024 68,776.007 Nov 2024 75,572.003$29.71
long11 Nov 2024 80,370.0014 Nov 2024 90,375.203$37.47
long18 Nov 2024 89,856.0021 Nov 2024 94,286.603$14.86
long25 Nov 2024 97,900.1028 Nov 2024 95,863.103−$6.27
long2 Dec 2024 97,185.205 Dec 2024 98,587.303$4.35
long9 Dec 2024 101,110.0012 Dec 2024 101,125.003$0.05
long16 Dec 2024 104,464.0019 Dec 2024 100,204.003−$12.30
long23 Dec 2024 95,186.3026 Dec 2024 99,429.603$13.44
long30 Dec 2024 93,738.202 Jan 2025 94,591.803$2.75
long6 Jan 2025 98,363.609 Jan 2025 95,060.603−$10.13
long13 Jan 2025 94,545.1016 Jan 2025 100,497.003$18.98
long20 Jan 2025 101,332.0023 Jan 2025 103,707.003$7.07
long27 Jan 2025 102,620.0030 Jan 2025 103,733.003$3.27
long3 Feb 2025 97,700.606 Feb 2025 96,612.403−$3.36
long10 Feb 2025 96,462.8013 Feb 2025 97,870.003$4.40
long17 Feb 2025 96,118.1020 Feb 2025 96,644.403$1.65
long24 Feb 2025 96,258.0027 Feb 2025 84,250.103−$37.65
long3 Mar 2025 94,270.006 Mar 2025 90,606.003−$11.71
long10 Mar 2025 80,734.5013 Mar 2025 83,680.103$10.99
long17 Mar 2025 82,574.5020 Mar 2025 86,845.903$15.59
long24 Mar 2025 86,082.5027 Mar 2025 86,909.203$2.90
long31 Mar 2025 82,390.003 Apr 2025 82,516.303$0.46
long7 Apr 2025 78,430.0010 Apr 2025 82,615.203$16.09
long14 Apr 2025 83,760.0017 Apr 2025 84,030.403$0.97
long21 Apr 2025 85,179.2024 Apr 2025 93,691.103$30.15
long28 Apr 2025 93,749.301 May 2025 94,172.003$1.36
long5 May 2025 94,277.608 May 2025 97,030.503$8.82
long12 May 2025 104,118.0015 May 2025 103,508.003−$1.77
long19 May 2025 106,454.0022 May 2025 109,644.003$9.05
long26 May 2025 109,004.0029 May 2025 107,782.003−$3.39
long2 Jun 2025 105,643.005 Jun 2025 104,697.003−$2.71
long9 Jun 2025 105,734.0012 Jun 2025 108,645.003$8.32
long16 Jun 2025 105,594.0019 Jun 2025 104,887.003−$2.02
long23 Jun 2025 100,964.0026 Jun 2025 107,341.003$19.09
long30 Jun 2025 108,357.003 Jul 2025 108,850.003$1.37
long7 Jul 2025 109,204.0010 Jul 2025 111,234.003$5.62
long14 Jul 2025 119,087.0017 Jul 2025 118,630.003−$1.16
long21 Jul 2025 117,265.0024 Jul 2025 118,756.003$3.85
long28 Jul 2025 119,416.0031 Jul 2025 117,840.003−$3.99
long4 Aug 2025 114,209.007 Aug 2025 114,992.003$2.07
long11 Aug 2025 119,294.0014 Aug 2025 123,306.003$10.17
long18 Aug 2025 117,405.0021 Aug 2025 114,271.003−$8.08
long25 Aug 2025 113,494.0028 Aug 2025 111,262.003−$5.95
long1 Sep 2025 108,246.004 Sep 2025 111,706.003$9.67
long8 Sep 2025 111,137.0011 Sep 2025 113,960.003$7.68
long15 Sep 2025 115,268.0018 Sep 2025 116,448.003$3.10
long22 Sep 2025 115,232.0025 Sep 2025 113,307.003−$5.06
long29 Sep 2025 112,164.002 Oct 2025 118,595.003$17.35
long6 Oct 2025 123,482.009 Oct 2025 123,306.003−$0.43
long13 Oct 2025 114,959.0016 Oct 2025 110,763.003−$11.05
long20 Oct 2025 108,643.0023 Oct 2025 107,567.003−$3.00
long27 Oct 2025 114,559.0030 Oct 2025 110,021.003−$11.99
long3 Nov 2025 110,541.006 Nov 2025 103,885.003−$18.21
long10 Nov 2025 104,723.0013 Nov 2025 101,654.003−$8.86
long17 Nov 2025 94,261.4020 Nov 2025 91,555.003−$8.68
long24 Nov 2025 86,830.0027 Nov 2025 90,484.003$12.72
long1 Dec 2025 90,360.004 Dec 2025 93,429.903$10.27
long8 Dec 2025 90,395.3011 Dec 2025 92,015.403$5.42
long15 Dec 2025 88,172.2018 Dec 2025 86,243.203−$6.62
long22 Dec 2025 88,658.9025 Dec 2025 87,669.403−$3.37
long29 Dec 2025 87,952.701 Jan 2026 87,648.203−$1.05
long5 Jan 2026 91,529.708 Jan 2026 91,364.203−$0.55
long12 Jan 2026 91,013.7015 Jan 2026 96,951.803$19.73
long19 Jan 2026 93,673.1022 Jan 2026 89,454.703−$13.62
long26 Jan 2026 86,670.4029 Jan 2026 89,300.003$9.17
long2 Feb 2026 76,968.205 Feb 2026 73,165.803−$14.94
long9 Feb 2026 70,330.4012 Feb 2026 67,082.503−$13.96
long16 Feb 2026 68,832.6019 Feb 2026 66,461.003−$10.41
long23 Feb 2026 67,643.4026 Feb 2026 67,988.003$1.54
long2 Mar 2026 65,776.505 Mar 2026 72,666.803$31.65
long9 Mar 2026 65,971.2012 Mar 2026 70,191.903$19.35
long16 Mar 2026 72,815.3019 Mar 2026 71,246.603−$6.52
long23 Mar 2026 67,859.0026 Mar 2026 71,336.503$15.50
long30 Mar 2026 66,010.902 Apr 2026 68,113.903$9.64
long6 Apr 2026 69,034.209 Apr 2026 71,069.903$8.93
long13 Apr 2026 70,741.6016 Apr 2026 74,810.003$17.42
long20 Apr 2026 73,801.8023 Apr 2026 78,178.203$17.97
long27 Apr 2026 78,657.6030 Apr 2026 75,780.003−$11.09
long4 May 2026 78,568.607 May 2026 81,447.003$11.11
long11 May 2026 82,210.1014 May 2026 79,313.603−$10.68
long18 May 2026 77,457.7021 May 2026 77,552.203$0.37
long25 May 2026 77,065.0028 May 2026 74,449.303−$10.29
long1 Jun 2026 73,674.404 Jun 2026 64,142.803−$39.21
long8 Jun 2026 63,332.0011 Jun 2026 61,511.003−$8.70
long15 Jun 2026 65,746.4018 Jun 2026 64,509.403−$5.69
long22 Jun 2026 63,312.0025 Jun 2026 61,078.003−$10.67
long29 Jun 2026 59,577.002 Jul 2026 60,024.003$2.27
long6 Jul 2026 63,650.009 Jul 2026 62,290.003−$6.46
long13 Jul 2026 63,780.0016 Jul 2026 64,756.303$4.63
long20 Jul 2026 64,722.6023 Jul 2026 66,114.503$6.50
long27 Jul 2026 65,400.0030 Jul 2026 63,984.303−$6.55
long3 Aug 2026 63,570.006 Aug 2026 64,665.203$5.21
long10 Aug 2026 64,901.6013 Aug 2026 63,480.003−$6.62
long17 Aug 2026 62,900.0020 Aug 2026 69,334.803$30.93
long24 Aug 2026 77,734.0027 Aug 2026 79,023.803$5.02
long31 Aug 2026 77,682.003 Sep 2026 77,340.003−$1.33
long7 Sep 2026 80,341.8010 Sep 2026 78,306.403−$7.67
long14 Sep 2026 76,842.0017 Sep 2026 76,206.003−$2.51
long21 Sep 2026 81,178.0024 Sep 2026 84,397.603$12.00
long28 Sep 2026 84,472.001 Oct 2026 83,623.603−$3.04
long5 Oct 2026 86,530.008 Oct 2026 83,321.803−$11.22
long12 Oct 2026 83,773.1015 Oct 2026 81,682.003−$7.55

Similar scripts

No other indicator or strategy here shares enough of its calculations.

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 20 msYes 1,000 bars in 78 msNot measured
PineTSNo 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)))