OPEN-SOURCE SCRIPT

Scalping Smoothed Heikin Ashi with EMA Crossover[JAYADEV RANA]

1 548
Short summary

This overlay plots double-smoothed Heikin Ashi candles (EMA-smoothed inputs, then EMA-smoothed HA outputs) to reduce noise and make short-term direction changes easier to see. It also includes a standard fast/slow EMA pair for crossover confirmation. Signals are provided for HA color flips and EMA crossovers, with optional EMA plotting and alert conditions for all events.

Full description

Overview
This script is a scalping-oriented visual overlay that combines two views of momentum:

Smoothed Heikin Ashi candles to clarify candle structure and reduce choppiness, and
EMA crossovers on the standard close for a secondary trend/confirmation layer.

The indicator is designed to help you read short-term regime changes quickly without relying on raw candles alone.

How to use

Primary read (Smoothed HA candles):
Bullish candles: shaClose > shaOpen (colored with the Bullish Color).
Bearish candles: shaClose < shaOpen (colored with the Bearish Color).
A triangle prints when the candle state flips:
Up triangle below bar on bullish flip
Down triangle above bar on bearish flip
Confirmation read (EMA crossovers):
“Gold Cross”: fast EMA crosses above slow EMA
“Death Cross”: fast EMA crosses below slow EMA
EMAs can be toggled on/off via Show EMAs.

A common workflow is to treat the HA color flip as the timing trigger and use the EMA crossover as trend confirmation (or to filter trades in choppy sessions). Alternatively, you can invert that: use EMA trend as the regime and take only HA flips that align with it.

Method details
Smoothed Heikin Ashi pipeline (two-stage smoothing):

Pre-smooth raw OHLC using EMA with Pre-Smoothing Period.
Compute Heikin Ashi from the smoothed OHLC:
HA close is the average of smoothed OHLC
HA open is recursively smoothed using prior HA values
HA high/low are derived from smoothed extremes and HA open/close
Post-smooth HA OHLC again using EMA with Post-Smoothing Period.
Plot candles using the post-smoothed HA values.

EMA crossover layer:

Fast EMA = EMA(close, Fast EMA Length)
Slow EMA = EMA(close, Slow EMA Length)
Crossovers are detected with ta.crossover() / ta.crossunder().

Signals & alerts

HA bullish change: Smoothed HA flips from bearish to bullish
HA bearish change: Smoothed HA flips from bullish to bearish
EMA bullish cross: fast EMA crosses above slow EMA
EMA bearish cross: fast EMA crosses below slow EMA
All four have built-in alertcondition() entries.

Settings

Pre-Smoothing Period: How much to smooth the raw OHLC before HA is computed.
Higher = smoother, fewer flips, more lag.
Post-Smoothing Period: How much to smooth the HA candles after computation.
Higher = cleaner candle blocks, more lag.
Fast / Slow EMA Lengths: Controls crossover sensitivity.
Wider gap (e.g., 10/30) = slower but fewer crosses.
Tighter gap (e.g., 9/18) = faster but more noise.
Style: Bull/Bear colors + EMA visibility toggle.

Limitations / caveats

Smoothed HA is intentionally lagging compared to raw candles; it’s built to reduce noise, not to predict turns early.
In ranging markets, both HA flips and EMA crossovers can whipsaw. Consider additional context (structure, session, volatility) or higher timeframe bias.
Alerts can trigger intrabar in real time and may differ from the final closed-bar state (standard TradingView behavior).
Screenshot prompt pack
Trend session example: A clean directional move on a lower timeframe (e.g., 5m/15m) showing extended same-color Smoothed HA candles with a supportive EMA alignment.
Flip + confirmation example: A sequence where HA flips bullish and the EMA gold cross happens shortly after; annotate as “trigger + confirmation.”
Chop warning example: A sideways segment where HA flips multiple times and EMAs cross back and forth; caption as a limitation (range whipsaw).
Sensitivity comparison: Same symbol/timeframe with (a) low smoothing periods and (b) higher smoothing periods to show the lag vs noise tradeoff.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.