OPEN-SOURCE SCRIPT

Daily Backtest Pivots

40
Problem with the built-in Pivot Points Standard indicator in backtesting/replay mode:

The default "Pivot Points Standard" indicator is excellent on live charts, but it becomes completely unusable for proper backtesting or bar-replay because it always calculates and displays the current day’s pivot points (P, R1, R2, S1, S2, etc.) using the high/low/close of the still-forming current day — even when you're replaying historical bars.

Example:

When replaying or backtesting September 8 at 08:00 (Asian session), the indicator already shows the final R1, R2, S1, S2 for the entire September 8 daily candle, even though in real trading at that moment you would have no idea where the day will close or what the final daily range will be. This creates massive look-ahead bias and makes any strategy that uses daily pivots impossible to test realistically.

Desired behavior (historical accuracy):

During backtesting or bar replay, the indicator should only plot:

The previous day’s completed pivot levels (which were actually known at the start of the current day)
NO current-day pivot levels at all (or only plot them after the daily candle is closed)

Many custom pivot scripts already do exactly this (they only show the prior day’s levels throughout the current day), which is why people abandon the built-in indicator for backtesting.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.