Trend Lines with Labels

The script identifies the highest high and lowest low within the lookback window, along with the bars on which they occur (highest_bar, lowest_bar). If a new high or low is detected compared to the previous bar, it calculates the slope (or gradient) of the trend line and uses line.new() to draw a new trend line from the past pivot point to the current one. Each new line replaces the old one to keep the chart clean.
Additionally, the script places dynamic labels on the chart when a new uptrend or downtrend level is detected. These labels show the type of trend and the corresponding price value. The labels are color-coded for clarity—green for uptrend and red for downtrend—and are automatically deleted and redrawn to prevent clutter.
This tool is useful for visually identifying short-term trend reversals.
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.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
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.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.