Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Crypto BTC Correlation Scalper Gaps Strategy

A Pine Script v5 strategy built on Lowest (def_low, 50) and Highest (def_high, 50). It has 8 order rules, 4 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 6 settings; defaults include Ex symbol CME:BTC1!, Daily sma 1 and Length for Checking Highest High/Lowest Low Points 50.

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 Crypto BTC Correlation Scalper Gaps Strategy repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Crypto BTC Correlation Scalper Gaps Strategy 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 Crypto BTC Correlation Scalper Gaps Strategy run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L37:C0: a 'bool' cannot be 'na' in Pine Script v6 — declare it as true or false. The v6 version is shown for reference and is not offered as a download.
Does Crypto BTC Correlation Scalper Gaps Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Crypto BTC Correlation Scalper Gaps Strategy run in Zeal Terminal?
Yes
It compiles in 23 ms and runs 1,000 bars in 34 ms, in the browser.

BTCUSDT · 1D · default settings

  • Lowest
  • Highest
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,000,000$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. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference. 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 CME:BTC1! D, which this page cannot load in your browser.

Needs CME:BTC1! 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, $1,000,000 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

    2 settings have no label

    In the settings dialog ex_symbol (line 6), daily_sma (line 20) show an empty name. The labels on this page come from the variable names.

  • 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 77, 78, 80, 81, 83, 84, 86, 87. The upgraded version below moves each call inside an if block.

Settings

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

SettingDefaultType and rangeFeeds
Inverse Mode / Long = Short or Long = Longfalseboolentry long close long entry short close short entry long close long entry short close short line 76 line 82
Ex symbol (no label in the script)CME:BTC1!symbolex_high ex_low ex_open ex_close daily_sma
Correlation Candlestruebooldef_high def_low def_open def_close
Daily sma (no label in the script)1intlong short
Length for Checking Highest High/Lowest Low Points50intlowest_low highest_high
Minimal Deviation (%)30.0float · min 1 · max 100isGapDown isGapUp

What it calculates

  • Lowestdef_low, Length for Checking Highest High/Lowest Low Points (50)lowest_low · line 29
  • Highestdef_high, Length for Checking Highest High/Lowest Low Points (50)highest_high · line 30

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.

legnth_tp_slLength for Checking Hig…setting · 50highhighprice dataex_symbolEx symbolsetting · CME:BTC1!lowlowprice dataopenopenprice dataclosecloseprice datatimetimeprice dataminimalDeviationInputMinimal Deviation (%)setting · 30.0daily_smaDaily smasetting · 1lowest_lowLowest→ lowest_lowhighest_highHighest→ highest_highex_highex_highvalueex_lowex_lowvalueex_openex_openvalueex_closeex_closevaluedef_highdef_highvaluedef_lowdef_lowvaluedef_opendef_openvaluedef_closedef_closevaluetimeOfBuyLong, timeOfBuyShorttimeOfBuyLong · timeOfB…2 valueslowest_low_var_tplowest_low_var_tpvaluelowest_low_var_sllowest_low_var_slvaluehighest_high_var_tphighest_high_var_tpvaluehighest_high_var_slhighest_high_var_slvaluelongEntrylongEntryconditionlongExitlongExitconditionshortEntryshortEntryconditionshortExitshortExitconditionisGapDown, isGapUp, isGapisGapDown · isGapUp +13 conditionslonglongconditionshortshortconditionlongExitSignallongExitSignalconditionshortExitSignalshortExitSignalconditionentry:longOpen longstrategy.entryclose:longClose longstrategy.closeentry:shortOpen shortstrategy.entryclose:shortClose shortstrategy.close

Order rules

OrderFires whenBy defaultLine
Open long shortlongEntrylong and not longOpenedOn77
Close longlongExitlongOpened[1] and longExitSignalOn78
Open short longshortEntryshort and not shortOpenedOn80
Close shortshortExitshortOpened[1] and shortExitSignalOn81
Open long longlongEntrylong and not longOpenedOn83
Close longlongExitlongOpened[1] and longExitSignalOn84
Open short shortshortEntryshort and not shortOpenedOn86
Close shortshortExitshortOpened[1] and shortExitSignalOn87

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 data6 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 CME:BTC1! D, and that data is not available here (not a Binance spot market). Its results would rest on empty values.

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
Crypto BTC Correlation Scalper Gaps Strategy this page—v5 strategy0.0%00.0%
Alex Days HiLo Rajib by 14rajibhighest lowestv4 strategyNo trades on this market
Donchian Strat EXMO by pskoroplashighest lowestv4 strategy+12.1%2268.0%
Average Highest High and Lowest Low Swinger Strategy by exlux99lowest highestv4 strategy+6.4%2049.6%
Highest High and Lowest Low Channel Strategy by ceyhunhighest lowestv5 strategy−3.7%267.9%
Donchian Channels System [racer8] by racer8highest lowestv4 strategy−3.2%3643.6%

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.

  • 8 strategy calls use the when = argument (line 77, 78, 80, 81, 83, 84, 86, 87). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 2 settings use the untyped input() (line 20, 22). 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 20: input() → input.int()
  • Line 22: input() → input.int()
  • Line 77: when = longEntry → if block
  • Line 78: when = longExit → if block
  • Line 80: when = shortEntry → if block
  • Line 81: when = shortExit → if block
4 more edits
  • Line 83: when = longEntry → if block
  • Line 84: when = longExit → if block
  • Line 86: when = shortEntry → if block
  • Line 87: when = shortExit → if block
