Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Hull MA TimeFrame CrossOver

A Pine Script v5 strategy built on ATR (14) and Crossover (ma, xATRTrailingStop). It has 7 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% of equity and pays 0.1% commission. 11 settings; defaults include Candle X Resolution D, Source of Price open and Moving Average Type HMA.

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 Hull MA TimeFrame CrossOver repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Hull MA TimeFrame CrossOver 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 Hull MA TimeFrame CrossOver 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 Hull MA TimeFrame CrossOver use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Hull MA TimeFrame CrossOver run in Zeal Terminal?
Yes
It compiles in 28 ms and runs 1,000 bars in 79 ms, in the browser.

BTCUSDT · 1D · default settings

  • C_X
  • ATR SL
  • 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 (11)
50,000100,000150,000AprJulOct2025AprJulOct2026AprJulOct$1$2Equity from $1
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.
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 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

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • 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 60, 61, 62, 63, 65. 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
Candle X ResolutionSelect Time Frame for Candle crossover (close>close[1]=buy else sell)DtimeframeD1
Source of PriceRecommended to use OPEN as source to avoid repainting (OPEN is a set value each candle, where as a CLOSE value changes with each tick for the duration of the candle)opensourcema ma0 ma1 ma2 D1 xATRTrailingStop iff_1 iff_2 pos iff_3 clr1 line 31 line 32 line 33 line 34 line 35 close_all
Moving Average TypeSelect type of Moving AverageHMAstring · options ["ALMA", "SMA", "EMA", "WMA", "HMA"]line 30
Moving Average PeriodAmount of candles back to use with calculation1000int · min 3ma ma1 ma2 line 31 line 32 line 33 line 34 line 35
ATR sensitivityBasicly, adjusts ATR SL distance from candles14floatnLoss
ATR PeriodAmount of candles back to use with calculation14intxATR
Take Profit (%)Close order when user set % in Profit1000intTP
StopLoss (%)Close order when user set % in Loss1000intSL
Use ATR SL?If selected, StopLoss will be the ATR linefalseboolclose_all line 64
Allow Buy?If selected, Buying is allowedtrueboolentry buy line 66
Allow Sell?If selected, Selling is allowedtrueboolentry sell line 68

What it calculates

  • ATRATR Period (14)xATR · line 41
  • Crossoverma, xATRTrailingStopabove · line 50
  • CrossoverxATRTrailingStop, mabelow · line 51

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.

high · low · closehigh · low · closeprice dataatrperiodATR Periodsetting · 14TakeProfitTake Profit (%)setting · 1000StopLossStopLoss (%)setting · 1000openopenprice dataMA_PeriodMoving Average Periodsetting · 1000resCandle X Resolutionsetting · DatrsensATR sensitivitysetting · 14xATRATR→ xATRaboveCrossover→ abovebelowCrossover→ belowbalancebalancevalueTPTPvalueSLSLvaluema, ma1, ma2ma · ma1 +13 valuesma0ma0valueD1D1valuenLossnLossvaluexATRTrailingStopxATRTrailingStopvalueiff_1iff_1valueiff_2iff_2valueposposvalueiff_3iff_3valuelongConditionlongConditionconditionshortConditionshortConditionconditionclr1, clr2Colourclr1 · clr2close:buyClose buystrategy.closeclose:sellClose sellstrategy.closeclose_all:close_all strategy.close_allentry:buyOpen buystrategy.entryentry:sellOpen sellstrategy.entryplot:56label.style_crossplotplot:57label.style_crossplotplot:58C_Xplotplot:59ATR SLplot

Order rules

