Trend
Hull Moving Average Signals: Crosses and Slope Changes
Inspect HMA crossover and slope-change rules with a Pine Script example. Distinguish reduced-lag design from a verified lead time, bounce or divergence signal.
Hull MA Signal Interpretation
Quick-reference guide to 5 signal types you will see on the chart.
| Signal Type | Indicator Condition | Market Meaning | Interpretation limits |
|---|---|---|---|
| Fast HMA crosses above slow HMA | Two configured HMAs change ordering at the completed bar | An upward relative-ordering event. | Not a measured lead over EMA or proof of a new trend. |
| Fast HMA crosses below slow HMA | The ordering changes in the other direction | A downward relative-ordering event. | The two lines can cross repeatedly without a lasting move. |
| Fast HMA slope turns positive | Current one-bar HMA change is positive after a non-positive change | A defined turn in the calculated line. | Not a forecast of a price low several bars ahead. |
| Fast HMA slope turns negative | Current one-bar change is negative after a non-negative change | The opposite turn condition. | A zero slope is treated separately, rather than automatically bearish. |
| Price near the HMA concept | Distance between price and HMA is within a chosen tolerance | A proximity measurement. | Does not prove a wick touch, bounce or confirmed swing divergence; not an alert in this example. |
Hull MA Pine Script Signal Code
Educational indicator example. Review its exact rules and compare its plots with your intended calculation in TradingView. It does not place orders or establish profitability.
Pine Script v6
//@version=6
indicator("HMA Cross and Slope Examples", overlay=true)
fastLength = input.int(9, "Fast HMA Length", minval=2)
slowLength = input.int(20, "Slow HMA Length", minval=2)
colorBySlope = input.bool(true, "Color Fast Line by Slope")
showCrosses = input.bool(true, "Show Crossover Markers")
fast = ta.hma(close, fastLength)
slow = ta.hma(close, slowLength)
slope = fast - fast[1]
upCross = ta.crossover(fast, slow)
downCross = ta.crossunder(fast, slow)
up = barstate.isconfirmed and upCross
down = barstate.isconfirmed and downCross
turnUp = barstate.isconfirmed and slope > 0 and slope[1] <= 0
turnDown = barstate.isconfirmed and slope < 0 and slope[1] >= 0
lineColor = colorBySlope ? (slope > 0 ? color.green : slope < 0 ? color.red : color.gray) : color.blue
plot(fast, "Fast HMA", color=lineColor, linewidth=2)
plot(slow, "Slow HMA", color=color.orange)
plotshape(showCrosses and up, "HMA upward cross", shape.triangleup, location.belowbar, color=color.green, size=size.small)
plotshape(showCrosses and down, "HMA downward cross", shape.triangledown, location.abovebar, color=color.red, size=size.small)
plotshape(turnUp, "HMA slope turns positive", shape.circle, location.belowbar, color=color.aqua, size=size.tiny)
plotshape(turnDown, "HMA slope turns negative", shape.circle, location.abovebar, color=color.orange, size=size.tiny)
alertcondition(up, "HMA upward cross", "Confirmed fast HMA cross above slow HMA")
alertcondition(down, "HMA downward cross", "Confirmed fast HMA cross below slow HMA")
alertcondition(turnUp, "HMA slope turns positive", "Confirmed positive fast HMA slope after a non-positive slope")
alertcondition(turnDown, "HMA slope turns negative", "Confirmed negative fast HMA slope after a non-negative slope")Example settings for Hull MA
Record the inputs used by the example. These settings are not an optimized trading recommendation.
| Parameter | Default | Description |
|---|---|---|
| Fast / Slow HMA Length | 9 / 20, examples | The example calls ta.hma for each length. It does not establish a best pair or a fixed number of bars gained over another average. |
| Color Fast Line by Slope | Enabled | This input actually controls coloring. Positive slope is green, negative red, exactly flat gray; disabled uses blue. |
| Show Crossover Markers | Enabled | Controls cross markers only. The calculations and alert conditions remain active. |
| Slope definition | Current HMA minus prior HMA | A numerical one-bar change, not the visual angle, which varies with chart scale and zoom. |
Turn the condition into an explicit rule
Specify the calculation, confirmation time, entry and exit rules before asking Pineify to draft or revise Pine Script. Review the code and simulate realistic costs before evaluating a strategy.
Explore Pine Script codingRelated Resources
Official calculation and usage references
FAQ
Hull MA Signals FAQ
How does HMA differ from an EMA?
HMA combines weighted moving averages of different lengths and another weighted smoothing stage. Its design reduces lag relative to some smoother alternatives; this does not establish a universal lead time or superior trading result.
Does ta.hma have a lookahead switch?
No. Future-data concerns arise from the surrounding implementation, such as data requests or backdated labels, rather than a lookahead argument on ta.hma. Current-bar values can still change before close.
Does the example identify pullback bounces or divergence?
No. It identifies crosses and slope turns. A close within 0.2% of a line is not necessarily a touch or bounce, and a new price extreme plus one changing HMA value is not a confirmed swing-divergence detector.
How can I compare HMA and EMA fairly?
Choose the source, lengths, event definition and evaluation period in advance. Record timing and false events as well as costs and exits; do not select only turns where one average looked earlier.
Can faster response increase false events?
A more responsive series can change its event pattern, including extra reversals. Which tradeoff is useful depends on the complete rule and later data. No numeric win rate or personal trading history is asserted.
How do I verify the line and markers?
Compare each HMA with the built-in version on the same close series. Inspect one-bar slope signs and crossover ordering at bar close, then verify saved alert configuration on new data.