Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Hobbiecode - SP500 IBS + Higher

A Pine Script v5 strategy with no technical-analysis calculation. 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. It has no 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 Hobbiecode - SP500 IBS + Higher repaint?
Yes
In a live replay, it did not match history on 4 of 11 trades, and it produced 7 trades that history does not have.
How did Hobbiecode - SP500 IBS + Higher do on BTCUSDT 1D with default settings?
+0.47%
From 26 Jan 2024 to 21 Oct 2026, over 34 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Hobbiecode - SP500 IBS + Higher 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: 34 before, 24 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does Hobbiecode - SP500 IBS + Higher use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Hobbiecode - SP500 IBS + Higher run in Zeal Terminal?
Yes
It compiles in 13 ms and runs 1,000 bars in 22 ms, in the browser.

BTCUSDT · 1D · default settings

  • Close
  • Previous Friday Close
  • Enter
  • Exit
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,007,490$2,025,273Equity from $1,000,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market. The live re-run is not offered here: the script requests BINANCE:BTCUSDT W, which this page cannot load in your browser.
Net profit
+0.47%
$4,728.69
Buy and hold
+102.5%
same period
Closed trades
34
22 won · 12 lost
Profitable
64.7%
of closed trades
Profit factor
1.09
gross profit ÷ gross loss
Max drawdown
1.94%
−$19,578.70

One run with the author's default settings, $1,000,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.

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

The script declares no settings.

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.

highhighprice datalowlowprice dataclosecloseprice datatimetimeprice dataibsibsvalueprevFridayCloseprevFridayClosevalueenterConditionenterConditionconditionexitConditionexitConditionconditionisMondayisMondayconditionentry:BuyOpen Buystrategy.entryclose:BuyClose Buystrategy.closeplot:27Closeplotplot:28Previous Friday Closeplotplotshape:29Enterplotshapeplotshape:30Exitplotshape

Order rules

OrderFires whenBy defaultLine
Open Buy longenterConditionOn22
Close BuyexitConditionOn25

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Does it repaint?

Yes

The live replay did not match history.

7/11trades 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 data1 request.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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+0.5%+102.5%3465%1.091.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.2%+5.5%1953%0.720.5%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−0.1%+9.8%3551%0.770.2%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.0%+8.4%2268%3.110.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.0%+16.7%3847%1.080.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%1759%0.540.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.0%+148.3%3656%1.100.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%2060%1.080.0%8 May 2026 – 21 Oct 2026

Higher-timeframe data for request.security(): BINANCE:BTCUSDT W (Binance BTCUSDT 1w), fetched from Binance's public market data for each market.

Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market875%$16,557.10
Sideways market1850%−$25,125.00
Falling market888%$13,296.60

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

3.2%

The 95th percentile of the worst drawdown when the same 34 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 1.4% to 3.2%; the tick is what actually happened, 1.7%. Order luck alone moves it this much.

