Strategies and indicators are repainting

When a strategy uses a close, low or high, from a timeframe higher than the timeframe it currently has open, it will repaint.
For instance:
[code]security(tickerid, 'D', ohlc4)[/code]
will repaint if you have, for instance, a 5 minute chart open.

This happens, because let's say that at 2 pm, the price for an imaginary index is $100. That means that the daily close for our imaginary index is also $100. A strategy will analyze this daily close and become bearish. However, at 3 pm, the price has climbed to $110. The strategy will get a new daily close and might become bullish. So far so good.
This only becomes a problem when you reload the page. When you do, it appears that the strategy has been bullish for the ENTIRE day. not only that, but the sells that it did a $100 have disappeared and the buys at $110 have been pushed back to 00:00, which was almost certainly a better price to buy at than $110.

The fix I propose is as follows. Instead of having 2 types of trades, "historical" and "realtime", everything should be made realtime and upon opening a chart, the strategy should be fed every tick that has been saved from the minute data. This way it should behave as it would behave in real-time, providing better testing results.
I presume that the difference between realtime and historical was made to improve loading speeds. But I think that this can also be achieved by caching the results onto the clients machine. This way, when you open a chart, you already have the test results handy, except for the previous day or so, and may even improve speed, because only the last day or so needs to be simulated. This will fix the performance issue that presumably made the distinction between realtime and historical without the need for more servers on tradingview's side.

I think that you will find that the community is desperate for a fix. Browsing through the other tickets here I see more people trying to be warned for repainting strategies. Since I created ANN (, I weekly get the question why the trades have moved on their chart. At one point I have been accused of conspiring with tradingview to make people lose money using my script.
116 people have
this problem