PROTECTED SOURCE SCRIPT

Orderblocks with Alerts in 15M Timeframe

Updated
This script is written in Pine Script v5 for TradingView and is used to identify Order Blocks (OBs) based on Fractal patterns. Let's break it down step by step:

## Indicator Settings:
- The script is named "Orderblocks with Alerts" and is overlaid on the price chart. It handles up to 500 bars of data and can draw up to 100 labels and lines.

## Input Options:
- **Fractals:**
- You can enable/disable the fractal feature and choose between a 3-bar or 5-bar fractal pattern.

- **Orderblocks:**
- It detects Order Blocks (OBs) based on the fractal break, using either Close price or High/Low.
- It can also filter OBs if they follow a Fair Value Gap (FVG).

- **Styles:**
- Line styles (solid, dashed, dotted), line length, line width, and colors for bullish/bearish OB lines can be customized.

## Functions:
- **Bullish/Bearish Imbalance:**
- Determines the presence of bullish or bearish imbalances by comparing price bars.

- **Fractal Detection:**
- The script detects fractal highs (local price highs) and fractal lows (local price lows) based on either a 3-bar or 5-bar fractal pattern.

- **Fractal Arrays:**
- Fractal highs and lows are stored in separate arrays to reference them for OB identification.

## Order Block (OB) Detection:
- The script checks for bearish OBs by looking for a price drop following a fractal low and then marking a range of bars where this OB occurred.
- It also identifies bullish OBs by looking for a price rise following a fractal high.
- Lines are drawn on the chart to mark the OB range using either the body or the wick of the candles.
- The script checks for Fair Value Gaps (FVG), and only OBs that meet this condition are plotted.

## Alerts:
- If a new OB is detected, an alert is triggered with a message like "New OB in 15M". This helps traders be aware when a new OB appears.

## Deleting Lines:
- If the price returns to the OB, the corresponding OB lines are deleted, keeping the chart clean and updated.

## Fractal Points:
- The script plots triangles on the chart to mark fractal highs and lows, making it visually easy to identify these points.

## Watermark:
- A watermark is added at the bottom-left corner of the chart to show the creator's signature.

