PROTECTED SOURCE SCRIPT
H4 C2 detector

This script is a multi‑stage tool for detecting CISD-based reversals, H4 C2 setups, and related liquidity structures on any chart timeframe.
Purpose
The indicator combines a CISD swing/reversal engine (Stage 1) with higher‑timeframe H4 Fair Value Gaps (FVGs), Order Blocks (OBs), and swing levels (Stage 2 & 3) to confirm a C2 reversal signal with higher‑timeframe confluence.
Stage 1 – CISD swing engine
Stage 1 tracks bullish and bearish swing sequences using pivots and liquidity‑sweep logic.
You can choose the detection method: Classic vs Liquidity Sweep, plus swing length and minimum/maximum sequence duration.
The script builds and maintains arrays of swing highs/lows and “bins” (bullish/bearish lines) that turn from one color to the other once price breaks them with enough duration, flipping an internal trend state between bullish, bearish, or neutral.
Labels (“CISD”) and dashed lines are drawn when a valid CISD swing reversal is confirmed, visually showing where the current trend flipped.
Stage 2 – H4 structure (FVG, OB, swings)
Stage 2 pulls H4 data on any chart to add higher‑timeframe context.
It requests H4 OHLC, then detects H4 bullish/bearish FVGs and optionally plots their CE (consequent encroachment) levels with boxes and dashed lines.
It marks confirmed H4 order blocks (bullish from down candles broken up, bearish from up candles broken down) and tracks whether they remain mitigated or not.
It also identifies H4 swing highs and lows, draws dotted lines for active swing levels, and flags when they are mitigated or should be hidden.
Stage 3 – C2 confirmation and alerts
Stage 3 ties the CISD trend state with the H4 structure to define and confirm C2 signals.
Boolean flags c2_bull and c2_bear turn true when the CISD trend aligns with price interacting correctly with H4 swing lines and, optionally, FVG/OB context.
The script plots C2 markers (up/down triangles) on the chart when bullish or bearish C2 conditions are met.
It defines alertcondition() for bullish, bearish, and “any” C2 reversals and also triggers a bar‑close alert when any C2 signal confirms, so you can set TradingView alerts for automated notifications.
Final table and bias display
To summarize state, the script shows a compact table in the top‑right corner of the chart.
Row 1 shows “Daily Bias” derived from the CISD engine (BULLISH, BEARISH, or NEUTRAL) with matching colors.
Row 2 shows the H4 C2 status as CONFIRMED or WAITING, helping you quickly see whether a valid higher‑timeframe‑aligned reversal has printed.
Credits: LuxAlgo(CICD) indicator
Purpose
The indicator combines a CISD swing/reversal engine (Stage 1) with higher‑timeframe H4 Fair Value Gaps (FVGs), Order Blocks (OBs), and swing levels (Stage 2 & 3) to confirm a C2 reversal signal with higher‑timeframe confluence.
Stage 1 – CISD swing engine
Stage 1 tracks bullish and bearish swing sequences using pivots and liquidity‑sweep logic.
You can choose the detection method: Classic vs Liquidity Sweep, plus swing length and minimum/maximum sequence duration.
The script builds and maintains arrays of swing highs/lows and “bins” (bullish/bearish lines) that turn from one color to the other once price breaks them with enough duration, flipping an internal trend state between bullish, bearish, or neutral.
Labels (“CISD”) and dashed lines are drawn when a valid CISD swing reversal is confirmed, visually showing where the current trend flipped.
Stage 2 – H4 structure (FVG, OB, swings)
Stage 2 pulls H4 data on any chart to add higher‑timeframe context.
It requests H4 OHLC, then detects H4 bullish/bearish FVGs and optionally plots their CE (consequent encroachment) levels with boxes and dashed lines.
It marks confirmed H4 order blocks (bullish from down candles broken up, bearish from up candles broken down) and tracks whether they remain mitigated or not.
It also identifies H4 swing highs and lows, draws dotted lines for active swing levels, and flags when they are mitigated or should be hidden.
Stage 3 – C2 confirmation and alerts
Stage 3 ties the CISD trend state with the H4 structure to define and confirm C2 signals.
Boolean flags c2_bull and c2_bear turn true when the CISD trend aligns with price interacting correctly with H4 swing lines and, optionally, FVG/OB context.
The script plots C2 markers (up/down triangles) on the chart when bullish or bearish C2 conditions are met.
It defines alertcondition() for bullish, bearish, and “any” C2 reversals and also triggers a bar‑close alert when any C2 signal confirms, so you can set TradingView alerts for automated notifications.
Final table and bias display
To summarize state, the script shows a compact table in the top‑right corner of the chart.
Row 1 shows “Daily Bias” derived from the CISD engine (BULLISH, BEARISH, or NEUTRAL) with matching colors.
Row 2 shows the H4 C2 status as CONFIRMED or WAITING, helping you quickly see whether a valid higher‑timeframe‑aligned reversal has printed.
Credits: LuxAlgo(CICD) indicator
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarle liberamente e senza alcuna limitazione – ulteriori informazioni qui.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarle liberamente e senza alcuna limitazione – ulteriori informazioni qui.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.