OPEN-SOURCE SCRIPT
Protection Price (Wenhua / TDX)

A short-term support and stop-loss reference line adapted from the Wenhua/TDX trading platform community formula.
— FORMULA —
Protection Price = ( Close[2] + Close[1] + Open ) / 3
That is, the average of the two prior bars' closes and the current bar's open.
— INTERPRETATION —
• When price holds above the line, short-term structure favors continuation of the prevailing trend.
• A clean break below the line, particularly with expanding range or volume, often precedes a deeper pullback.
• Useful as a soft stop-loss anchor for swing positions.
— TIMEFRAME NOTE —
This indicator was designed for daily charts, where the three input bars span three trading sessions and carry meaningful overnight gap information. On lower intraday timeframes (5m, 15m) the line will naturally track close to price, behaving like a three-bar smoothing — this is expected, not a bug. For a true daily-level Protection Price displayed on an intraday chart, request the daily series via request.security().
— BEST PAIRED WITH —
"D/K Strength + Smart Money Accumulation" sub-chart indicator for complete entry and exit context.
A faithful Pine v6 port of the original community formula.
— FORMULA —
Protection Price = ( Close[2] + Close[1] + Open ) / 3
That is, the average of the two prior bars' closes and the current bar's open.
— INTERPRETATION —
• When price holds above the line, short-term structure favors continuation of the prevailing trend.
• A clean break below the line, particularly with expanding range or volume, often precedes a deeper pullback.
• Useful as a soft stop-loss anchor for swing positions.
— TIMEFRAME NOTE —
This indicator was designed for daily charts, where the three input bars span three trading sessions and carry meaningful overnight gap information. On lower intraday timeframes (5m, 15m) the line will naturally track close to price, behaving like a three-bar smoothing — this is expected, not a bug. For a true daily-level Protection Price displayed on an intraday chart, request the daily series via request.security().
— BEST PAIRED WITH —
"D/K Strength + Smart Money Accumulation" sub-chart indicator for complete entry and exit context.
A faithful Pine v6 port of the original community formula.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.