## How to Add the Alert Feature in TradingView:
The script already contains an alert for detecting new OBs with the line:
```pinescript
alert("New OB in 15M", alert.freq_once_per_bar)

In TradingView, after adding this script to your chart:

1. Go to "Alerts" (in the top bar).
2. Set a new alert, selecting the script as the condition.
3. Customize the alert frequency (e.g., "Once Per Bar").
4. Choose how you want to be notified (e.g., pop-up, email, SMS).

## How This Script Helps Traders:

### Order Block Detection:
- OBs are significant zones where institutional traders may have placed large orders. Knowing these zones helps traders make decisions about entries/exits.

### Fractal Points:
- Fractal patterns help identify potential turning points in the market, allowing traders to spot where price might reverse.

### Fair Value Gaps (FVG):
- The script filters OBs that occur near FVGs, which are gaps in price where demand/supply imbalances exist. These are key zones for price retracement.

### Automation:
- With the alert feature, traders don’t need to constantly monitor the chart; they will be notified when a new OB appears.

## Pros and Cons of the Script:

### Pros:
- **Customizable:**
- The script allows you to adjust fractal settings, OB detection methods, line styles, and colors.

- **Visual and Informative:**
- OBs and fractals are clearly marked, making it easy for traders to spot them.

- **Alert Feature:**
- Automatically alerts you when a new OB is detected, reducing the need for constant chart monitoring.

- **Institutional Trading:**
- OBs reflect where large institutional orders may be placed, providing retail traders insights into significant price levels.

### Cons:
- **Complexity:**
- For beginners, the script might be difficult to understand and configure, especially with fractals and FVGs.

- **Performance Impact:**
- The script handles arrays and loops, which might slow down TradingView when applied to large timeframes or many bars.

- **False Signals:**
- OBs are not always respected by the market, so false signals can occur, leading to potential losses if not used with caution.

- **Requires Confirmation:**
- It’s important to combine this indicator with other signals or analysis methods, as OBs and fractals alone may not always provide reliable trade setups.
Release Notes
This script is written in Pine Script v5 for TradingView and is used to identify Order Blocks (OBs) based on Fractal patterns. Let's break it down step by step:

## Indicator Settings:
- The script is named "Orderblocks with Alerts" and is overlaid on the price chart. It handles up to 500 bars of data and can draw up to 100 labels and lines.

## Input Options:
- **Fractals:**
- You can enable/disable the fractal feature and choose between a 3-bar or 5-bar fractal pattern.

- **Orderblocks:**
- It detects Order Blocks (OBs) based on the fractal break, using either Close price or High/Low.
- It can also filter OBs if they follow a Fair Value Gap (FVG).

- **Styles:**
- Line styles (solid, dashed, dotted), line length, line width, and colors for bullish/bearish OB lines can be customized.

## Functions:
- **Bullish/Bearish Imbalance:**
- Determines the presence of bullish or bearish imbalances by comparing price bars.

- **Fractal Detection:**
- The script detects fractal highs (local price highs) and fractal lows (local price lows) based on either a 3-bar or 5-bar fractal pattern.

- **Fractal Arrays:**
- Fractal highs and lows are stored in separate arrays to reference them for OB identification.

## Order Block (OB) Detection:
- The script checks for bearish OBs by looking for a price drop following a fractal low and then marking a range of bars where this OB occurred.
- It also identifies bullish OBs by looking for a price rise following a fractal high.
- Lines are drawn on the chart to mark the OB range using either the body or the wick of the candles.
- The script checks for Fair Value Gaps (FVG), and only OBs that meet this condition are plotted.

## Alerts:
- If a new OB is detected, an alert is triggered with a message like "New OB in 15M". This helps traders be aware when a new OB appears.

## Deleting Lines:
- If the price returns to the OB, the corresponding OB lines are deleted, keeping the chart clean and updated.

## Fractal Points:
- The script plots triangles on the chart to mark fractal highs and lows, making it visually easy to identify these points.

## Watermark:
- A watermark is added at the bottom-left corner of the chart to show the creator's signature.

## How to Add the Alert Feature in TradingView:
The script already contains an alert for detecting new OBs with the line:
```pinescript
alert("New OB in 15M", alert.freq_once_per_bar)

In TradingView, after adding this script to your chart:

1. Go to "Alerts" (in the top bar).
2. Set a new alert, selecting the script as the condition.
3. Customize the alert frequency (e.g., "Once Per Bar").
4. Choose how you want to be notified (e.g., pop-up, email, SMS).

## How This Script Helps Traders:

### Order Block Detection:
- OBs are significant zones where institutional traders may have placed large orders. Knowing these zones helps traders make decisions about entries/exits.

### Fractal Points:
- Fractal patterns help identify potential turning points in the market, allowing traders to spot where price might reverse.

### Fair Value Gaps (FVG):
- The script filters OBs that occur near FVGs, which are gaps in price where demand/supply imbalances exist. These are key zones for price retracement.

### Automation:
- With the alert feature, traders don’t need to constantly monitor the chart; they will be notified when a new OB appears.

## Pros and Cons of the Script:

### Pros:
- **Customizable:**
- The script allows you to adjust fractal settings, OB detection methods, line styles, and colors.

- **Visual and Informative:**
- OBs and fractals are clearly marked, making it easy for traders to spot them.

- **Alert Feature:**
- Automatically alerts you when a new OB is detected, reducing the need for constant chart monitoring.

- **Institutional Trading:**
- OBs reflect where large institutional orders may be placed, providing retail traders insights into significant price levels.

### Cons:
- **Complexity:**
- For beginners, the script might be difficult to understand and configure, especially with fractals and FVGs.

- **Performance Impact:**
- The script handles arrays and loops, which might slow down TradingView when applied to large timeframes or many bars.

- **False Signals:**
- OBs are not always respected by the market, so false signals can occur, leading to potential losses if not used with caution.

- **Requires Confirmation:**
- It’s important to combine this indicator with other signals or analysis methods, as OBs and fractals alone may not always provide reliable trade setups.
Candlestick analysisChart patterns

Protected script

This script is published closed-source and you may privately use it freely.

Want to use this script on a chart?

Disclaimer