⋯def_close := apply_correlation? ex_close : close-daily_sma = request.security(ex_symbol, "D", ta.sma(request.security(ex_symbol, "D", close), input(1)))+daily_sma = request.security(ex_symbol, "D", ta.sma(request.security(ex_symbol, "D", close), input.int(1)))//plot(daily_sma)-legnth_tp_sl = input(50, title="Length for Checking Highest High/Lowest Low Points")+legnth_tp_sl = input.int(50, title="Length for Checking Highest High/Lowest Low Points")minimalDeviationInput = nz(input.float(30.0, "Minimal Deviation (%)", minval=1, maxval=100) / 100 * ta.sma(def_high-def_low, 14))⋯if(inverse)-    strategy.entry("long",strategy.short,when=longEntry)+    if longEntry+        strategy.entry("long",strategy.short)-    strategy.close("long",when=longExit)+    if longExit+        strategy.close("long")    -    strategy.entry("short",strategy.long,when=shortEntry)+    if shortEntry+        strategy.entry("short",strategy.long)-    strategy.close("short",when=shortExit)+    if shortExit+        strategy.close("short")if(not inverse)-    strategy.entry("long",strategy.long,when=longEntry)+    if longEntry+        strategy.entry("long",strategy.long)-    strategy.close("long",when=longExit)+    if longExit+        strategy.close("long")    -    strategy.entry("short",strategy.short,when=shortEntry)+    if shortEntry+        strategy.entry("short",strategy.short)-    strategy.close("short",when=shortExit)+    if shortExit+        strategy.close("short")

Does it run in Pine Script v6?

No

The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L37:C0: a 'bool' cannot be 'na' in Pine Script v6 — declare it as true or false. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © exlux99-//@version=5+//@version=6strategy("Crypto BTC Correlation Scalper Gaps Strategy", overlay = true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 23 msWith a workaround 1,000 bars in 34 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.

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.

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/// © exlux99//@version=5strategy("Crypto BTC Correlation Scalper Gaps Strategy", overlay = true)inverse=input.bool(false, title="Inverse Mode / Long = Short or Long = Long")ex_symbol = input.symbol("CME:BTC1!")ex_high = request.security(ex_symbol, timeframe.period,high)ex_low = request.security(ex_symbol, timeframe.period,low)ex_open = request.security(ex_symbol, timeframe.period,open)ex_close = request.security(ex_symbol, timeframe.period,close)apply_correlation = input.bool(true, title="Correlation Candles")def_high = 0.0def_low =0.0def_open =0.0def_close =0.0def_high := apply_correlation? ex_high : highdef_low := apply_correlation? ex_low : lowdef_open := apply_correlation? ex_open : opendef_close := apply_correlation? ex_close : closedaily_sma = request.security(ex_symbol, "D", ta.sma(request.security(ex_symbol, "D", close), input(1)))//plot(daily_sma)legnth_tp_sl = input(50, title="Length for Checking Highest High/Lowest Low Points")minimalDeviationInput = nz(input.float(30.0, "Minimal Deviation (%)", minval=1, maxval=100) / 100 * ta.sma(def_high-def_low, 14))// Detect gaps.isGapDown = def_high < def_low[1] and def_low[1] - def_high >= minimalDeviationInputisGapUp = def_low > def_high[1] and def_low - def_high[1] >= minimalDeviationInputisGap = isGapDown or isGapUpisGapClosed = falselowest_low=ta.lowest(def_low, legnth_tp_sl)highest_high=ta.highest(def_high, legnth_tp_sl)long = isGapUp and def_close > daily_smashort = isGapDown and def_close < daily_smavar longOpened = falsevar int timeOfBuyLong = navar float lowest_low_var_tp = navar float lowest_low_var_sl = navar bool longEntry = nalongEntry := long and not longOpened if longEntry    longOpened := true    timeOfBuyLong := time    lowest_low_var_tp := def_close * (1 + ((def_close / lowest_low) -1))    lowest_low_var_sl := lowest_lowlongExitSignal = short or  def_high > lowest_low_var_tp //or def_low < lowest_low_var_sllongExit = longOpened[1] and longExitSignalif longExit     longOpened := false    timeOfBuyLong := na    lowest_low_var_tp:=na    lowest_low_var_sl :=na     //-------------------------------------------------------------------------------var shortOpened = falsevar int timeOfBuyShort = navar float highest_high_var_tp = navar float highest_high_var_sl = navar bool shortEntry = nashortEntry := short and not shortOpened  if shortEntry    shortOpened := true    timeOfBuyShort := time    timeOfBuyShort    highest_high_var_tp := def_close * (1 - ((highest_high / def_close) - 1  ))    highest_high_var_sl := highest_high shortExitSignal = long  or  def_low < highest_high_var_tp //or def_high > highest_high_var_slshortExit = shortOpened[1] and shortExitSignal if shortExit      shortOpened := false    timeOfBuyShort := na    highest_high_var_tp := na    highest_high_var_sl := na    if(inverse)    strategy.entry("long",strategy.short,when=longEntry)    strategy.close("long",when=longExit)        strategy.entry("short",strategy.long,when=shortEntry)    strategy.close("short",when=shortExit)if(not inverse)    strategy.entry("long",strategy.long,when=longEntry)    strategy.close("long",when=longExit)        strategy.entry("short",strategy.short,when=shortEntry)    strategy.close("short",when=shortExit)