Let’s Talk About Repainting

Technical indicators are characterized by processing historical data, in a causal real world and for the sake of our analysis, we would expect indicators historical outputs to remain the same right? Well, we will see that this is not always the case, and that certain indicators can change appearance.
1. Repainting Indicators

In Technical analysis repainting is a behavior mostly associated with technical indicators characterized by a change of their historical outputs over time, that is the indicator results given at time t, t-1, t-2, t-3… would change at time t+n. More easily put we can say that the past results of such indicator are always subject to change, hence the term repainting (reapply paint over something).

As you could imagine it would be fairly hard to keep track of an indicator performance subject to repainting, but why does this behavior occur in the first place? There are various causes.

1.1 Non-Causality – When Indicators “Look Ahead”

One cause of repainting is given by indicators that are non-causal. The output of a non-causal indicator is dependent on future inputs, as such at time t the indicator would have access to prices at time t+1,t+1…t+n.

You might have already seen a few non-causal indicators, these tend to generally look excessively performant (like most repainting indicators).

In PineScript we can access future prices through the use of the security function and lookahead argument.

Snapshot

In the above chart, we can see the output of the security function. Indicators processing this output of the security function would of course inherit this non-causal behavior and would as such repaint.

snapshot

The above case shows the Nayadara Watson Estimator, a Kernel smoothing technique whose output at times 0,1…t-1 all depends on future inputs with the exception of the output at time t.

1.2 Other Causes

Non-causality is often the main cause of repainting but not the only one. Indicators initiating their calculation at a different time can also repaint, this mostly occurs with indicators based on recursive calculations. The indicator below is a clear example of this behavior.

snapshot

We can see that the same indicator being calculated 100 bars later drastically changes its outputs, in the case where historical data were to removed, thus changing the starting calculation point of the indicator, we would be subject to a different historical output.

Another cause that is not proper to the indicator is the occurrence of changes in the historical prices data, which can cause indicators to repaint, this could for example occur if prices becomes split adjusted.

2. Can Repainting Indicators Be Useful?

There is no need to say that it can sound unproductive to use repainting indicators, the foundation of technical analysis is based on the study of historical information, which is subject to change with repainting indicators. Trading with technical indicators also often involves backtesting them, which could be unproductive in the case of a repainting indicator.

But this hardly means they can’t be useful, but simply that their usage can be limited to certain operations.

snapshot

Above we can see a forward-backward third order Butterworth filter, the forward backward filtering operation makes the output subject to repainting, however, we can use this filter to more easily observe market price trends, filtering out noisy fluctuations. This can for example make the identification of patterns easier.

Certain repainting indicators can also be used for the core calculation of other indicators without introducing repainting in the final output. One example can be given in the case where we use forward backward filtering.

snapshot

Above we perform forward backward filtering using an exponential moving average (output in blue), and return the sum of absolute error between the price and the historical output of the forward backward exponential moving average below (in green), this new calculation makes use of a repainting operation but will not repaint.

3. Not Everything Repaint

We have seen the definition and certain causes of repainting. It is important not to use the wrong qualifiers when describing the behaviors of certain indicators. For example, it can be common to see indicators whose elements are simply shifted in the past in order to account for a specific amount of lag, this doesn’t make them repainting indicators, as they can be purely based on present and past historical data, and would as such not be subject to change in their historical outputs.

snapshot

The above chart shows a triangular moving average shifted length-1 bars in the past, it is still fully causal.

4. Conclusion

This post briefly introduced the concept of repainting indicators and how these can be used. It is important to be careful that an indicator does not repaint before attempting certain analysis using them. The replay tool available for users chart can help identify if an indicator is repainting or not.

Even if repainting indicators will always have a misleading image associated with them. They can still play a role when it comes analyzing market data as well as creating additional indicators.

5. Main Takeaways

  • Repainting is a technical indicator behavior characterized by a change of historical outputs over time.
  • Repainting indicators can be both causal (only using present and past input data) and non-causal (use future input data).
  • Certain repainting indicators can be used for the core calculation for other indicators without introducing repainting.
  • Note all indicators are subject to repainting.

Get Access to LuxAlgo indicators: https://luxalgo.com