OPEN-SOURCE SCRIPT
TS vs Previous Candle + Volume Delta (Fran_Pineda)

This script combines a **Turtle Soup (TS) reversal trigger** with an **approximated Volume Delta confirmation** to generate clean, close-confirmed trade alerts.
### What it does
* **Detects Turtle Soup vs Previous Candle**
* **Bullish TS (BUY trigger):** price sweeps below the previous candle’s low, then closes bullish back above that prior low.
* **Bearish TS (SELL trigger):** price sweeps above the previous candle’s high, then closes bearish back below that prior high.
* Signals are **confirmed only on candle close** (no intrabar repaint).
* **Calculates Volume Delta (lower timeframe scan)**
* The script estimates **net buying vs selling pressure** inside each current bar by scanning a **lower timeframe** and summing:
* *Up-volume* when the lower-TF candle closes ≥ opens
* *Down-volume* when it closes < opens
* The delta is computed **per bar** (it resets every bar), so it reflects *what happened inside that candle*, not a drifting cumulative line.
### How signals are generated (AND logic)
* **BUY** only when:
* **Bullish TS** is confirmed **and**
* **Volume Delta is bullish** (above 0 or above a user-defined threshold)
* **SELL** only when:
* **Bearish TS** is confirmed **and**
* **Volume Delta is bearish** (below 0 or below a user-defined threshold)
### Inputs you can tune
* **Allow close outside previous range:** switches between a stricter and a more flexible TS interpretation.
* **Delta threshold:** filters signals by requiring stronger delta imbalance.
* **Lower timeframe:** controls delta precision (lower TF = more precise, noisier; higher TF = smoother, less precise).
* Optional: display the **Volume Delta candle plot** in a separate pane.
**In short:** it looks for liquidity sweeps (TS) and only fires a signal when volume flow (delta) supports the direction—**fully confirmed at the bar close**.
### What it does
* **Detects Turtle Soup vs Previous Candle**
* **Bullish TS (BUY trigger):** price sweeps below the previous candle’s low, then closes bullish back above that prior low.
* **Bearish TS (SELL trigger):** price sweeps above the previous candle’s high, then closes bearish back below that prior high.
* Signals are **confirmed only on candle close** (no intrabar repaint).
* **Calculates Volume Delta (lower timeframe scan)**
* The script estimates **net buying vs selling pressure** inside each current bar by scanning a **lower timeframe** and summing:
* *Up-volume* when the lower-TF candle closes ≥ opens
* *Down-volume* when it closes < opens
* The delta is computed **per bar** (it resets every bar), so it reflects *what happened inside that candle*, not a drifting cumulative line.
### How signals are generated (AND logic)
* **BUY** only when:
* **Bullish TS** is confirmed **and**
* **Volume Delta is bullish** (above 0 or above a user-defined threshold)
* **SELL** only when:
* **Bearish TS** is confirmed **and**
* **Volume Delta is bearish** (below 0 or below a user-defined threshold)
### Inputs you can tune
* **Allow close outside previous range:** switches between a stricter and a more flexible TS interpretation.
* **Delta threshold:** filters signals by requiring stronger delta imbalance.
* **Lower timeframe:** controls delta precision (lower TF = more precise, noisier; higher TF = smoother, less precise).
* Optional: display the **Volume Delta candle plot** in a separate pane.
**In short:** it looks for liquidity sweeps (TS) and only fires a signal when volume flow (delta) supports the direction—**fully confirmed at the bar close**.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.