OrderFires whenBy defaultLine
Close buystrategy.openprofit > TPOn60
Close buystrategy.openprofit < SLOn61
Close sellstrategy.openprofit > TPOn62
Close sellstrategy.openprofit < SLOn63
Close (price > xATRTrailingStop and above) or (price < xATRTrailingStop and below)Off “Use ATR SL?”65
Open buy longAllowBuy and longCondition and aboveOn67
Open sell shortAllowSell and shortCondition and belowOn69

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

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 1D0.0%+102.5%00%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—0.0%8 May 2026 – 21 Oct 2026

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

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
Hull MA TimeFrame CrossOver this page—v5 strategy0.0%00.0%
SOJA PIVOT by ParaBellum68atrv4 strategy+3.3%918.2%
Volatility System by EduardoMattjeatrv5 strategy+150.2%221.5%
ATR Stop Buy Strategy by phobo3satrv4 strategyNo trades on this market
VBand Strategy by Saravanan_Ragavanatrv4 strategyNo trades on this market
Volatility Breakout Strategy [Angel Algo] by AngelAlgoatrv5 strategy+3.1%183.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.

  • 5 strategy calls use the when = argument (line 60, 61, 62, 63, 65). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 3 settings use the untyped input() (line 15, 20, 21). 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 15: input() → input.source()
  • Line 20: input() → input.int()
  • Line 21: input() → input.int()
  • Line 60: when = strategy.openprofit > TP → if block
  • Line 61: when = strategy.openprofit < SL → if block
  • Line 62: when = strategy.openprofit > TP → if block
  • Line 63: when = strategy.openprofit < SL → if block
  • Line 65: when = (price > xATRTrailingStop and above) or (price < xATRTrailingStop and below) → if block
⋯res = input.timeframe(title='Candle X Resolution', defval='D', tooltip=stfu)-price = input(title='Source of Price', defval=open, tooltip=ptt)+price = input.source(title='Source of Price', defval=open, tooltip=ptt)smoothing = input.string(title="Moving Average Type", defval="HMA", options=["ALMA", "SMA", "EMA", "WMA", "HMA"], tooltip=masmthng)⋯atrperiod = input.int(14, title='ATR Period', tooltip = prdtt)-TakeProfit = input(title='Take Profit (%)', defval=1000, tooltip=tph)+TakeProfit = input.int(title='Take Profit (%)', defval=1000, tooltip=tph)-StopLoss = input(title='StopLoss (%)', defval=1000, tooltip=slh)+StopLoss = input.int(title='StopLoss (%)', defval=1000, tooltip=slh)uatrh = "If selected, StopLoss will be the ATR line"⋯plot(xATRTrailingStop, color=color.black, title='ATR SL', linewidth=3)-strategy.close('buy', when=strategy.openprofit > TP, comment='buy TP',alert_message='buy TP')+if strategy.openprofit > TP+    strategy.close('buy', comment='buy TP',alert_message='buy TP')-strategy.close('buy', when=strategy.openprofit < SL, comment='buy SL',alert_message='buy SL')+if strategy.openprofit < SL+    strategy.close('buy', comment='buy SL',alert_message='buy SL')-strategy.close('sell', when=strategy.openprofit > TP, comment='sell TP',alert_message='sell TP')+if strategy.openprofit > TP+    strategy.close('sell', comment='sell TP',alert_message='sell TP')-strategy.close('sell', when=strategy.openprofit < SL, comment='sell SL',alert_message='sell SL')+if strategy.openprofit < SL+    strategy.close('sell', comment='sell SL',alert_message='sell SL')if UseATRSL-    strategy.close_all(when=(price > xATRTrailingStop and above) or (price < xATRTrailingStop and below), comment='ATR SL',alert_message='ATR SL') +    if (price > xATRTrailingStop and above) or (price < xATRTrailingStop and below)+        strategy.close_all(comment='ATR SL',alert_message='ATR SL') if AllowBuy and longCondition and above⋯

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.

