Pine Script v4 · Strategy
Does your trading pass the seasonality test-
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 25% of equity and pays 0.5% commission. 3 settings; defaults include Position Type Long, Entry Month Oct and Entry Month Jan.
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 Does your trading pass the seasonality test- repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Does your trading pass the seasonality test- do on BTCUSDT 1D with default settings?
- +6.04%
- From 26 Jan 2024 to 21 Oct 2026, over 2 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Does your trading pass the seasonality test- 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 Does your trading pass the seasonality test- use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Does your trading pass the seasonality test- run in Zeal Terminal?
- Yes
- It compiles in 11 ms and runs 1,000 bars in 27 ms, in the browser.
BTCUSDT · 1D · default settings
- Equity
- Balance
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +6.04%
- $6,041.10
- Buy and hold
- +102.5%
- same period
- Closed trades
- 2
- 1 won · 1 lost
- Profitable
- 50.0%
- of closed trades
- Profit factor
- 1.81
- gross profit ÷ gross loss
- Max drawdown
- 8.09%
- −$9,186.96
One run with the author's default settings, $100,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.
-
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.
- Upgrading to v5 renames change → ta.change.
v4 → v5
VerifiedSame 2 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 33: strategy.entry(…, is_long) → strategy.entry(…, (is_long) ? strategy.long : strategy.short)
- Line 41: change → ta.change
⋯// © EmpiricalFX-//@version=4+//@version=5strategy("Seasonality Benchmark ","Season",overlay=false,default_qty_type=strategy.percent_of_equity,⋯if(strategy.opentrades == 0 and entry == month)- strategy.entry("Swing",is_long)+ strategy.entry("Swing",(is_long) ? strategy.long : strategy.short)//Exiting a position is conditional on:⋯//Update the balance every time a trade is exited-if(change(strategy.closedtrades)>0)+if(ta.change(strategy.closedtrades)>0) balance := strategy.equity⋯Same 2 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 7: input() → input.string()
- Line 8: input() → input.string()
- Line 9: input() → input.string()
⋯ commission_type=strategy.commission.percent,commission_value=0.5)-input_entry_direction = input("Long","Position Type",options=["Long","Short"])+input_entry_direction = input.string("Long","Position Type",options=["Long","Short"])-input_entry_month = input("Oct","Entry Month",options=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"])+input_entry_month = input.string("Oct","Entry Month",options=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"])-input_exit_month = input("Jan","Entry Month",options=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"])+input_exit_month = input.string("Jan","Entry Month",options=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"])//Convert three character month string to integer⋯Does it run in Pine Script v6?
Yes
Same 2 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.
⋯// © EmpiricalFX-//@version=5+//@version=6strategy("Seasonality Benchmark ","Season",overlay=false,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 |
|---|---|---|---|
| Position Type | Long | string · options ["Long","Short"] | is_long |
| Entry Month | Oct | string · options ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] | entry |
| Entry Month | Jan | string · options ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] | exit |
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 |
|---|---|---|---|
| Open Swing is_long | (strategy.opentrades == 0 and entry == month) | On | 33 |
| Close Swing | (strategy.opentrades > 0 and exit == month) | On | 38 |
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.
- 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 | +6.0% | +102.5% | 2 | 50% | 1.81 | 8.1% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.1% | +5.5% | 0 | 0% | 0.00 | 1.3% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +0.2% | +9.8% | 2 | 50% | 1.03 | 11.3% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.1% | +8.4% | 0 | 0% | 0.00 | 3.6% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −3.7% | +16.7% | 2 | 50% | 0.69 | 14.3% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.1% | +21.5% | 0 | 0% | 0.00 | 4.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +2.4% | +148.3% | 2 | 50% | 1.53 | 6.3% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.1% | +17.1% | 0 | 0% | 0.00 | 2.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 | 0 | — | $0.00 |
| Sideways market | 2 | 50% | $6,173.15 |
| Falling market | 0 | — | $0.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
6.5%
The 95th percentile of the worst drawdown when the same 2 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 6.5% to 6.5%; the tick is what actually happened, 6.5%. Order luck alone moves it this much.
All 2 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 2 Oct 2024 60,804.90 | 2 Jan 2025 94,591.80 | 92 | $13,504.30 |
| long | 2 Oct 2025 118,595.00 | 2 Jan 2026 88,839.10 | 92 | −$7,331.17 |
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 11 ms | With a workaround 1,000 bars in 27 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
Zeal Terminal's engine currently reads an order side written as is_long as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 33) so the engine trades the way the script says.
“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/// © EmpiricalFX//@version=4strategy("Seasonality Benchmark ","Season",overlay=false,default_qty_type=strategy.percent_of_equity, default_qty_value=25,initial_capital=100000,currency="USD", commission_type=strategy.commission.percent,commission_value=0.5)input_entry_direction = input("Long","Position Type",options=["Long","Short"])input_entry_month = input("Oct","Entry Month",options=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"])input_exit_month = input("Jan","Entry Month",options=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"])//Convert three character month string to integermonth_str_to_int(m)=> ret = m == "Jan" ? 1 : m == "Feb" ? 2 : m == "Mar" ? 3 : m == "Apr" ? 4 : m == "May" ? 5 : m == "Jun" ? 6 : m == "Jul" ? 7 : m == "Aug" ? 8 : m == "Sep" ? 9 : m == "Oct" ? 10 : m == "Nov" ? 11 : m == "Dec" ? 12 : -1 is_long = input_entry_direction == "Long" ? true : falseentry = month_str_to_int(input_entry_month)exit = month_str_to_int(input_exit_month)var balance = strategy.equity//Entering a position is conditional on: //1. No currently active trades //2. Input entry month matches current monthif(strategy.opentrades == 0 and entry == month) strategy.entry("Swing",is_long)//Exiting a position is conditional on: //1. Must have open trade //2. Input exit month matches current monthif(strategy.opentrades > 0 and exit == month) strategy.close("Swing") //Update the balance every time a trade is exitedif(change(strategy.closedtrades)>0) balance := strategy.equity plot(strategy.equity,"Equity",color.orange)plot(balance,"Balance",color.red)