OPEN-SOURCE SCRIPT

Sigma Distance From Moving Average

46
This is an indicator I've wanted to build for a while. The advent of AI and vibe coding circa 2026 made it feasible.

This is an iteration of the previous indicator I shared - % distance from moving average - which, as explained in the self-described title, displays the % distance an asset's current price sits above or below whatever moving average you enter on whatever timeframe you choose.

This new version expresses this distance as a z score rather than a %. The high level is we're going one level deeper - knowing how far an asset's current price is from its moving average is interesting, but what's more interesting is knowing how often this asset reaches this level above/below its moving average. Some assets are volatile, others less so. For something that moves a lot, being 15-20% above its 50 day moving average isn't all that rare. For something that doesn't move a lot, that might be a once in a ten thousand occurrence - we want to be able to quantify this. That's what this one does.

Enjoy!

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.