# Alerts

The Alerts system is one of the most advanced features of the Institutional Liquidity and Price Action Concepts \[AlgoAlpha] indicator. It transforms the indicator from a simple visual guide into a fully automated monitoring tool. Instead of watching the charts all day for specific price action events, you can build a precise set of rules and have TradingView notify you only when your exact conditions are met.

#### Quick Steps (how to set alerts):

1. Open the indicator settings
2. Set up alert conditions under the "Alerts" section
3. Ensure conditions are enabled (at least 1 condition is checked)
4. Verify the conditions are working as intended by enabling "Show Historical Alerts"
5. You should see small gray squares along the bottom of the chart; they turn red on bars where the full alert sequence would have fired
6. Enable TradingView's alert (see "**Setting Alerts on TradingView"** section)

**The Logic Engine: Steps and Conditions**

The alert engine is structured around a sequence of up to 7 **Steps**. For an alert to fire, all configured steps must be completed in order. Each step, in turn, can be composed of multiple **Conditions**.

* **Step:** A stage in your alert sequence. Step 1 must be completed before the system starts looking for Step 2, and so on.
* **Condition:** A specific rule that must be met. You can assign up to 7 different conditions to the various steps (Condition 1 through Condition 7).
* **Boolean Operator (AND/OR):** Within a single step, you can combine multiple conditions using `AND` (all conditions must be true) or `OR` (at least one condition must be true).

**Hint: How the Alert Logic Works**

The alert system evaluates conditions for any given step in a specific order. Understanding this is key to building complex alerts correctly.

* **Hierarchy is by Number:** The system processes conditions based on their input number (`Condition 1`, then `Condition 2`, then 3, and so on), not the order you enable them.
* **Boolean Chaining:** The `AND`/`OR` boolean operator for a condition connects it to the logical expression that comes *before* it in the sequence.
* **First Boolean is Ignored:** Because of this chaining, the boolean paired with the lowest-numbered condition on that step (the first entry in that step’s list) is ignored when combining with AND/OR, because chaining starts from the second entry (this matches why Condition 1 has no boolean control in settings).

**Example:** For Step 1, suppose you enable only these (all assigned to Step 1), in condition-number order:

* `Condition 2` (set to `OR`)
* `Condition 4` (set to `AND`)
* `Condition 5` (set to `OR`)

The final logic is evaluated as: (Condition 2 AND Condition 4) OR Condition 5 (left‑to‑right chaining). The OR on Condition 2 is ignored because Condition 2 is the first condition in that step’s ordered list; the AND on Condition 4 and the OR on Condition 5 are the operators that actually combine the next conditions into the chain.

**Example Scenario: High-Confluence Bullish Reversal**

Imagine you want an alert for a high-probability bullish reversal after a Change of Character. Your rules might be:

1. A Bullish Change of Character (CHoCH) must occur, signaling a potential trend shift.
2. After the CHoCH, the price must pull back and hit a liquidity zone.
3. The overall market structure must be bullish as a final confirmation filter.

You would configure this as a 2-step alert:

* **Step 1:** `Condition` = `Bullish CHoCH [Trigger]`
* **Step 2:** `Condition` = `Bullish Liquidity Hit [Trigger]` AND `Market Structure Bullish [State]`

The alert will only fire if a Bullish CHoCH occurs first (Step 1), and then Step 2’s conditions become true—this can happen on the same bar as the CHoCH once Step 1 is marked complete, or on a later bar, depending on when liquidity is hit and structure is bullish.

**Condition Types: Triggers vs. States**

It's crucial to understand the difference between a Trigger and a State.

* **Trigger Conditions:** These are events that happen on a single bar. They are "true" for only one moment.
  * **Example:** `HH Detected [Trigger]`. This is only true on the exact bar where the Higher High label appears.
* **State Conditions:** These are ongoing conditions that can be true for many bars.
  * **Example:** `Market Structure Bullish [State]`. This is true for as long as the indicator's market structure logic remains bullish.

**Best Practice:** A robust alert often combines states and triggers. Use state conditions in the earlier steps to define the ideal market environment, and use a trigger condition in the final step to signal your entry.

**Setting Alerts on TradingView**

After configuring your desired conditions in the indicator's settings, here's how to activate the alert on TradingView.

1. Click on the **Alert** icon (clock) on the right-hand side of your TradingView chart.
2. Under **Condition**, select **"Institutional Liquidity..."**, and then select **`ƒ(𝑥) Any alert() function call`**.
3. Click **Create**.

