OPEN-SOURCE SCRIPT

Colored ALMA

375
ALMA is the Arnaud Legoux Moving Average. Instead of weighting every bar in the lookback equally, it lays a bell curve over those bars and weights them by where they fall under that curve. The Offset decides where the peak of the curve sits. At 0.85 the peak sits near the newest bars, so the line hugs price with very little lag. Sigma controls how narrow the bell is, and a higher Sigma like 6 means fewer bars carry real weight, which smooths the line. So 14, 0.85, 6 gives you a fast line that still refuses to chase every tick.

How the color decides itself
In slope mode the script only asks one question each bar: is the ALMA higher or lower than it was on the previous bar. Rising paints green, falling paints red. The direction is stored in a variable that carries forward, so if the line goes perfectly flat for a bar it holds whatever color it had rather than blinking to something neutral. You only get a color change when the line genuinely turns.
That is why slope mode is quieter than price versus ALMA. Price can poke through a moving average a dozen times in a sideways hour, but the average itself has to actually roll over before slope changes.

The markers and the alerts
A small triangle prints under the bar when it turns green and above the bar when it turns red, so you can eyeball the history without hunting for the exact bar where the color switched.
For alerts you have four options in the dialog. Three of them are alertcondition entries: green only, red only, or any change. Those let you set your own trigger frequency in the alert window. The fourth is the built in alert call, which fires on bar close and sends a message with the direction and the price. Use the alertcondition ones if you want control over frequency, use the alert call if you want the message to carry the price with it.

To make slope the default
Change the first argument on the Color Rule input from "Price vs ALMA" to "ALMA Slope". Everything else stays as is.

One thing worth knowing before you lean on it: slope mode is calmer, but in tight chop a fast ALMA can still ripple up and down a few ticks and flip on you. If that shows up on your timeframe, raising Length or lowering Offset a little will kill most of it. This is a tool to give information about a price chart and is not financial advice.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.