⋯//             © @SeaSide420-//@version=5+//@version=6strategy('HullTimeFrameCrossOver', shorttitle='H&TF', overlay=true, currency="BTC",initial_capital=1, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_value=0.1, commission_type=strategy.commission.percent)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 28 msYes 1,000 bars in 79 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///             © @SeaSide420//@version=5strategy('HullTimeFrameCrossOver', shorttitle='H&TF', overlay=true, currency="BTC",initial_capital=1, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_value=0.1, commission_type=strategy.commission.percent)stfu = "Select Time Frame for Candle crossover (close>close[1]=buy else sell)"ptt = "Recommended to use OPEN as source to avoid repainting (OPEN is a set value each candle, where as a CLOSE value changes with each tick for the duration of the candle)"masmthng = "Select type of Moving Average"prdtt = "Amount of candles back to use with calculation"atrsnstt = "Basicly, adjusts ATR SL distance from candles"tph = "Close order when user set % in Profit"slh = "Close order when user set % in Loss"btt = "If selected, Buying is allowed"stt = "If selected, Selling is allowed"res = input.timeframe(title='Candle X Resolution', defval='D', tooltip=stfu)price = input(title='Source of Price', defval=open, tooltip=ptt)smoothing = input.string(title="Moving Average Type", defval="HMA", options=["ALMA", "SMA", "EMA", "WMA", "HMA"], tooltip=masmthng)MA_Period = input.int(title='Moving Average Period', defval=1000, minval=3, tooltip = prdtt)atrsens = input.float(14, title='ATR sensitivity',tooltip=atrsnstt)atrperiod = input.int(14, title='ATR Period', tooltip = prdtt)TakeProfit = input(title='Take Profit (%)', defval=1000, tooltip=tph)StopLoss = input(title='StopLoss (%)', defval=1000, tooltip=slh)uatrh = "If selected, StopLoss will be the ATR line"UseATRSL = input.bool(defval=false, title='Use ATR SL?', tooltip=uatrh)AllowBuy = input.bool(defval=true, title='Allow Buy?', tooltip=btt)AllowSell = input.bool(defval=true, title='Allow Sell?', tooltip=stt)balance = strategy.initial_capital + strategy.netprofitTP = TakeProfit / 100 * balanceSL = StopLoss / 100 * balance - StopLoss / 100 * balance * 2ma_function(price, MA_Period) =>    switch smoothing        "ALMA" => ta.alma(price, MA_Period, 0.85, 6)        "SMA" => ta.sma(price, MA_Period)        "EMA" => ta.ema(price, MA_Period)        "WMA" => ta.wma(price, MA_Period)        => ta.hma(price, MA_Period)ma = ma_function(price, MA_Period)ma0 = ma_function(price, 2)ma1 = ma_function(price, MA_Period)ma2 = ma_function(price[1], MA_Period)D1 = request.security(syminfo.tickerid, res, price, barmerge.gaps_off, barmerge.lookahead_off)xATR = ta.atr(atrperiod)nLoss = atrsens * xATRxATRTrailingStop = 0.0iff_1 = price > nz(xATRTrailingStop[1], 0) ? price - nLoss : price + nLossiff_2 = price < nz(xATRTrailingStop[1], 0) and price[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), price + nLoss) : iff_1xATRTrailingStop := price > nz(xATRTrailingStop[1], 0) and price[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), price - nLoss) : iff_2pos = 0iff_3 = price[1] > nz(xATRTrailingStop[1], 0) and price < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0)pos := price[1] < nz(xATRTrailingStop[1], 0) and price > nz(xATRTrailingStop[1], 0) ? 1 : iff_3above = ta.crossover(ma, xATRTrailingStop)below = ta.crossover(xATRTrailingStop, ma)longCondition = ma1 > ma2 and ma0 > D1 and ma0 > ma1shortCondition = ma1 < ma2 and ma0 < D1 and ma0 < ma1clr1 = price > D1 ? color.green : color.redclr2 = ma1 > ma2 ? color.red : color.greenplot(ta.cross(ma1, ma2) ? ma1 : na, label.style_cross, color=clr2, linewidth=3)plot(ta.cross(ma1, D1) ? ma1 : na, label.style_cross, color=clr1, linewidth=3)plot(D1, color=clr1, title='C_X', linewidth=2)plot(xATRTrailingStop, color=color.black, title='ATR SL', linewidth=3)strategy.close('buy', when=strategy.openprofit > TP, comment='buy TP',alert_message='buy TP')strategy.close('buy', when=strategy.openprofit < SL, comment='buy SL',alert_message='buy SL')strategy.close('sell', when=strategy.openprofit > TP, comment='sell TP',alert_message='sell TP')strategy.close('sell', when=strategy.openprofit < SL, comment='sell SL',alert_message='sell SL')if UseATRSL    strategy.close_all(when=(price > xATRTrailingStop and above) or (price < xATRTrailingStop and below), comment='ATR SL',alert_message='ATR SL') if AllowBuy and longCondition and above    strategy.entry('buy', strategy.long,comment='buy',alert_message='buy')if AllowSell and shortCondition and below    strategy.entry('sell', strategy.short,comment='sell',alert_message='sell')