OPEN-SOURCE SCRIPT

Heikin Ashi Lag Meter [BSL]

233
Heikin Ashi candles look clean because they arrive late.

That is not a criticism, it is arithmetic: the transform averages, and
averaging costs time. Heikin Ashi Lag Meter [BSL] puts a number on the cost,
every single time the colour changes.

WHAT THE BOX IS

Your chart keeps its real candles. Only their colour comes from the Heikin
Ashi state, so you see the smoothing and the actual prices together instead of
choosing between them.

When the state flips, the script draws a box. It starts at the closing extreme
of the leg that just ended and runs to the bar the colour actually changed on.

That box is the part of the move that had already happened before the signal
appeared. It is what you would have missed if you had waited for the colour.

Its border is dashed, and that is deliberate. The box could only be drawn once
the flip had happened. It is a reconstruction taken backwards, not something
that was visible while the move was running. A solid border would suggest a
live region. The dashed one says: this was worked out afterwards.

READING THE NUMBER

The panel reports the median box length in bars, beside the number of flips
that median was taken over.

The smallest number it can ever report is 1. A flip is detected on the bar the
state changes, and the earliest a leg's extreme can sit is the bar before
that. So a reading of one bar means the transform was as fast as it is capable
of being: not that it was instant.

WHEN THERE IS NO NUMBER

Below the minimum flip count there is no median at all. The panel prints how
many flips it has and says so, rather than presenting the middle of three
observations as a typical value.

The leg still in progress gets no box and is not measured. Its extreme can
still move, and a box drawn over an unfinished leg would be measuring a guess.

You can cap how many boxes stay on the chart, and that cap changes what is
DRAWN and never what is COUNTED. The panel reports the full flip count beside
the number of boxes surviving the cap, so the gap between them is visible
rather than something you have to suspect.

CONTROLS

- Minimum flips before a median is shown: 5
- Keep this many lag boxes: 50
- Draw the lag regions: on
- Colour the real candles by Heikin Ashi state: on
- Panel detail: Compact
- Panel position: Bottom center

Six positions are offered. Bottom center is the default for a practical reason:
this script is meant to be read next to others, the right side is where they all
try to sit, and both left corners already have the platform's own furniture in
them.

IT WILL NOT RUN ON A HEIKIN ASHI CHART

This is the one refusal in the family with a reason that goes beyond good
practice.

The script computes the Heikin Ashi transform ITSELF, from standard candles.
On a chart already set to Heikin Ashi, the open, high, low and close it
receives have already been through the transform once. Applying it again would
compare a twice-smoothed state against bars that are not real candles. The
script would be measuring its own output and reporting the answer as a
property of the market.

So on Heikin Ashi, and equally on Renko, Kagi, Point & Figure and Range, the
paint, the boxes and the published values stop and the panel collapses to one
frozen row naming the chart type.

Switch the chart to standard candles and it works. That is the whole fix: this
tool is how you look at Heikin Ashi, not something you run inside it.

THE TWO PUBLISHED SERIES

The script publishes two series that another indicator can select in its
Source setting.

The first is the flip itself: +1 on the bar the state turns up, -1 on the bar
it turns down, 0 on every other bar. It returns to 0 between flips, so it
marks moments rather than conditions.

The second is the measured lag on those same bars.

Both carry no value at all before the script has an opinion, which is not the
same as a lag of zero. Nothing means "not measured". Zero would mean
"measured, and the lag was none", and as above that cannot happen.

The flip series is shaped for Signal Audit Lab [BSL], which can measure it
forward and report what the lateness actually cost.

Two alert conditions sit in the same list. They are not values. The candle
colouring and the lag boxes cannot be selected at all, so these two are the
whole readable surface of the script.

WHAT IT WILL NOT TELL YOU

Nothing here claims the lateness was worth paying, or was not. That is an
outcome, and this reports a distance in bars and never what followed it.

It does not judge Heikin Ashi. Lateness is measured, not scored, and a trader
who accepts the delay in exchange for fewer false turns is making a trade this
script has no opinion about. It offers no smoothing of its own, no variant
transform and no multi-timeframe version. It contains nothing you could act on
directly: no entry, no exit, no target.

This tool measures the latency of a transform. It does not predict price,
guarantee performance or provide trading advice. Validate the behaviour on
your own symbols, timeframes and execution assumptions before making
decisions.

Open-source Pine Script® v6. Educational use only.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.