In this script, we will be creating an indicator called "Momentum Sparkler" that plots lines on the chart to visualize the momentum of the given source.
Explanation:
First, we define the input "Source" as the source for the data to be plotted, and the input "Length" as an integer determining the number of lines to plot.
We then create an array called "lines" to store the lines we will be plotting.
Using an if statement, we check if the current bar is the last bar in the chart. If it is, we use a for loop to iterate through the range of the "Length" input and add a line to the "lines" array for each iteration. The color of each line is determined by a color gradient, with the first line being the most red and the last line being the most green.
Next, we use another if statement to check if the current bar is confirmed. If it is, we use a for loop to iterate through the "lines" array and delete all the lines. This is to prevent the lines from being carried over to the next bar and potentially being plotted multiple times.
Conclusion:
This script can be useful for quickly visualizing the momentum of the given source and identifying potential trends or reversals. It can be helpful for making trading decisions or for adding an additional layer of analysis to a chart.
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.
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.
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.
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.