**Tip:** You can create multiple, different alerts. First, configure the conditions in the indicator settings, then create the alert following the steps above. After the 'Create' button is pressed, that alert is saved with its settings. You can then open the indicator settings again and change the conditions for your next alert without affecting the one you just created.

#### Settings reference: Alerts group

**Show Historical Alerts**

When this is on, the indicator draws **small squares along the bottom** of the chart. They appear **gray** on bars where the full multi-step sequence is **not** satisfied, and **red** on bars where it **would have fired** (same logic as the live alert). Use this to sanity-check and tune your step and condition layout.

**Sequence reset (strict order)**

There is **no** separate “Invalidation Type” control in settings. While a sequence is in progress, the script can **reset the whole sequence** if steps get out of order: **if a later step in your configured list was already completed and an earlier step then completes**, the run is invalidated and counting starts clean. That is the only user-visible “invalidation” behavior for the alert engine in this version.

There are **no** Time Interval, **Reset Timeout (bars)**, or **Invalidate on Step 1** inputs for alerts. (Other inputs—such as **Zone Expiry Age** under Support & Resistance—control how long **drawn zones** stay on the chart; they are **not** the same as an alert-sequence timeout.)

**Condition 1–7 settings**

The indicator exposes **seven** condition rows (not twelve). For each row:

* **Enable** — Turns this row on or off for alert logic.
* **Condition type** — Dropdown of **built-in** triggers and states only (market structure / CHoCH-related events, swing labels, liquidity hits, trend-line events, FOMO bubbles, new S/R zones, and bullish/bearish **market structure state**). There is **no** “external signal” or third-party plot hook in this build.
* **Boolean (AND/OR)** — How this row combines with **earlier rows on the same step** in **condition-number order** (1 → 7). **Condition 1 has no AND/OR control** in the UI; the chaining rules in the alerts hint apply.
* **Step** — Which of **up to seven** sequential steps this row belongs to (1–7).

#### **Available Alert Condition Options**

**Market Structure**

| Condition                          | Description                                                                                           |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `Bullish CHoCH [Trigger]`          | Triggers when the market structure changes from Bearish to Bullish (a previous lower high is broken). |
| `Bearish CHoCH [Trigger]`          | Triggers when the market structure changes from Bullish to Bearish (a previous higher low is broken). |
| `HH Detected [Trigger]`            | Triggers when a new Higher High (HH) swing point is confirmed.                                        |
| `LH Detected [Trigger]`            | Triggers when a new Lower High (LH) swing point is confirmed.                                         |
| `HL Detected [Trigger]`            | Triggers when a new Higher Low (HL) swing point is confirmed.                                         |
| `LL Detected [Trigger]`            | Triggers when a new Lower Low (LL) swing point is confirmed.                                          |
| `Market Structure Bullish [State]` | Is true as long as the overall market structure bias is determined to be Bullish.                     |
| `Market Structure Bearish [State]` | Is true as long as the overall market structure bias is determined to be Bearish.                     |

**Support & Resistance / Liquidity**

| Condition                         | Description                                                                               |
| --------------------------------- | ----------------------------------------------------------------------------------------- |
| `Bullish Liquidity Hit [Trigger]` | Triggers when price interacts with a significant bullish liquidity zone from the Heatmap. |
| `Bearish Liquidity Hit [Trigger]` | Triggers when price interacts with a significant bearish liquidity zone from the Heatmap. |
| `New S/R Zone Formed [Trigger]`   | Triggers on the bar a new Support or Resistance zone is first drawn on the chart.         |

**Trend Lines**

| Condition                             | Description                                                                 |
| ------------------------------------- | --------------------------------------------------------------------------- |
| `Bearish Trend Line Formed [Trigger]` | Triggers when a new bearish trend line (resistance) is confirmed and drawn. |
| `Bullish Trend Line Formed [Trigger]` | Triggers when a new bullish trend line (support) is confirmed and drawn.    |
| `Bearish Trend Line Break [Trigger]`  | Triggers when price closes below a confirmed bullish trend line.            |
| `Bullish Trend Line Break [Trigger]`  | Triggers when price closes above a confirmed bearish trend line.            |

**FOMO Bubbles**

| Condition                             | Description                                        |
| ------------------------------------- | -------------------------------------------------- |
| `Small Bullish FOMO Bubble [Trigger]` | Triggers when a small bullish FOMO bubble appears. |
| `Small Bearish FOMO Bubble [Trigger]` | Triggers when a small bearish FOMO bubble appears. |
| `Big Bullish FOMO Bubble [Trigger]`   | Triggers when a large bullish FOMO bubble appears. |
| `Big Bearish FOMO Bubble [Trigger]`   | Triggers when a large bearish FOMO bubble appears. |
