OPEN-SOURCE SCRIPT
Price vs SMA

This indicator displays the current price in percentage terms, indicating whether it is above or below a selected simple moving average (SMA). It’s designed to be clean and minimal, with the option to display a brief sentence on the chart for added clarity.
The script calculates the distance between the current price and a chosen simple moving average (SMA) and expresses that distance as a percentage. By default, it uses the 200-period SMA, but you can adjust the length to any value, such as 50 or 100, depending on your trading style. A positive percentage means price is trading above the SMA, while a negative percentage means it is below.
The percentage difference is rounded to whole numbers and can be displayed directly in the chart legend if the “Indicator values” box is checked in the TradingView settings. This keeps the chart clean while still providing at-a-glance information about the price relative to your selected moving average.
For extra clarity, the script also includes an option to display a short sentence on the chart itself. This sentence will read “Price is x% above [SMA length] SMA” in green when price is above the SMA, or “Price is x% below [SMA length] SMA” in red when price is below. This visual cue makes it easy to interpret the relationship between price and the moving average without adding clutter.
The script calculates the distance between the current price and a chosen simple moving average (SMA) and expresses that distance as a percentage. By default, it uses the 200-period SMA, but you can adjust the length to any value, such as 50 or 100, depending on your trading style. A positive percentage means price is trading above the SMA, while a negative percentage means it is below.
The percentage difference is rounded to whole numbers and can be displayed directly in the chart legend if the “Indicator values” box is checked in the TradingView settings. This keeps the chart clean while still providing at-a-glance information about the price relative to your selected moving average.
For extra clarity, the script also includes an option to display a short sentence on the chart itself. This sentence will read “Price is x% above [SMA length] SMA” in green when price is above the SMA, or “Price is x% below [SMA length] SMA” in red when price is below. This visual cue makes it easy to interpret the relationship between price and the moving average without adding clutter.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.