The DCTI curve is calculated by comparing the differences between highs and lows over a major an minor period, and expressing them as a positive and negative percentage.
The curve is then smoothed with an to provide a signal line.
Custom bar colors included with two coloring methods to choose from.
Cleaned up the code. Condensed the operations into a function.
Bar color selection is now an easy to use dropdown menu.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
One way you can validate whether or not a script repaints is by trying to set up an alert on it. If the indicator does indeed repaint, you'll receive a warning dialogue about it from TV before creating the alert.
However, no such dialogue pops up when setting up alerts involving this script.
If you're referring to the fact that the values on the current bar are not certain until closed, then yes. That form of "repainting" happens on all charts because price chart values are updated on an intra-bar basis, then finalized upon close.
If you're referring to the indicator rewriting data on historical bars, it does not.
If, by some chance, you have some evidence of repainting in this script, please forward me some screenshots and details so I can troubleshoot the issue and report a bug to the Pine team if necessary.
As I said before, if you have some evidence of repainting, please send details and screenshots so we can troubleshoot the issue.