Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Hull Moving Average vs Candle

A Pine Script v4 strategy built on HMA (open, 50). 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% of equity and pays 1.00 commission. 3 settings; defaults include Hull MA Period 50, Candle Resolution D and Source of Price open.

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 Moving Average vs Candle 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 Moving Average vs Candle 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. On BTCUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
Can Hull Moving Average vs Candle be converted to Pine Script v5?
No
The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
Does Hull Moving Average vs Candle use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Hull Moving Average vs Candle run in Zeal Terminal?
Yes
It compiles in 8 ms and runs 1,000 bars in 39 ms, in the browser.

BTCUSDT · 1D · default settings

  • Candle Line
  • Hull MA Line
  • 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 (3)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$100,000$202,527Equity from $100,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.
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,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

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    Uses an argument v6 removed

    when = on line 14, 15. The upgraded version below moves each call inside an if block.

  • Note

    Uses transp =, which v5 removed line 11

    transp = on line 11, 12, 13. v5 folds the transparency into the colour with color.new(c, transp).

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 hma → ta.hma, security → request.security.
  • 2 strategy calls use the when = argument (line 14, 15). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Differs

Trades differ: 62 before, 62 after on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 5: input(type = input.integer) → input.int()
  • Line 6: input(type = input.resolution) → input.timeframe()
  • Line 7: input(type = input.source) → input.source()
  • Line 8: hma → ta.hma
  • Line 9: security → request.security
3 more edits
  • Line 11: transp = 50 → color.new(change_color, 50)
  • Line 12: transp = 50 → color.new(change_color, 50)
  • Line 13: transp = 50 → color.new(change_color, 50)
⋯// © SeaSide420. Any timeFrame/pair , Hull Moving Average vs Candle-//@version=4+//@version=5strategy("Hull Moving Average vs Candle",shorttitle="HMA-vs-Candle",overlay=true,default_qty_type=strategy.percent_of_equity,default_qty_value=100,commission_type=strategy.commission.cash_per_order,commission_value=1.00,slippage=1)-Period=input(title="Hull MA Period",type=input.integer,defval=50,minval=1)+Period=input.int(title="Hull MA Period",defval=50,minval=1)-Resolution=input(title="Candle Resolution", type=input.resolution,defval="D")+Resolution=input.timeframe(title="Candle Resolution",defval="D")-Price=input(title="Source of Price",type=input.source,defval=open)+Price=input.source(title="Source of Price",defval=open)-HMA=hma(Price,Period)+HMA=ta.hma(Price,Period)-Candle=security(syminfo.tickerid,Resolution,Price,barmerge.gaps_off,barmerge.lookahead_off)+Candle=request.security(syminfo.tickerid,Resolution,Price,barmerge.gaps_off,barmerge.lookahead_off)change_color=HMA>Candle?color.green:color.red-plot1=plot(Candle,color=change_color,title="Candle Line",linewidth=2,transp=50)+plot1=plot(Candle,color=color.new(change_color, 50),title="Candle Line",linewidth=2)-plot2=plot(HMA[1],color=change_color,title="Hull MA Line",linewidth=2,transp=50)+plot2=plot(HMA[1],color=color.new(change_color, 50),title="Hull MA Line",linewidth=2)-fill(plot1,plot2,color=change_color,transp=50)+fill(plot1,plot2,color=color.new(change_color, 50))strategy.close("BUY",when=Price<HMA and HMA<Candle,comment="close buy entry")⋯

Clean v5

Verified

Same 62 trades and the same P&L on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine.

  • Line 14: when = Price<HMA and HMA<Candle → if block
  • Line 15: when = Price>HMA and HMA>Candle → if block
⋯fill(plot1,plot2,color=color.new(change_color, 50))-strategy.close("BUY",when=Price<HMA and HMA<Candle,comment="close buy entry")+if Price<HMA and HMA<Candle+    strategy.close("BUY",comment="close buy entry")-strategy.close("SELL",when=Price>HMA and HMA>Candle,comment="close sell entry")+if Price>HMA and HMA>Candle+    strategy.close("SELL",comment="close sell entry")if (Price>HMA and HMA>Candle and Price>Price[1])⋯

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: 62 before, 98 after on BTCUSDT 4h, 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.

⋯// © SeaSide420. Any timeFrame/pair , Hull Moving Average vs Candle-//@version=5+//@version=6strategy("Hull Moving Average vs Candle",shorttitle="HMA-vs-Candle",overlay=true,default_qty_type=strategy.percent_of_equity,default_qty_value=100,commission_type=strategy.commission.cash_per_order,commission_value=1.00,slippage=1)⋯

Settings

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

SettingDefaultType and rangeFeeds
Hull MA Period50int (written input.integer) · min 1HMA
Candle ResolutionDtimeframe (written input.resolution)Candle
Source of PriceopensourceHMA Candle entry BUY entry SELL close BUY close SELL line 16 line 18

What it calculates

  • HMA (hma, ta.hma in v5)Source of Price (open), Hull MA Period (50)HMA · line 8

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.

