OPEN-SOURCE SCRIPT
Daily Oversold Swing Screener

That script is a **Pine Script Indicator** designed to identify potential **swing trade entry points** on a daily timeframe by looking for stocks that are **oversold** but still in a **healthy long-term uptrend**.
It screens for a high-probability reversal setup by combining four specific technical conditions.
Here is a detailed breakdown of the script's purpose and logic:
---
## 📝 Script Description: Daily Oversold Swing Screener
This Pine Script indicator serves as a **momentum and trend confirmation tool** for active traders seeking short-to-intermediate-term long entries. It uses data calculated on the **Daily** timeframe to generate signals, regardless of the chart resolution you are currently viewing.
The indicator is designed to filter out stocks that are in a strong downtrend ("falling knives") and only signal pullbacks within an established uptrend, which significantly increases the probability of a successful swing trade bounce.
### 🔑 Key Conditions for a Signal:
The indicator generates a buy signal when **all four** of the following conditions are met on the Daily timeframe:
#### 1. Oversold Momentum
* **Condition:** `rsiD < rsiOS` (Daily RSI is below the oversold level, typically **30**).
* **Purpose:** Confirms that the selling pressure has been extreme and the stock is temporarily out of favor, setting up a potential bounce.
#### 2. Momentum Turning Up
* **Condition:** `rsiD > rsiPrev` (Current Daily RSI value is greater than the previous day's Daily RSI value).
* **Purpose:** This is the most crucial filter. It confirms that the momentum has **just started to shift upward**, indicating that the low may be in and the stock is turning away from the oversold region.
#### 3. Established Uptrend (No Falling Knives)
* **Condition:** `sma50 > sma200 and closeD > sma50` (50-day SMA is above the 200-day SMA, AND the current daily close is above the 50-day SMA).
* **Purpose:** This is a **long-term trend filter**. It ensures that the current oversold condition is just a **pullback** within a larger, structurally bullish market (50 > 200), and that the price is still holding above the short-term trend line (Close > 50 SMA). This effectively screens out weak stocks in continuous downtrends.
#### 4. Price at Support (Bollinger Bands)
* **Condition:** `closeD <= lowerBB` (Daily Close is less than or equal to the lower Bollinger Band).
* **Purpose:** Provides a secondary measure of extreme price deviation. When the price touches or breaches the lower band, it suggests a significant move away from the mean (basis), often signaling strong statistical support where price is likely to revert.
### 📌 Summary of Signal
The final signal (`signal`) is triggered only when the market is confirmed to be **in a healthy long-term trend (Condition 3)**, the price is at an **extreme support level (Condition 4)**, the momentum is **oversold (Condition 1)**, and most importantly, the **momentum has begun to reverse (Condition 2)**.
It screens for a high-probability reversal setup by combining four specific technical conditions.
Here is a detailed breakdown of the script's purpose and logic:
---
## 📝 Script Description: Daily Oversold Swing Screener
This Pine Script indicator serves as a **momentum and trend confirmation tool** for active traders seeking short-to-intermediate-term long entries. It uses data calculated on the **Daily** timeframe to generate signals, regardless of the chart resolution you are currently viewing.
The indicator is designed to filter out stocks that are in a strong downtrend ("falling knives") and only signal pullbacks within an established uptrend, which significantly increases the probability of a successful swing trade bounce.
### 🔑 Key Conditions for a Signal:
The indicator generates a buy signal when **all four** of the following conditions are met on the Daily timeframe:
#### 1. Oversold Momentum
* **Condition:** `rsiD < rsiOS` (Daily RSI is below the oversold level, typically **30**).
* **Purpose:** Confirms that the selling pressure has been extreme and the stock is temporarily out of favor, setting up a potential bounce.
#### 2. Momentum Turning Up
* **Condition:** `rsiD > rsiPrev` (Current Daily RSI value is greater than the previous day's Daily RSI value).
* **Purpose:** This is the most crucial filter. It confirms that the momentum has **just started to shift upward**, indicating that the low may be in and the stock is turning away from the oversold region.
#### 3. Established Uptrend (No Falling Knives)
* **Condition:** `sma50 > sma200 and closeD > sma50` (50-day SMA is above the 200-day SMA, AND the current daily close is above the 50-day SMA).
* **Purpose:** This is a **long-term trend filter**. It ensures that the current oversold condition is just a **pullback** within a larger, structurally bullish market (50 > 200), and that the price is still holding above the short-term trend line (Close > 50 SMA). This effectively screens out weak stocks in continuous downtrends.
#### 4. Price at Support (Bollinger Bands)
* **Condition:** `closeD <= lowerBB` (Daily Close is less than or equal to the lower Bollinger Band).
* **Purpose:** Provides a secondary measure of extreme price deviation. When the price touches or breaches the lower band, it suggests a significant move away from the mean (basis), often signaling strong statistical support where price is likely to revert.
### 📌 Summary of Signal
The final signal (`signal`) is triggered only when the market is confirmed to be **in a healthy long-term trend (Condition 3)**, the price is at an **extreme support level (Condition 4)**, the momentum is **oversold (Condition 1)**, and most importantly, the **momentum has begun to reverse (Condition 2)**.
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.