OPEN-SOURCE SCRIPT
TS vs Previous Candle (TSC/TSD)

This indicator detects **Turtle Soup (TS) reversal triggers** using a strict **previous-candle reference** and prints signals **only on bar close** (non-repainting intrabar).
* **TS Bull:** the current bar **sweeps below the prior low** (liquidity grab) and then **closes back above the prior low**.
* **TS Bear:** the current bar **sweeps above the prior high** and then **closes back below the prior high**.
An optional strict mode can require the close to remain **inside the previous candle’s range** for cleaner mean-reversion structure.
Each signal is further classified as:
* **TSC (Clean):** candle body aligns with the TS direction (bull body for TS Bull, bear body for TS Bear).
* **TSD (Dirty):** candle body contradicts the TS direction (or doji), highlighting weaker/less “clean” reversals.
Use it to map **liquidity sweeps + reversal closes** and to separate higher-quality TS setups (TSC) from more ambiguous ones (TSD) for further filtering (trend, levels, sessions, risk rules).
* **TS Bull:** the current bar **sweeps below the prior low** (liquidity grab) and then **closes back above the prior low**.
* **TS Bear:** the current bar **sweeps above the prior high** and then **closes back below the prior high**.
An optional strict mode can require the close to remain **inside the previous candle’s range** for cleaner mean-reversion structure.
Each signal is further classified as:
* **TSC (Clean):** candle body aligns with the TS direction (bull body for TS Bull, bear body for TS Bear).
* **TSD (Dirty):** candle body contradicts the TS direction (or doji), highlighting weaker/less “clean” reversals.
Use it to map **liquidity sweeps + reversal closes** and to separate higher-quality TS setups (TSC) from more ambiguous ones (TSD) for further filtering (trend, levels, sessions, risk rules).
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.