openopenprice dataPeriodHull MA Periodsetting · 50ResolutionCandle Resolutionsetting · DHMAHMA→ HMACandleCandlevaluechange_colorColourchange_colorclose:BUYClose BUYstrategy.closeclose:SELLClose SELLstrategy.closeentry:BUYOpen BUYstrategy.entryentry:SELLOpen SELLstrategy.entryplot:11Candle Lineplotplot:12Hull MA Lineplotfill:13Fillfill

Order rules

OrderFires whenBy defaultLine
Close BUYPrice<HMA and HMA<CandleOn14
Close SELLPrice>HMA and HMA>CandleOn15
Open BUY long(Price>HMA and HMA>Candle and Price>Price[1])On17
Open SELL short(Price<HMA and HMA<Candle and Price<Price[1])On19

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 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 4h+11.6%+5.5%6234%1.1517.2%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+24.0%+8.4%6439%1.2518.5%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+33.6%+21.5%5439%1.3224.7%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+38.0%+17.1%5944%1.5810.8%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 Moving Average vs Candle this page—v4 strategy0.0%00.0%
Hull Crossover Strategy no TP or SL by Tuned_Officialhmav4 strategy+65.5%2527.7%
Advanced OutSide with HMA and Klinger Forex Swing strategy by exlux99hmav4 strategy−1.3%495.3%
VOLLY PRICE CONVERGE by Celarhmav5 strategy+41.2%7522.4%
DMI + HMA - No Risk Management by Tuned_Officialhmav4 strategy−1.4%228.8%
Hull Kaufman SuperTrend Cloud (HKST Cloud) by SnarkyPuppyhmav5 strategy−11.8%3535.4%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 8 msYes 1,000 bars in 39 msNot measured
PineTSNo v5 and v6 only—Not 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. 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/// © SeaSide420. Any timeFrame/pair , Hull Moving Average vs Candle//@version=4strategy("Hull Moving Average vs Candle",shorttitle="HMA-vs-Candle",overlay=true,default_qty_type=strategy.percent_of_equity,default_qty_value=100,commission_type=strategy.commission.cash_per_order,commission_value=1.00,slippage=1)Period=input(title="Hull MA Period",type=input.integer,defval=50,minval=1)Resolution=input(title="Candle Resolution", type=input.resolution,defval="D")Price=input(title="Source of Price",type=input.source,defval=open)HMA=hma(Price,Period)Candle=security(syminfo.tickerid,Resolution,Price,barmerge.gaps_off,barmerge.lookahead_off)change_color=HMA>Candle?color.green:color.redplot1=plot(Candle,color=change_color,title="Candle Line",linewidth=2,transp=50)plot2=plot(HMA[1],color=change_color,title="Hull MA Line",linewidth=2,transp=50)fill(plot1,plot2,color=change_color,transp=50)strategy.close("BUY",when=Price<HMA and HMA<Candle,comment="close buy entry")strategy.close("SELL",when=Price>HMA and HMA>Candle,comment="close sell entry")if (Price>HMA and HMA>Candle and Price>Price[1])    strategy.entry("BUY",strategy.long)if (Price<HMA and HMA<Candle and Price<Price[1])    strategy.entry("SELL",strategy.short)//                                                                   /L'-, //                               ,'-.           /MM . .             /  L '-, //     .                    _,--dMMMM\         /MMM  `..           /       '-, //     :             _,--,  )MMMMMMMMM),.      `QMM   ,<>         /_      '-,' //     ;     ___,--. \MM(    `-'   )M//MM\       `  ,',.;      .-'* ;     .' //     |     \MMMMMM) \MM\       ,dM//MMM/     ___ < ,; `.      )`--'    / //     |      \MM()M   MMM)__   /MM(/MP'  ___, \  \ `  `. `.   /__,    ,' //     |       MMMM/   MMMMMM( /MMMMP'__, \     | /      `. `-,_\     / //     |       MM     /MMM---' `--'_ \     |-'  |/         `./ .\----.___ //     |      /MM'   `--' __,-  \""   |-'  |_,               `.__) . .F. )-. //     |     `--'       \   \    |-'  |_,     _,-/            J . . . J-'-. `-., //     |         __  \`. |   |   |         \    / _           |. . . . \   `-.  F //     |   ___  /  \  | `|   '      __  \   |  /-'            F . . . . \     '` //     |   \  \ \  /  |        __  /  \  |  |,-'        __,- J . . . . . \ //     |    | /  |/     __,-  \  ) \  /  |_,-     __,--'     |. .__.----,' //     |    |/    ___     \    |'.  |/      __,--'           `.-;;;;;;;;;\ //     |     ___  \  \     |   |  `   __,--'                  /;;;;;;;;;;;;. //     |     \  \  |-'\    '    __,--'                       /;;;;;;;;;;;;;;\ // \   |      | /  |      __,--'                             `--;;/     \;-'\ //  \  |      |/    __,--'                                   /  /         \  \ //   \ |      __,--'                                        /  /           \  \ //    \|__,--'                                          _,-;M-K,           ,;-;\ //                                                     <;;;;;;;;           '-;;;; //                                                                                        ~ priceless artwork by SeaSide420