0%4%
All 34 trades
SideEntryExitBarsP&L
long19 Mar 2024 67,610.0023 Mar 2024 63,796.604−$3,813.36
long16 Apr 2024 63,420.0020 Apr 2024 63,818.004$398.02
long25 Jun 2024 60,293.3029 Jun 2024 60,427.804$134.54
long2 Jul 2024 62,900.006 Jul 2024 56,628.804−$6,271.21
long30 Jul 2024 66,784.703 Aug 2024 61,498.304−$5,286.34
long1 Oct 2024 63,327.605 Oct 2024 62,086.004−$1,241.60
long8 Oct 2024 62,224.0012 Oct 2024 62,540.004$315.98
long5 Nov 2024 67,850.007 Nov 2024 75,572.002$7,721.98
long3 Dec 2024 95,840.605 Dec 2024 98,587.302$2,746.71
long31 Dec 2024 92,792.103 Jan 2025 96,984.803$4,192.74
long18 Feb 2025 95,780.0021 Feb 2025 98,305.003$2,525.00
long25 Feb 2025 91,552.901 Mar 2025 84,349.904−$7,202.93
long4 Mar 2025 86,221.206 Mar 2025 90,606.002$4,384.84
long11 Mar 2025 78,595.9013 Mar 2025 83,680.102$5,084.26
long1 Apr 2025 82,550.002 Apr 2025 85,158.401$2,608.35
long8 Jul 2025 108,263.0010 Jul 2025 111,234.002$2,971.06
long22 Jul 2025 117,380.0023 Jul 2025 119,954.001$2,574.07
long26 Aug 2025 110,112.0030 Aug 2025 108,377.004−$1,734.58
long23 Sep 2025 112,651.0025 Sep 2025 113,307.002$656.02
long4 Nov 2025 106,583.008 Nov 2025 103,339.004−$3,243.96
long18 Nov 2025 92,215.1022 Nov 2025 85,129.404−$7,085.72
long2 Dec 2025 86,286.003 Dec 2025 91,277.901$4,991.87
long16 Dec 2025 86,432.1020 Dec 2025 88,136.904$1,704.87
long30 Dec 2025 87,237.103 Jan 2026 89,995.104$2,758.01
long13 Jan 2026 91,296.2014 Jan 2026 95,414.001$4,117.79
long24 Feb 2026 64,656.0026 Feb 2026 67,988.002$3,332.03
long31 Mar 2026 66,797.401 Apr 2026 68,284.501$1,487.11
long26 May 2026 77,322.0030 May 2026 73,460.804−$3,861.23
long2 Jun 2026 71,408.906 Jun 2026 61,056.504−$10,352.40
long9 Jun 2026 63,086.0012 Jun 2026 63,626.003$540.00
long23 Jun 2026 64,020.0027 Jun 2026 60,097.304−$3,922.74
long14 Jul 2026 62,334.5015 Jul 2026 65,044.001$2,709.47
long28 Jul 2026 63,755.9031 Jul 2026 64,780.003$1,024.17
long13 Oct 2026 81,850.0017 Oct 2026 81,615.904−$234.10

Similar scripts

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

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • No v6-only features. v6 is not needed to run this script.

Clean v5

Verified

Nothing 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: 34 before, 24 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.

⋯// Sell 5 trading days later (at the close).-//@version=5+//@version=6strategy("Hobbiecode - SP500 IBS + Higher", overlay=true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 13 msWith a workaround 1,000 bars in 22 msNot measured
PineTSNot testedNot testedNot measured

The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.

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

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/// © hobbiecode// Today is Monday.// The close must be lower than the close on Friday.// The IBS must be below 0.5.// If 1-3 are true, then enter at the close.// Sell 5 trading days later (at the close).//@version=5strategy("Hobbiecode - SP500 IBS + Higher", overlay=true)// Check if it's MondayisMonday = dayofweek(time) == dayofweek.monday// Calculate the IBS (Intraday Breadth Strength) indicatoribs = (close - low) / (high - low)// Calculate the close on the previous FridayprevFridayClose = request.security(syminfo.tickerid, "W", close[1])// Entry conditionsenterCondition = isMonday and close < prevFridayClose and ibs < 0.5 and strategy.position_size < 1 // Exit conditionsexitCondition = (close > high[1] or ta.barssince(enterCondition) == 4) and strategy.position_size > 0 // Entry signalif enterCondition    strategy.entry("Buy", strategy.long)// Exit signalif exitCondition    strategy.close("Buy")// Plotting the close, previous Friday's close, and entry/exit points on the chartplot(close, title="Close", color=color.blue)plot(prevFridayClose, title="Previous Friday Close", color=color.orange)plotshape(enterCondition, title="Enter", location=location.belowbar, color=color.green, style=shape.labelup, text="Enter")plotshape(exitCondition, title="Exit", location=location.abovebar, color=color.red, style=shape.labeldown, text="Exit")