OPEN-SOURCE SCRIPT
Colored ALMA

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.
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.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Don't force a trade. Wait for your setup, be patient. Trade ideas are my own and not financial advice, I'm a monkey with a phone for crying out loud.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Don't force a trade. Wait for your setup, be patient. Trade ideas are my own and not financial advice, I'm a monkey with a phone for crying out loud.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.