For the Geeks
The reader who has made it here wants more than a feature list and less than a code walkthrough. You want enough shape of the math to trust the pane — to know what the dials are doing, where the bounded 0-to-100 frame...
Written By Axiom Admin
Last updated 22 days ago
For the Geeks
The reader who has made it here wants more than a feature list and less than a code walkthrough. You want enough shape of the math to trust the pane — to know what the dials are doing, where the bounded 0-to-100 frame comes from, and why a slot reading of 85 on one instrument and 85 on another are comparable at all. This page is written for that reader.
What you will get: the ordered stages of the transformation, a named role for each stage, the tradeoff the stage commits you to, and a verification move you can run on your own chart to confirm the explanation matches the pane.
What you will not get: a line-by-line code walkthrough or pseudocode you can paste into another script. This page names the math shape and the user-facing tradeoffs; it does not turn the implementation into a recipe.
This is a page about the shape, not the recipe. You can read and trust the pane without the recipe. That is the point.
Stage 1 — Raw MACD, raw signal, raw histogram per slot
For each enabled slot, the script starts in price space.
A fast moving average on the slot's source, at the slot's fast length, using the slot's MACD MA family.
A slow moving average on the same source at the slot's slow length, same family.
The slot's raw MACD is
fast − slow, in whatever price units the instrument uses.The slot's raw signal is a moving average of the raw MACD at the slot's signal length, using the slot's signal MA family.
The slot's raw histogram is
MACD − signal.
All three live in price units. None of them are comparable across timeframes (because a 60-minute MACD moves through larger numbers than a 5-minute MACD on the same instrument) and none of them are comparable across instruments (because SPY's MACD and BTC's MACD are priced in different units entirely).
Tradeoff at this stage: the per-slot MA family is drawn from the Lite library. The local import exposes SMA, EMA, RMA, WMA, VWMA, and SWMA. Family-specific Power User parameters are not exposed in this tier, and families like HMA, DEMA, TEMA, ALMA, Jurik, KAMA, FRAMA, Laguerre, and VAMA are not part of this Lite import. One odd little footnote matters: SWMA uses TradingView's fixed ta.swma() behavior, so the length field does not tune it the way it tunes the other families.
Verification: on a quiet session, reduce every slot to the same source, same length pair, same family, and the same timeframe. The three slots' fast lines should render identically. That is the stage-1 output being the same across slots.
Stage 2 — ATR as the per-slot volatility yardstick
The transformation now needs a ruler — something in the same units as the raw MACD so that the ratio makes sense. ATR is that ruler. The script computes ATR inside each slot's own request.security context, at the slot's own timeframe, over the configured ATR Length. That is important in two directions:
Same units. ATR on the slot's timeframe is in the instrument's price units on that timeframe. Dividing the slot's raw MACD by that ATR produces a unit-free ratio.
Per-slot, not per-chart. A 60-minute slot's ATR is 60-minute ATR on the chart instrument. A 5-minute slot's ATR is 5-minute ATR on the same instrument. They are not sharing a single chart-level ATR. If they did, you would lose exactly the cross-timeframe comparability the pane was built to create.
Tradeoff at this stage: ATR is a conventional volatility proxy, not the only conceivable one. When ATR behaves unusually — thin liquidity, gap sessions, sudden expansion or collapse — the ratio inherits that behavior. A slot whose ATR just collapsed can push toward a boundary even when the underlying MACD gap did not change much, because the denominator shrank.
Verification: change ATR Length on a quiet chart and watch the slot's reactivity change without any change in the underlying price action. A longer ATR length steadies the reactivity. A shorter length makes it jumpier near volatility transitions.
Stage 3 — ATR Sensitivity as the pre-sigmoid dial
Before the sigmoid lands the value in 0 to 100, the ATR-normalized value is scaled by a user-controlled ATR Sensitivity dial. Conceptually: the sensitivity is a knob on how quickly the sigmoid's S-curve approaches its boundaries for a given ATR-normalized input.
Sensitivity 1.0 is the default baseline.
Sensitivity > 1.0 pushes more of the ATR-normalized space into the sigmoid's flat regions near 0 and 100. The slot pins faster and more often.
Sensitivity < 1.0 keeps more of the range in the sigmoid's responsive middle. The slot flattens toward the midline.
The sensitivity dial is not a magnification — it does not give you more information about the underlying MACD. It moves the range within which the sigmoid is informative. Crank it high and the pane becomes less informative in the boundary regions, where many readings saturate together. Crank it low and the pane becomes less informative in the midline region, where most of the action lives.
You do not need the formula to use the dial well; you need to know that the mapping is monotonic, that 1.0 is the default baseline, and that the flat regions near the boundaries become easier to hit as you raise sensitivity.
Verification: on the same chart, alternate between sensitivity 0.5, 1.0, and 3.0 for a few minutes each. The slot line should behave progressively flatter at 0.5 and progressively more saturated at 3.0, without changing direction.
Stage 4 — The centered sigmoid into 0-to-100
The scaled value is passed through a centered sigmoid whose output lands in 0 to 100. Three facts about this stage are worth holding on to:
50 is the center by construction. A raw value of zero passes through the divide-by-ATR and the scale-by-sensitivity steps as a scaled value of zero, and the sigmoid's output at zero is the center of its range — 50. For the normalized MACD line, that means raw MACD is zero. For the normalized signal value, that means the signal value is zero. For the normalized histogram, that means MACD equals signal.
0 and 100 are asymptotes. The sigmoid approaches them but does not reach them from real inputs. The values you see at 0 and 100 on the pane are after a defensive clamp (covered in the next stage); the sigmoid itself never technically gets there, and the rail on the pane is not the sigmoid — it is the clamp that backstops the sigmoid.
The input is bounded internally. Very large scaled values (in either direction) are bounded before the sigmoid function is evaluated, so the internal exponential stays numerically stable. You will not see NaNs from this stage on extreme inputs, which matters on instruments with gapped opens or in volatility-collapse conditions where naive exponentials would blow up.
Tradeoff at this stage: the sigmoid commits you to smooth, monotonic compression. You gain a pane where 50 is unambiguous equilibrium and where the rails are rails. You lose the ability to distinguish "very stretched" from "extremely stretched" in the boundary regions — the flat region of the sigmoid compresses those cases together by design.
The exact formula is not needed to read the pane correctly. The reader-facing truth is enough: 50 is the midline, 0 and 100 are asymptotes, and the flat regions exist.
Verification: observe a violent session where the underlying MACD runs against its signal for many bars. The slot's fast line should climb into the boundary region and spend time near it without leaving the frame — the asymptote is doing its job. A session that never goes near the boundaries produces a slot that breathes in the middle; both are correct for their underlying evidence.
Stage 5 — The defensive clamp at the slot level
After the sigmoid, the slot value is clamped into exactly [0, 100] as a defensive step. In practice, the sigmoid's output should already be inside that range — the clamp is a belt and braces, not the main enforcement mechanism. It matters because it guarantees the downstream plotting and blending logic never has to handle out-of-range values from numerical drift.
The visible clamp bounds are exactly the pane bounds: 0 and 100. You do not need more than that to read the pane; you need to know that the rails you see are firm.
Verification: push sensitivity high enough to saturate a slot and watch the line respect exactly 0 and 100 as hard rails, not as soft zones the line can drift past.
Stage 6 — The weighted blend across enabled, non-zero-weight slots
Each slot now produces a triplet — the slot's normalized fast K, its normalized signal D, and its normalized histogram H — all in 0 to 100 with 50 as equilibrium. The blend takes these triplets and combines them across every slot that is enabled, has non-zero weight, and has a non-na value on this bar.
Conceptually:
A weighted average, not a vote.
Slots at weight 0 are excluded from the blend but not from the indicator's other behaviors (plot, per-slot alerts, alignment count).
Slots whose values are
naon a given bar — because they are still warming up, for example — are absorbed conservatively so the pane is robust to partial warm-up. This is the behavior, not the rule.
The actual blend rule is straightforward: slots with zero weight or any na value in the K/D/H triplet are skipped for that bar, and the remaining weights are averaged against the remaining contributing slots. If no contributing slot remains, the blend is na and the blend layer disappears instead of pretending missing data is zero.
Tradeoff: a weighted average is a summary, not a consensus. It cannot substitute for reading the individual slots. A quiet blend on disagreeing slots averages over the disagreement without naming it, which is why Visuals and Logic insists on slots-before-blend as the reading order.
Verification: drop one slot's weight to 0 while keeping it enabled. The blend should shift to reflect the remaining two slots, while the dropped slot's line still renders and its per-slot alerts still fire. Reduce a second slot's weight to 0; the blend now reflects one slot only. Reduce the third; the blend should disappear from the pane entirely.
Stage 7 — The defensive re-clamp after the blend
Same story as stage 5, one level up. The blended K, D, and H are each re-clamped into [0, 100] after the weighted average is produced. This is a belt-and-braces step that guarantees the blend respects the pane's bounds even if numerical drift would otherwise have pushed it fractionally outside.
Verification: saturate every slot by pushing sensitivity high and watch the blended line respect the boundaries the same way the slot lines do.
Stage 8 — Optional master smoothing and a second re-clamp
If Enable Master Smoothing is on, a single MA pass runs on the already-blended K, D, and H, using the Master MA Type and Master Length inputs. The result is re-clamped again into [0, 100].
Two facts worth naming at this level.
The master pass runs on the already-blended K, D, H — not on the underlying slot evidence. A smoothed blend is a smoothed summary, not a recomputation from the slot values.
Blend-based alerts fire on the smoothed series when master smoothing is on. Per-slot alerts are unaffected; they still see the slot's own K and D.
The implementation is direct: the selected Lite-library MA is applied to the already-blended K, D, and H, then those smoothed values are clamped back into the pane. The reader-facing statement is still the important one: on adds smoothness and can change alert timing; off keeps the blend closer to the raw weighted slot summary.
Verification: enable master smoothing with a length of 3 to 5 on a trending session. The blended line should visibly calm. Compare blend-bull alert timing with smoothing on versus off at the same chart anchor. Expect timing to change; often it arrives later, and short-lived raw blend states may disappear.
Why the boundary lives where it does
The useful boundary is not secrecy theater. It is knowing which details help a trader read the pane and which details just turn a learning page into code commentary.
So the bargain this page offers is intentional: the mental-model shape of every stage, the role each stage plays, the tradeoff it commits you to, and a concrete verification you can run for each. That is enough to read the pane well and to know what the dials are doing. It is also enough to catch the failure modes that matter in use: saturation from sensitivity, missing blends from zero weights or warm-up, and altered timing from master smoothing.
If you are evaluating this indicator against another normalized-MACD tool, compare behavior rather than vibes. Run the stage-by-stage checks on both. Look at pinning behavior under high sensitivity, warm-up behavior on a fresh load, smoothed-versus-unsmoothed alert timing on a trending session, and slot behavior when ATR collapses mid-session. The tool that survives those checks with behavior you can explain is the one you can actually work with.
Where to go next
Knobs, one by one, with the tradeoff attached — Settings.
The reading order and the four-state histogram — Visuals and Logic.
The trust boundaries, in order of damage potential — Limitations and Trust Boundaries.
Symptoms that look like bugs and usually are not — Troubleshooting.