OPEN-SOURCE SCRIPT
Smart HA Bias v1 [JopAlgo]

Smart HA Bias v1 (SHABV1)
First of all, we love Heikin-Ashi candlestick patterns!
That's why we created an indicator that uses this type of candlestick to create a smoothed chart.
Our SHABV1 creates smoothed Heikin-Ashi candles and measures the body strength (close-to-open) relative to current volatility. This strength is normalized to a cross-asset scale we call HABO (Heikin-Ashi Body Oscillator). We then apply an adaptive smoother that accelerates during clear trends and decelerates during choppy trends. If HABO holds a few bars above an automatic threshold, the regime (bull/bear market) is switched. A yellow regime trail runs below the price in bull markets and above the price in bear markets and serves as an exit guide.
Why this is “SMART” (vs a conventional smoothed HA)
Most HA indicators just smooth candles and color them. SHABV1 adds four edges:
Volatility-neutral strength (HABO):
HA body is divided by ATR and scaled → “+12” on BTC 4H ≈ “+12” on EURUSD 4H. Your thresholds travel across assets/TFs.
Adaptive smoothing (KAMA):
Auto reacts to market efficiency (clean trends vs chop). Less noise without delaying the real move.
Hysteresis + confirmation:
Regime changes require holding beyond ±threshold for N bars → far fewer one-bar fakes.
Regime-aware trail:
A one-way ratchet based on smoothed HA bands. In a bull it only steps up; in a bear it only steps down. Great as a soft stop/exit.
The “Auto” features (and why you can’t tweak them)
We’ve moved the “invisible knobs” into the background so you don’t babysit settings that barely show on chart:
Auto ATR length → HABO scale:
Chooses a sensible ATR window by timeframe, then fine-tunes by recent volatility. Keeps HABO comparable across symbols.
Auto KAMA (adaptive smoothing):
Sets the slow side of the adaptive filter by a noise score. Faster in trends, slower in chop—hands-free.
Auto threshold (±HABO):
Derives a dynamic threshold from the distribution of HABO on your chart, then adjusts by your Sensitivity. No more guessing “8 vs 12 vs 15”.
Auto smoothing split:
One HA Smooth slider controls both smoothing layers under the hood at a calibrated ratio.
These are not adjustable because they’re designed to keep behavior consistent and portable. The two knobs you do control have immediate, visible impact: HA Smooth (structure tightness) and Sensitivity (earlier/stricter flips).
What you can control
HA Smooth — lower = tighter/faster, higher = calmer/slower.
Sensitivity — >1.0 earlier flips, <1.0 stricter.
Confirm Bars — 1–3 (default 2). Higher = fewer whipsaws.
HTF Bias — turn Lightweight OFF and set an HTF (e.g., trade 4H, bias 1D) for top-down alignment.
Visuals — Bias Fill, Regime Trail (ON by default), Status Panel.
How to read it
Color / Regime: green = bull bias, red = bear bias (confirmed by hysteresis).
Yellow line: the Regime Trail (bull = rising floor; bear = falling ceiling).
Status Panel (top-right): Regime | HABO | Slope.
HABO > 0 = bullish pressure; < 0 = bearish.
Slope UP/DOWN = oscillator momentum direction (helps spot weakening).
Simple trading playbook
Pick TF (15m/1H/4H/1D).
(Optional) Enable HTF bias: Lightweight OFF → set HTF to the next TF up. Only take trades with HTF alignment.
Entries:
Safer: enter on confirmed regime (color flip after holding beyond threshold).
Earlier (experienced): zero-cross “early flip” only with extra confluence (VWAP/OBV/SR).
Management:
Let winners run while price respects the Trail.
Consider reduce/exit on close through the Trail or Weakening (slope turns against regime).
Tuning:
Too many flips? Raise Sensitivity↓ (<1.0) or Confirm Bars to 3.
Too late? Sensitivity↑ (>1.0) or lower HA Smooth slightly.
Quick presets (starting points)
15m: Smooth 12, Sens 1.05, Confirm 2, HTF=1H (optional)
1H: Smooth 12, Sens 1.00, Confirm 2, HTF=4H
4H: Smooth 14, Sens 1.00, Confirm 2, HTF=1D
1D: Smooth 16, Sens 0.95, Confirm 2–3, HTF=1W
Why traders like SHABV1
Portable logic: HABO + Auto threshold means fewer re-tunes switching BTC ↔ FX ↔ indices.
Chop-aware: Adaptive smoothing + hysteresis trims false flips.
Clear exits: Regime Trail turns structure into a mechanical trailing rule.
Non-repaint: HTF imports are handled with anti-lookahead; trail ratchets one way.
Notes:
This is a bias/management tool, not financial advice. Use with your own risk model (hard stop at structure or % risk).
First of all, we love Heikin-Ashi candlestick patterns!
That's why we created an indicator that uses this type of candlestick to create a smoothed chart.
Our SHABV1 creates smoothed Heikin-Ashi candles and measures the body strength (close-to-open) relative to current volatility. This strength is normalized to a cross-asset scale we call HABO (Heikin-Ashi Body Oscillator). We then apply an adaptive smoother that accelerates during clear trends and decelerates during choppy trends. If HABO holds a few bars above an automatic threshold, the regime (bull/bear market) is switched. A yellow regime trail runs below the price in bull markets and above the price in bear markets and serves as an exit guide.
Why this is “SMART” (vs a conventional smoothed HA)
Most HA indicators just smooth candles and color them. SHABV1 adds four edges:
Volatility-neutral strength (HABO):
HA body is divided by ATR and scaled → “+12” on BTC 4H ≈ “+12” on EURUSD 4H. Your thresholds travel across assets/TFs.
Adaptive smoothing (KAMA):
Auto reacts to market efficiency (clean trends vs chop). Less noise without delaying the real move.
Hysteresis + confirmation:
Regime changes require holding beyond ±threshold for N bars → far fewer one-bar fakes.
Regime-aware trail:
A one-way ratchet based on smoothed HA bands. In a bull it only steps up; in a bear it only steps down. Great as a soft stop/exit.
The “Auto” features (and why you can’t tweak them)
We’ve moved the “invisible knobs” into the background so you don’t babysit settings that barely show on chart:
Auto ATR length → HABO scale:
Chooses a sensible ATR window by timeframe, then fine-tunes by recent volatility. Keeps HABO comparable across symbols.
Auto KAMA (adaptive smoothing):
Sets the slow side of the adaptive filter by a noise score. Faster in trends, slower in chop—hands-free.
Auto threshold (±HABO):
Derives a dynamic threshold from the distribution of HABO on your chart, then adjusts by your Sensitivity. No more guessing “8 vs 12 vs 15”.
Auto smoothing split:
One HA Smooth slider controls both smoothing layers under the hood at a calibrated ratio.
These are not adjustable because they’re designed to keep behavior consistent and portable. The two knobs you do control have immediate, visible impact: HA Smooth (structure tightness) and Sensitivity (earlier/stricter flips).
What you can control
HA Smooth — lower = tighter/faster, higher = calmer/slower.
Sensitivity — >1.0 earlier flips, <1.0 stricter.
Confirm Bars — 1–3 (default 2). Higher = fewer whipsaws.
HTF Bias — turn Lightweight OFF and set an HTF (e.g., trade 4H, bias 1D) for top-down alignment.
Visuals — Bias Fill, Regime Trail (ON by default), Status Panel.
How to read it
Color / Regime: green = bull bias, red = bear bias (confirmed by hysteresis).
Yellow line: the Regime Trail (bull = rising floor; bear = falling ceiling).
Status Panel (top-right): Regime | HABO | Slope.
HABO > 0 = bullish pressure; < 0 = bearish.
Slope UP/DOWN = oscillator momentum direction (helps spot weakening).
Simple trading playbook
Pick TF (15m/1H/4H/1D).
(Optional) Enable HTF bias: Lightweight OFF → set HTF to the next TF up. Only take trades with HTF alignment.
Entries:
Safer: enter on confirmed regime (color flip after holding beyond threshold).
Earlier (experienced): zero-cross “early flip” only with extra confluence (VWAP/OBV/SR).
Management:
Let winners run while price respects the Trail.
Consider reduce/exit on close through the Trail or Weakening (slope turns against regime).
Tuning:
Too many flips? Raise Sensitivity↓ (<1.0) or Confirm Bars to 3.
Too late? Sensitivity↑ (>1.0) or lower HA Smooth slightly.
Quick presets (starting points)
15m: Smooth 12, Sens 1.05, Confirm 2, HTF=1H (optional)
1H: Smooth 12, Sens 1.00, Confirm 2, HTF=4H
4H: Smooth 14, Sens 1.00, Confirm 2, HTF=1D
1D: Smooth 16, Sens 0.95, Confirm 2–3, HTF=1W
Why traders like SHABV1
Portable logic: HABO + Auto threshold means fewer re-tunes switching BTC ↔ FX ↔ indices.
Chop-aware: Adaptive smoothing + hysteresis trims false flips.
Clear exits: Regime Trail turns structure into a mechanical trailing rule.
Non-repaint: HTF imports are handled with anti-lookahead; trail ratchets one way.
Notes:
This is a bias/management tool, not financial advice. Use with your own risk model (hard stop at structure or % risk).
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
@jopalgo | [JopAlgo] — Indicators & strategies. Clear rules, no chasing. Education only. Not financial advice.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
@jopalgo | [JopAlgo] — Indicators & strategies. Clear rules, no chasing. Education only. Not financial advice.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.