Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

BTC Hashrate ribbons

A Pine Script v5 strategy built on Crossover (SignalLine, LongLine) and Crossunder (SignalLine, LongLine). It has 4 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 100 in cash and pays no commission. 6 settings; defaults include Both(0), Long(1), Short(-1) 0, Smoothing short MA SMA and Short MA length 30.

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 BTC Hashrate ribbons repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did BTC Hashrate ribbons do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its entry conditions never all held on this data. It closed no trades on the other markets either. A backtest, not investment advice.
Does BTC Hashrate ribbons run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download.
Does BTC Hashrate ribbons use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does BTC Hashrate ribbons run in Zeal Terminal?
Yes
It compiles in 15 ms and runs 1,000 bars in 28 ms, in the browser.

BTCUSDT · 1D · default settings

  • Crossover
  • Crossunder
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$100$203Equity from $100
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. The live re-run is not offered here: the script requests QUANDL:BCHAIN/HRATE D, which this page cannot load in your browser.

Needs QUANDL:BCHAIN/HRATE D data, not available: not a Binance spot market Values that depend on it are empty on this chart.

Net profit
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.00%
$0.00

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

Settings

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

SettingDefaultType and rangeFeeds
Direction
Both(0), Long(1), Short(-1)0intentry Long close Short entry Short close Long line 36 line 38 line 41 line 43
Hashrate Settings
Smoothing short MASMAstring · options ["SMA", "RMA", "EMA", "WMA"]line 12
Short MA length30intSignalLine Short MA
Smoothing long MASMAstring · options ["SMA", "RMA", "EMA", "WMA"]line 18
Long MA length60intLongLine Long MA
Source Settings
Data SourceQuandlstring · options ["Quandl", "Glassnode", "IntoTheBlock"]SourceE

What it calculates

  • CrossoverSignalLine, LongLineLongCondition · line 33
  • CrossunderSignalLine, LongLineShortCondition · line 34

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.

SourceData Sourcesetting · Quandlclosecloseprice dataSmoothLengthSShort MA lengthsetting · 30SmoothLengthLLong MA lengthsetting · 60enableDirectionBoth(0), Long(1), Short…setting · 0LongConditionCrossover→ LongConditionShortConditionCrossunder→ ShortConditionSourceESourceEvalueHashRateHashRatevalueSignalLineSignalLinevalueLongLineLongLinevalueentry:LongOpen Longstrategy.entryclose:ShortClose Shortstrategy.closeentry:ShortOpen Shortstrategy.entryclose:LongClose Longstrategy.closeplot:31Short MAplotplot:32Long MAplot

Order rules

OrderFires whenBy defaultLine
Open Long longLongCondition and (enableDirection == 1 or enableDirection == 0)On37
Close ShortLongCondition and (enableDirection == -1)On39
Open Short shortShortCondition and (enableDirection == -1 or enableDirection == 0)On42
Close LongShortCondition and (enableDirection == 1)On44

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.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • 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

Not run on other markets: the script requests QUANDL:BCHAIN/HRATE D, and that data is not available here (not a Binance spot market). Its results would rest on empty values.

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.

  • 3 settings use the untyped input() (line 6, 8, 10). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

Not verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 6: input() → input.int()
  • Line 8: input() → input.int()
  • Line 10: input() → input.int()
⋯strategy("BTC Hashrate ribbons", overlay = true, scale=scale.none, default_qty_type = strategy.cash, default_qty_value = 100, initial_capital = 100)-enableDirection = input(0, title="Both(0), Long(1), Short(-1)", group="Direction")+enableDirection = input.int(0, title="Both(0), Long(1), Short(-1)", group="Direction")smoothingS = input.string(title="Smoothing short MA", defval="SMA", options=["SMA", "RMA", "EMA", "WMA"], group="Hashrate Settings")-SmoothLengthS = input(30, 'Short MA length', group="Hashrate Settings")+SmoothLengthS = input.int(30, 'Short MA length', group="Hashrate Settings")smoothingL = input.string(title="Smoothing long MA", defval="SMA", options=["SMA", "RMA", "EMA", "WMA"], group="Hashrate Settings")-SmoothLengthL = input(60, 'Long MA length', group="Hashrate Settings")+SmoothLengthL = input.int(60, 'Long MA length', group="Hashrate Settings")ma_functionS(source, length) =>⋯

Does it run in Pine Script v6?

Not tested

Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// Since IntoTheBlock only provides daily hashrate data, this chart might look chunky on lower timeframes, even with smoothing.-//@version=5+//@version=6strategy("BTC Hashrate ribbons", overlay = true, scale=scale.none, default_qty_type = strategy.cash, default_qty_value = 100, initial_capital = 100)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 15 msYes 1,000 bars in 28 msNot measured
PineTSNot testedNot testedNot 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.

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/// © Powerscooter// Since IntoTheBlock only provides daily hashrate data, this chart might look chunky on lower timeframes, even with smoothing.//@version=5strategy("BTC Hashrate ribbons", overlay = true, scale=scale.none, default_qty_type = strategy.cash, default_qty_value = 100, initial_capital = 100)enableDirection = input(0, title="Both(0), Long(1), Short(-1)", group="Direction")smoothingS = input.string(title="Smoothing short MA", defval="SMA", options=["SMA", "RMA", "EMA", "WMA"], group="Hashrate Settings")SmoothLengthS = input(30, 'Short MA length', group="Hashrate Settings")smoothingL = input.string(title="Smoothing long MA", defval="SMA", options=["SMA", "RMA", "EMA", "WMA"], group="Hashrate Settings")SmoothLengthL = input(60, 'Long MA length', group="Hashrate Settings")ma_functionS(source, length) =>    switch smoothingS        "RMA" => ta.rma(source, length)        "SMA" => ta.sma(source, length)        "EMA" => ta.ema(source, length)        => ta.wma(source, length)ma_functionL(source, length) =>    switch smoothingL        "RMA" => ta.rma(source, length)        "SMA" => ta.sma(source, length)        "EMA" => ta.ema(source, length)        => ta.wma(source, length)Source = input.string(title="Data Source", defval="Quandl", options=["Quandl", "Glassnode", "IntoTheBlock"], group="Source Settings")SourceE = switch Source    "Quandl" => "QUANDL:BCHAIN/HRATE"    "Glassnode" => "GLASSNODE:BTC_HASHRATE"    "IntoTheBlock" => "INTOTHEBLOCK:BTC_HASHRATE"HashRate = request.security(SourceE, "D", close)SignalLine = ma_functionS(HashRate, SmoothLengthS)LongLine = ma_functionL(HashRate, SmoothLengthL)plot(ma_functionS(HashRate, SmoothLengthS), "Short MA", color=color.yellow)plot(ma_functionL(HashRate, SmoothLengthL), "Long MA", color=color.blue)LongCondition = ta.crossover(SignalLine, LongLine)ShortCondition = ta.crossunder(SignalLine, LongLine)//Long Entry Conditionif LongCondition and (enableDirection == 1 or enableDirection == 0)    strategy.entry("Long", strategy.long)if LongCondition and (enableDirection == -1)    strategy.close("Short")//Short Entry conditionif ShortCondition and (enableDirection == -1 or enableDirection == 0)    strategy.entry("Short", strategy.short)if ShortCondition and (enableDirection == 1)    strategy.close("Long")