How to quickly & easily check if a script repaints?What is “repainting”? Why is it important that the script you use does not do it?
Repainting, generally, is re-drawing or changing visual properties.
In the context of technical analysis and charting, repainting means the change of historical data, such as signals and visual plots, with the flow of time.
Historical results, generated by scripts which repaint, are often quite appealing, even perfect-looking. This can easily mislead many users and traders in their expectations and give false analysis data. As a result, users may make irrational trading decisions.
A lot has been written on the topic of repainting.
In this article, we will show 3 easy ways to check if a script does not repaint.
Throughout the TradingView community, one of the most asked questions is:
“Does it repaint?”
Method 1
Simply add the script to a chart, and start creating an alert. In the alert settings, choose the condition as the script at question.
If the script repaints, you will notice a yellow exclamation mark next to the alert window heading. Click on it to see TradingView’s warning.
Script with repaint warning
Script without repaint warning
Exceptions
In some cases, scripts may contain dashboards or other different visual plots, excluding in-built technical analysis. A warning is shown then, since such visual elements need the script to have the option `calc_on_every_tick` enabled. This option updates visuals, such as dashboards, on every single tick, making them show data in real-time. On the other hand, it may generate ‘intra-bar’ signals, also known as unconfirmed signals.
What are confirmed and unconfirmed signals?
An unconfirmed signal is such that is generated during the current candle. It is intra-bar, and can appear and disappear with the current price fluctuations. It can trigger alerts too, since it is a single like any other.
A confirmed signal is only generated when a candle closes and the price is locked-in history. It cannot trigger and disappear while the candle (let’s say 1-hour) is still ongoing.
If you are using an invite-only script, you can always contact the provider with a request for a version without such visual elements and no warning. This way you can re-assure yourself by comparing.
Transparency should be the main priority for any provider.
Method 2
Use the “Replay” function on the chart to check for repainting. Before doing anything, snap a pic or record what signals there are on the chart. Click on the replay button in the chart header and go to a time back in history.
Press “play”, and compare the trades during replay with the ones without replay.
If there are inconsistencies, such as missing or added trades during replay, it means that the script repaints.
Method 3
Create a simple alert with the script as a condition in the settings menu. Do not attach any messages, webhooks or notifications. Then, monitor its activity in the ‘Alerts Log’ menu.
Compare instances when the alert has been triggered by time with signals on the chart. If there are inconsistencies, that means a signal was triggered but has been removed from historical data. This shows that the script repaints.
Conclusion
Here, the three easiest and fastest ways to detecting repainting of a script are shown.
Always exercise caution when using different scripts, especially if they help you make trading decisions or analyse historical performance.
Repainting
TradingView Calc on order fill repaintingIn case you are looking for it , calc on order fill evidence of repaint.
This setting is all over the place, once you load from realtime to bar history you can see it performs nothing like eachother so you can't trust any of the backtest results.
JSFX recommendation: never use this setting unless it's for purely forward tested trading
Calc on order fill repaints
Calc on order fill repainting
Let's Talk About RepaintingTechnical 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.
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.
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.
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.
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.
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.
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.
How to Choose the Right Indicator - Full Guide!Many traders, especially when starting out find themselves in a constant search of the best trading strategy.
A quick Google search is enough to scare anyone starting out, as the number of indicators and strategies to use under different market conditions is overwhelming.
In this article, we will discuss *1* indicators nature and the correct way to use it, *2* how to choose the right indicator, and most importantly *3* how to know if the indicator is reliable or not.
---------------------------------------------------------------------------------------------------------------------
First, what are indicators? Origin and Nature
Indicators are statistical tools that digest price data, OHLC of each candle, add a formula to it, and then convert it into visual information such as graphs or oscillators. Indicators provide information about the strength of a trend, momentum, and possible reversals.
When it comes to indicators, we can divide them into four classes: Momentum indicators, Trend indicators, Volatility indicators, Volume Indicators.
Knowing which one belongs to which category can help you make much better trading decisions. On the other hand, combining indicators in a wrong way can lead to a lot of confusion, wrong price interpretation, and, subsequently, to wrong trading decisions.
The correct way to use indicators. Indicators don’t provide signals.
Most traders never look at the indicators they are using and even less have ever tried to understand the formula the indicator uses to analyze price. They then use their indicators in the wrong context and wonder why nothing works.
Indicators don’t tell you when to buy or when to sell. They don’t even tell you when something is overbought or oversold.
Indicators are great tools if a trader understands their true purpose. Indicators provide information about price, how the price has moved, how candles have shaped, and how recent price action compares to historical price action. Again, not a direct signal to buy or sell.
Thus, the job of a trader is to interpret the information on their indicators in a meaningful way and turn it into a story about price action and buying/selling pressure. Who is in control right now? Is the market ranging or trending? Is price losing strength or gaining momentum?
How to choose the right indicator? That suits your trading style and personality
---------------------------------------------------------------
* Meaningful: Represents important information.
---------------------------------------------------------------
Your indicator choice should match your trading style. The purpose of indicators/strategies is to offer a way to identify clues and to provide a framework for traders to work in. Our main job, as traders, is to collect clues and combine them in a meaningful way to have an edge over the market.
Only add indicators that help you put the odds in your favor. -- If it doesn’t, you don’t need it.
---------------------------------------------------------------------------------------------
* Objective: Has a clear operational definition of what is being measured.
---------------------------------------------------------------------------------------------
Indicators are ideal for rule-based trading as indicators take out the guesswork by providing information that is totally objective especially for newbies who are struggling with discipline.
The most successful strategies/indicators are those where not a lot of individual interpretation is required.
Only use indicators that help you make objective decisions. -- If it doesn’t, you don’t need it.
---------------------------------------------------------------------
* Understandable: Easy to comprehend and interpret.
---------------------------------------------------------------------
Indicators are great tools especially for amateurs who do not know how to relate price data into meaningful relationships.
Indicators' main purpose is to make your life easier, not more sophisticated.
Remember: K.I.S.S. Keep it simple stupid! -- If it is complicated, you don’t need it.
Last but not least, more is not always better:
The problem with indicator redundancy is that when a trader picks multiple indicators that show the same information, he/she ends up giving too much weight to the information provided by the indicators.
“All Strategies / Indicators are good; if managed properly.”
~ Rich
---------------------------------------------------------------------------------------------------------------------
How to know if the indicator is reliable? Cheat Sheet Checklist
* Does it repaint, disappear or recalculate?
We have all been there. An indicator looking good /profitable on the chart, but perform horribly under live market conditions. Most indicators are designed to only show/keep winning signals. Do not, ever, include an indicator in your trading plan before testing it on a demo account.
Here is a simple step by step guide on how to test indicators:
- Attach your indicator to any chart.
- Keep your trading platform running for a while for the indicator to plot a couple of signals.
- Take a screenshot of the chart.
- Refresh by switching between the timeframes.
- Compare your chart with the screenshot
If the indicator’s signals /drawings change location or disappear, then it is a red flag. Such indicators are not reliable and shouldn’t be used in any way.
* Does it lag?
In general, indicators are lagging, but so is price action. An indicator can only analyze what has happened already. Just as a candlestick or chart pattern only includes past price data.
Nothing to worry about so far, as we mentioned above, indicators only provide information and do not offer signals.
However, some indicators are too lagging. This kind of indicators looks good on historical data but appear too late under live market conditions.
Pro Tip: Always take into consideration when, where, and how does the signal appear.
* Is it TradingView friendly?
90% of custom indicators do not work on TradingView, because PineScript does not allow recalculation. Thus, the signal/drawing can’t be modified once it is generated by the indicator.
Therefore, indicators that are available on TradingView stand out from the crowd, and they are considered more reliable.
---------------------------------------------------------------------------------------------------------------------
In brief, indicators are very famous tools and used by millions of traders. However, often traders don’t really know what their indicators are doing or how to use them.
Always be aware of the objectives of your trading style and what you are trying to accomplish with the indicators. Then, adjust accordingly. Once a trader can stop using indicators as signal-tools, he will be able to transform his trading to new heights. Happy trading!