# Estrategias Complementarias: ICT y Smart Money Concepts

**Versi\u00f3n:** 1.0.0
**Fecha:** 2025-12-05
**M\u00f3dulo:** OQI-006-ml-signals
**Autor:** Trading Strategist - OrbiQuant IA

---

## Tabla de Contenidos

1. [Introducci\u00f3n](#introducci\u00f3n)
2. [ICT Concepts (Inner Circle Trader)](#ict-concepts-inner-circle-trader)
3. [Smart Money Concepts (SMC)](#smart-money-concepts-smc)
4. [Estrategia de Confluence](#estrategia-de-confluence)
5. [Integraci\u00f3n AMD + ICT + SMC](#integraci\u00f3n-amd--ict--smc)
6. [Implementaci\u00f3n en ML](#implementaci\u00f3n-en-ml)
7. [Referencias](#referencias)

---

## Introducci\u00f3n

Las estrategias ICT (Inner Circle Trader) y Smart Money Concepts (SMC) son metodolog\u00edas complementarias a la estrategia AMD que se enfocan en comprender c\u00f3mo operan las instituciones financieras (market makers, bancos, hedge funds) en los mercados.

### Relaci\u00f3n con AMD

```
┌─────────────────────────────────────────────────────┐
│                  JERARQUÍA DE CONCEPTOS             │
├─────────────────────────────────────────────────────┤
│                                                     │
│  AMD (Marco General)                                │
│  └── Identifica FASES del mercado                  │
│                                                     │
│  ICT (Timing & Zones)                               │
│  └── Identifica CUÁNDO y DÓNDE entrar              │
│                                                     │
│  SMC (Structure & Flow)                             │
│  └── Identifica CÓMO se mueve el dinero            │
│                                                     │
└─────────────────────────────────────────────────────┘
```

### Principio Unificador

**"Follow the Smart Money"** - Todas estas metodolog\u00edas buscan identificar y seguir al dinero institucional, no oponerse a \u00e9l.

---

## ICT Concepts (Inner Circle Trader)

### Fundamentos ICT

ICT es una metodolog\u00eda desarrollada por Michael J. Huddleston que se enfoca en c\u00f3mo los market makers operan para proveer liquidez y generar ganancias.

### 1. Optimal Trade Entry (OTE)

**Definici\u00f3n:** Zona \u00f3ptima de entrada basada en retrocesos Fibonacci

#### Zonas OTE

```
┌─────────────────────────────────────────────────┐
│         FIBONACCI RETRACEMENT ZONES             │
├─────────────────────────────────────────────────┤
│                                                 │
│  100% ────────────────────────────────  High   │
│                                                 │
│   79% ─────────────┐  ┌─────────────           │
│                    │  │  OTE ZONE              │
│   62% ─────────────┘  └─────────────  Premium  │
│                                                 │
│   50% ───────────────────────────────  Equilibrium │
│                                                 │
│   38% ─────────────┐  ┌─────────────  Discount│
│                    │  │  Possible Entry        │
│   21% ─────────────┘  └─────────────           │
│                                                 │
│    0% ────────────────────────────────  Low    │
│                                                 │
└─────────────────────────────────────────────────┘
```

**Zonas Clave:**
- **Premium Zone** (62%-79%): Mejor zona para ventas
- **OTE Zone** (62%-79%): Zona \u00f3ptima de entrada
- **Discount Zone** (21%-38%): Mejor zona para compras

#### Implementaci\u00f3n

```python
def calculate_ote_zones(swing_high, swing_low):
    """
    Calcula zonas OTE para un swing
    """
    range_size = swing_high - swing_low

    zones = {
        # Fibonacci levels
        'fib_0': swing_low,
        'fib_21': swing_low + (range_size * 0.21),
        'fib_38': swing_low + (range_size * 0.38),
        'fib_50': swing_low + (range_size * 0.50),
        'fib_62': swing_low + (range_size * 0.62),
        'fib_79': swing_low + (range_size * 0.79),
        'fib_100': swing_high,

        # Named zones
        'discount_zone': (
            swing_low + (range_size * 0.21),
            swing_low + (range_size * 0.38)
        ),
        'equilibrium': swing_low + (range_size * 0.50),
        'premium_zone': (
            swing_low + (range_size * 0.62),
            swing_low + (range_size * 0.79)
        ),
        'ote_buy': (  # For bullish moves
            swing_low + (range_size * 0.62),
            swing_low + (range_size * 0.79)
        ),
        'ote_sell': (  # For bearish moves
            swing_high - (range_size * 0.79),
            swing_high - (range_size * 0.62)
        )
    }

    return zones
```

#### Estrategia OTE

```
BULLISH SETUP:
1. Identificar impulso alcista reciente
2. Esperar retroceso a zona 62%-79%
3. Buscar confirmaci\u00f3n (order block, FVG, etc.)
4. Entry en rechazo de OTE

BEARISH SETUP:
1. Identificar impulso bajista reciente
2. Esperar rally a zona 62%-79% desde el top
3. Buscar confirmaci\u00f3n bearish
4. Entry en rechazo de OTE
```

### 2. Killzones

**Definici\u00f3n:** Ventanas de tiempo donde la liquidez institucional es m\u00e1s activa

#### Horarios de Killzones (Hora EST)

| Killzone | Inicio (EST) | Fin (EST) | Duraci\u00f3n | Mercado | Caracter\u00edsticas |
|----------|--------------|-----------|----------|---------|---------------------|
| **Asian** | 20:00 | 00:00 | 4h | Tokyo | Rangos estrechos, low volatility |
| **London Open** | 02:00 | 05:00 | 3h | London | Alta volatilidad, tendencias fuertes |
| **New York AM** | 08:30 | 11:00 | 2.5h | NY | M\u00e1xima liquidez, reversiones comunes |
| **London Close** | 10:00 | 12:00 | 2h | London | Cierre de posiciones, volatilidad |
| **New York PM** | 13:30 | 16:00 | 2.5h | NY | Continuaci\u00f3n o reversi\u00f3n de trends |

#### Killzone Preferidas ICT

**London Open Killzone (02:00-05:00 EST):**
- Mayor probabilidad de trending moves
- Instituciones europeas activas
- Mejores setups para breakouts

**New York AM Killzone (08:30-11:00 EST):**
- M\u00e1xima liquidez global
- Overlap London/NY
- Reversiones comunes en 09:30-10:00

#### Implementaci\u00f3n

```python
from datetime import time

def identify_killzone(timestamp):
    """
    Identifica la killzone actual
    timestamp: pd.Timestamp con timezone UTC
    """
    # Convertir a EST
    est_time = timestamp.tz_convert('America/New_York').time()

    killzones = {
        'asian': (time(20, 0), time(0, 0)),
        'london_open': (time(2, 0), time(5, 0)),
        'ny_am': (time(8, 30), time(11, 0)),
        'london_close': (time(10, 0), time(12, 0)),
        'ny_pm': (time(13, 30), time(16, 0))
    }

    for name, (start, end) in killzones.items():
        if start <= est_time <= end:
            return name

    return 'outside_killzone'

def is_high_probability_killzone(killzone):
    """Killzones de alta probabilidad seg\u00fan ICT"""
    return killzone in ['london_open', 'ny_am']
```

#### Features ML para Killzones

```python
# Features derivados de killzones
killzone_features = {
    'is_london_open': 1 if killzone == 'london_open' else 0,
    'is_ny_am': 1 if killzone == 'ny_am' else 0,
    'is_asian': 1 if killzone == 'asian' else 0,
    'is_high_prob_kz': 1 if is_high_probability_killzone(killzone) else 0,
    'session_overlap': 1 if killzone in ['london_close', 'ny_am'] else 0,

    # Time encoding
    'hour_sin': np.sin(2 * np.pi * hour / 24),
    'hour_cos': np.cos(2 * np.pi * hour / 24),

    # Session strength (0-1)
    'session_strength': {
        'asian': 0.3,
        'london_open': 0.9,
        'ny_am': 1.0,
        'london_close': 0.7,
        'ny_pm': 0.6
    }.get(killzone, 0.1)
}
```

### 3. Weekly & Daily Ranges

#### Concepto de Ranges ICT

**Weekly Range:**
- Establecido en la primera semana del mes
- Market makers operan dentro de este rango
- Extensiones com\u00fanmente en +/- 20% del rango

**Daily Range:**
- Establecido en primeras horas (Asian-London)
- 80% de d\u00edas respetan este rango
- Breakouts falsos com\u00fanes al final del d\u00eda

#### C\u00e1lculo de Ranges

```python
def calculate_ict_ranges(df):
    """
    Calcula ranges ICT para an\u00e1lisis
    """
    ranges = {}

    # Weekly range (lunes a viernes)
    df['week'] = df.index.isocalendar().week
    weekly = df.groupby('week').agg({
        'high': 'max',
        'low': 'min',
        'close': 'last'
    })
    ranges['weekly_high'] = weekly['high'].iloc[-1]
    ranges['weekly_low'] = weekly['low'].iloc[-1]
    ranges['weekly_range'] = ranges['weekly_high'] - ranges['weekly_low']

    # Daily range (primeras 8 horas)
    today = df[df.index.date == df.index[-1].date()]
    if len(today) >= 96:  # 8 horas * 12 (5min candles)
        early_session = today.iloc[:96]
        ranges['daily_high'] = early_session['high'].max()
        ranges['daily_low'] = early_session['low'].min()
        ranges['daily_range'] = ranges['daily_high'] - ranges['daily_low']
    else:
        ranges['daily_high'] = today['high'].max()
        ranges['daily_low'] = today['low'].min()
        ranges['daily_range'] = ranges['daily_high'] - ranges['daily_low']

    # Current price position in ranges
    current_price = df['close'].iloc[-1]
    ranges['weekly_position'] = (
        (current_price - ranges['weekly_low']) / ranges['weekly_range']
        if ranges['weekly_range'] > 0 else 0.5
    )
    ranges['daily_position'] = (
        (current_price - ranges['daily_low']) / ranges['daily_range']
        if ranges['daily_range'] > 0 else 0.5
    )

    return ranges
```

#### Trading con Ranges

**Estrategia Inside Range:**
```
SETUP:
- Precio dentro del range establecido
- Buscar reversiones en extremos

LONG ENTRY:
- Precio cerca de low del range (20-30%)
- Confirmaci\u00f3n bullish (order block, FVG)
- Target: High del range

SHORT ENTRY:
- Precio cerca de high del range (70-80%)
- Confirmaci\u00f3n bearish
- Target: Low del range
```

**Estrategia Breakout:**
```
SETUP:
- Precio rompe range establecido
- Alto volumen en breakout

RETEST ENTRY:
- Esperar pullback al nivel de breakout
- Breakout level act\u00faa como soporte/resistencia
- Entry en rechazo del retest
```

### 4. Premium / Discount Pricing

**Concepto:** Market makers compran en "discount" y venden en "premium"

#### Zonas de Precio

```
PREMIUM ZONE (Expensive)
├── 100% ─────────────── High
├──  75% ───────────────
│         SELL ZONE
├──  50% ─────────────── Equilibrium
│         BUY ZONE
├──  25% ───────────────
└──   0% ─────────────── Low
DISCOUNT ZONE (Cheap)
```

**Reglas:**
- **Comprar** solo en Discount Zone (0-50%)
- **Vender** solo en Premium Zone (50-100%)
- **Evitar** entradas cerca de equilibrio (45-55%)

#### Implementaci\u00f3n

```python
def calculate_premium_discount(current_price, range_high, range_low):
    """
    Calcula si precio est\u00e1 en premium o discount
    """
    range_size = range_high - range_low
    if range_size == 0:
        return 0.5, 'equilibrium'

    # Position in range (0 = low, 1 = high)
    position = (current_price - range_low) / range_size

    if position >= 0.75:
        zone = 'extreme_premium'
    elif position >= 0.50:
        zone = 'premium'
    elif position >= 0.25:
        zone = 'discount'
    else:
        zone = 'extreme_discount'

    return position, zone

def get_trading_bias(zone):
    """Bias de trading seg\u00fan zona"""
    bias_map = {
        'extreme_premium': 'strong_sell',
        'premium': 'sell',
        'discount': 'buy',
        'extreme_discount': 'strong_buy'
    }
    return bias_map.get(zone, 'neutral')
```

### 5. Market Maker Models

#### MMSM (Market Maker Sell Model)

```
Fase 1: Distribution (Vendiendo a retail)
         │
         ▼
Fase 2: Inducement (Falsa continuación alcista)
         │
         ▼
Fase 3: Sell Setup (Market makers venden)
         │
         ▼
Fase 4: Manipulation (Stop hunt de largos)
         │
         ▼
Fase 5: Distribution (Caída real)
```

**Caracter\u00edsticas:**
1. Highs consecutivos en zona premium
2. Falso breakout final (inducement)
3. Sweep de liquidity (BSL hunt)
4. Reversi\u00f3n bajista violenta

#### MMBM (Market Maker Buy Model)

```
Fase 1: Accumulation (Comprando de retail)
         │
         ▼
Fase 2: Inducement (Falsa continuaci\u00f3n bajista)
         │
         ▼
Fase 3: Buy Setup (Market makers compran)
         │
         ▼
Fase 4: Manipulation (Stop hunt de cortos)
         │
         ▼
Fase 5: Accumulation (Subida real)
```

**Caracter\u00edsticas:**
1. Lows consecutivos en zona discount
2. Falso breakdown final (inducement)
3. Sweep de liquidity (SSL hunt)
4. Reversi\u00f3n alcista violenta

#### Detecci\u00f3n de MM Models

```python
def detect_market_maker_model(df, lookback=50):
    """
    Detecta patrones de Market Maker
    """
    recent = df.tail(lookback)

    # Calculate range
    range_high = recent['high'].max()
    range_low = recent['low'].min()
    current_price = df['close'].iloc[-1]

    # Check for MMSM (sell model)
    higher_highs = (recent['high'] > recent['high'].shift(1)).sum()
    in_premium = current_price > (range_low + (range_high - range_low) * 0.70)
    liquidity_sweep = detect_bsl_sweep(df.tail(20))

    if higher_highs >= 3 and in_premium and liquidity_sweep:
        return {
            'model': 'MMSM',
            'confidence': 0.8,
            'expected_move': 'bearish',
            'entry_zone': 'wait_for_reversal'
        }

    # Check for MMBM (buy model)
    lower_lows = (recent['low'] < recent['low'].shift(1)).sum()
    in_discount = current_price < (range_low + (range_high - range_low) * 0.30)
    liquidity_sweep = detect_ssl_sweep(df.tail(20))

    if lower_lows >= 3 and in_discount and liquidity_sweep:
        return {
            'model': 'MMBM',
            'confidence': 0.8,
            'expected_move': 'bullish',
            'entry_zone': 'wait_for_reversal'
        }

    return {
        'model': 'none',
        'confidence': 0,
        'expected_move': 'neutral'
    }
```

### 6. Power of 3 (PO3)

**Concepto:** Cada sesi\u00f3n de trading tiene 3 fases

```
┌─────────────────────────────────────────┐
│           POWER OF 3 PHASES             │
├─────────────────────────────────────────┤
│                                         │
│  1. ACCUMULATION/DISTRIBUTION           │
│     │ Inicio de sesi\u00f3n               │
│     │ Rangos estrechos                  │
│     │ Low volume                        │
│     ▼                                   │
│                                         │
│  2. MANIPULATION                        │
│     │ Caza de liquidez                  │
│     │ False breakouts                   │
│     │ Spikes de volumen                 │
│     ▼                                   │
│                                         │
│  3. DISTRIBUTION/ACCUMULATION           │
│     │ Movimiento real                   │
│     │ Trending price action             │
│     │ Objetivo alcanzado                │
│     ▼                                   │
│                                         │
└─────────────────────────────────────────┘
```

**Aplicaci\u00f3n:**
- Fase 1 (Primeras 2 horas): Observar, no operar
- Fase 2 (Horas 3-4): Identificar manipulaci\u00f3n
- Fase 3 (Horas 5+): Operar el movimiento real

---

## Smart Money Concepts (SMC)

### Fundamentos SMC

SMC es una metodolog\u00eda que se enfoca en la estructura del mercado y c\u00f3mo el dinero institucional crea setups de trading.

### 1. Change of Character (CHOCH)

**Definici\u00f3n:** Cambio en la estructura del mercado que indica posible reversi\u00f3n

#### CHOCH Bullish

```
ESTRUCTURA BAJISTA → CHOCH → ESTRUCTURA ALCISTA

Lower High    Lower High
    \            /
     \          /
      \        /        Higher High
       \      /            /\
        \    /            /  \
         \  /     CHOCH  /    \
    Lower Low          /      \
              \       /        \
               \     /          \
                \   /    Higher Low
                 \ /
            Lower Low
```

**Criterios:**
1. Mercado en tendencia bajista (lower highs, lower lows)
2. Precio rompe \u00faltimo lower high
3. Formaci\u00f3n de higher low
4. **CHOCH confirmado** cuando precio supera previous high

#### CHOCH Bearish

```
ESTRUCTURA ALCISTA → CHOCH → ESTRUCTURA BAJISTA

Higher Low   Higher Low
    /            \
   /              \
  /                \        Lower Low
 /                  \          /
/              CHOCH \        /
    Higher High       \      /
                       \    /
                        \  /    Lower High
                         \/
                   Higher High
```

#### Implementaci\u00f3n

```python
def detect_choch(df, window=20):
    """
    Detecta Change of Character
    """
    choch_signals = []

    for i in range(window * 2, len(df)):
        # Identify recent swings
        recent = df.iloc[i-window:i]

        # Swing highs/lows
        swing_highs = recent[recent['high'] == recent['high'].rolling(5, center=True).max()]
        swing_lows = recent[recent['low'] == recent['low'].rolling(5, center=True).min()]

        if len(swing_highs) >= 2 and len(swing_lows) >= 2:
            # Check for bullish CHOCH
            # Previous structure: lower lows
            prev_lows = swing_lows['low'].values[-2:]
            if prev_lows[1] < prev_lows[0]:
                # Break of previous high
                prev_high = swing_highs['high'].values[-2]
                if df['close'].iloc[i] > prev_high:
                    choch_signals.append({
                        'type': 'bullish_choch',
                        'index': i,
                        'price': df['close'].iloc[i],
                        'broken_level': prev_high
                    })

            # Check for bearish CHOCH
            # Previous structure: higher highs
            prev_highs = swing_highs['high'].values[-2:]
            if prev_highs[1] > prev_highs[0]:
                # Break of previous low
                prev_low = swing_lows['low'].values[-2]
                if df['close'].iloc[i] < prev_low:
                    choch_signals.append({
                        'type': 'bearish_choch',
                        'index': i,
                        'price': df['close'].iloc[i],
                        'broken_level': prev_low
                    })

    return choch_signals
```

### 2. Break of Structure (BOS)

**Definici\u00f3n:** Continuaci\u00f3n de la estructura existente, confirmando la tendencia

#### BOS Bullish (Continuaci\u00f3n alcista)

```
Higher High #2
      /\
     /  \
    /    \
   /      \      Higher High #1
  /        \        /\
 /          \      /  \
/     BOS    \    /    \
      →       \  /      \
               \/        \
         Higher Low       \
                           \
                    Higher Low
```

**Criterios:**
1. Tendencia alcista establecida
2. Precio rompe previous higher high
3. **BOS confirmado**
4. Esperar pullback para entrada

#### BOS Bearish (Continuaci\u00f3n bajista)

```
Lower Low #1
    \
     \        Lower Low #2
      \          /
       \        /
        \      /
         \    /      BOS
          \  /        ←
           \/
     Lower High
              \
               \
          Lower High
```

#### Diferencia BOS vs CHOCH

| Aspecto | BOS | CHOCH |
|---------|-----|-------|
| **Direcci\u00f3n** | Continuaci\u00f3n | Reversi\u00f3n |
| **Estructura** | Confirma tendencia | Rompe tendencia |
| **Trading** | Entrar en direcci\u00f3n del BOS | Entrar contra tendencia previa |
| **Riesgo** | Menor (con tendencia) | Mayor (contra tendencia) |

#### Implementaci\u00f3n

```python
def detect_bos(df, window=20):
    """
    Detecta Break of Structure
    """
    bos_signals = []

    for i in range(window * 2, len(df)):
        recent = df.iloc[i-window:i]

        # Swing points
        swing_highs = recent[recent['high'] == recent['high'].rolling(5, center=True).max()]
        swing_lows = recent[recent['low'] == recent['low'].rolling(5, center=True).min()]

        if len(swing_highs) >= 2 and len(swing_lows) >= 2:
            # Bullish BOS (uptrend continuation)
            prev_highs = swing_highs['high'].values[-2:]
            prev_lows = swing_lows['low'].values[-2:]

            # Check for higher highs and higher lows
            if prev_highs[1] > prev_highs[0] and prev_lows[1] > prev_lows[0]:
                # Current price breaks recent high
                if df['close'].iloc[i] > prev_highs[1]:
                    bos_signals.append({
                        'type': 'bullish_bos',
                        'index': i,
                        'price': df['close'].iloc[i],
                        'broken_level': prev_highs[1],
                        'trend': 'uptrend'
                    })

            # Bearish BOS (downtrend continuation)
            if prev_highs[1] < prev_highs[0] and prev_lows[1] < prev_lows[0]:
                # Current price breaks recent low
                if df['close'].iloc[i] < prev_lows[1]:
                    bos_signals.append({
                        'type': 'bearish_bos',
                        'index': i,
                        'price': df['close'].iloc[i],
                        'broken_level': prev_lows[1],
                        'trend': 'downtrend'
                    })

    return bos_signals
```

### 3. Inducement

**Definici\u00f3n:** Movimiento falso dise\u00f1ado para atraer traders retail antes de la reversi\u00f3n real

#### Tipos de Inducement

**Bullish Inducement (antes de subida):**
```
                    ┌─── Real Move (Up)
                    │
                   /
                  /
    ────────────/────────── Resistance
               /
              /
    ─────────┼────────────── Support
             │\
             │ \
             │  └─ Inducement (falso break down)
             │     [Trap para cortos]
             ▼
      [Stop Loss Hunt]
```

**Bearish Inducement (antes de caída):**
```
      [Stop Loss Hunt]
             ▲
             │
             │  ┌─ Inducement (falso break up)
             │ /   [Trap para largos]
             │/
    ─────────┼────────────── Resistance
              \
               \
    ────────────\────────── Support
                 \
                  \
                   └─── Real Move (Down)
```

#### Caracter\u00edsticas

1. **Falso breakout** de nivel clave
2. **R\u00e1pida reversi\u00f3n** (1-3 candles)
3. **Caza de stops** de traders retail
4. **Precede** al movimiento real

#### Detecci\u00f3n

```python
def detect_inducement(df, key_levels, window=5):
    """
    Detecta movimientos de inducement
    """
    inducements = []

    for i in range(window, len(df)):
        # Check for false breakouts of key levels
        for level in key_levels:
            # Bullish inducement (false breakdown)
            if df['low'].iloc[i] < level['price'] * 0.998:
                # Rapid reversal
                if df['close'].iloc[i] > level['price']:
                    # Confirm reversal continues
                    if i < len(df) - 2:
                        next_closes = df['close'].iloc[i+1:i+3]
                        if (next_closes > level['price']).all():
                            inducements.append({
                                'type': 'bullish_inducement',
                                'index': i,
                                'level': level['price'],
                                'low': df['low'].iloc[i],
                                'close': df['close'].iloc[i],
                                'expected_move': 'up'
                            })

            # Bearish inducement (false breakout)
            elif df['high'].iloc[i] > level['price'] * 1.002:
                # Rapid reversal
                if df['close'].iloc[i] < level['price']:
                    # Confirm reversal continues
                    if i < len(df) - 2:
                        next_closes = df['close'].iloc[i+1:i+3]
                        if (next_closes < level['price']).all():
                            inducements.append({
                                'type': 'bearish_inducement',
                                'index': i,
                                'level': level['price'],
                                'high': df['high'].iloc[i],
                                'close': df['close'].iloc[i],
                                'expected_move': 'down'
                            })

    return inducements
```

### 4. Displacement

**Definici\u00f3n:** Movimiento r\u00e1pido y fuerte que indica entrada de dinero institucional

#### Caracter\u00edsticas de Displacement

```
Displacement Bullish:
                          ┌── Strong momentum
                         /│
                        / │
                       /  │   Large candles
                      /   │
                     /    │   High volume
    ────────────────/─────┴────────
                   /
                  │  Displacement
                  │  (3-5 candles up)
                  │
           [Institutional Entry]
```

**Criterios:**
1. **3-5 candles** consecutivos en misma direcci\u00f3n
2. **Cuerpos grandes** (> 70% del rango)
3. **Volumen alto** (> 1.5x promedio)
4. **Movimiento > 1.5 * ATR**
5. **Sin retrocesos** significativos

#### Implementaci\u00f3n

```python
def detect_displacement(df, min_candles=3, min_atr_multiple=1.5):
    """
    Detecta movimientos de displacement
    """
    atr = calculate_atr(df, 14)
    displacements = []

    for i in range(min_candles, len(df)):
        # Check last N candles
        recent = df.iloc[i-min_candles:i+1]

        # Bullish displacement
        all_bullish = (recent['close'] > recent['open']).all()
        large_bodies = ((recent['close'] - recent['open']).abs() / (recent['high'] - recent['low']) > 0.7).all()
        high_volume = (recent['volume'] > recent['volume'].rolling(20).mean() * 1.5).any()
        strong_move = (recent['close'].iloc[-1] - recent['close'].iloc[0]) > (atr.iloc[i] * min_atr_multiple)

        if all_bullish and large_bodies and high_volume and strong_move:
            displacements.append({
                'type': 'bullish_displacement',
                'index': i,
                'start_price': recent['close'].iloc[0],
                'end_price': recent['close'].iloc[-1],
                'move_size': recent['close'].iloc[-1] - recent['close'].iloc[0],
                'candles': min_candles,
                'strength': (recent['close'].iloc[-1] - recent['close'].iloc[0]) / atr.iloc[i]
            })

        # Bearish displacement
        all_bearish = (recent['close'] < recent['open']).all()
        strong_move_down = (recent['close'].iloc[0] - recent['close'].iloc[-1]) > (atr.iloc[i] * min_atr_multiple)

        if all_bearish and large_bodies and high_volume and strong_move_down:
            displacements.append({
                'type': 'bearish_displacement',
                'index': i,
                'start_price': recent['close'].iloc[0],
                'end_price': recent['close'].iloc[-1],
                'move_size': recent['close'].iloc[0] - recent['close'].iloc[-1],
                'candles': min_candles,
                'strength': (recent['close'].iloc[0] - recent['close'].iloc[-1]) / atr.iloc[i]
            })

    return displacements
```

### 5. Liquidity Voids

**Definici\u00f3n:** Zonas con muy poco volumen donde precio se movi\u00f3 r\u00e1pido (similar a FVG pero con enfoque en volumen)

```
High Volume Node
    │
    ▼
────────────────
               │
               │ Liquidity Void
               │ (low volume area)
               │
    ┌──────────┘
    │
────┴────────────
    │
Low Volume Node
```

**Uso:**
- Voids act\u00faan como im\u00e1n para el precio
- Alta probabilidad de que precio vuelva a rellenar
- Zonas de entrada de bajo riesgo

---

## Estrategia de Confluence

### Concepto de Confluence

**Confluence = Confluencia de m\u00faltiples factores alcistas/bajistas**

Cuantos m\u00e1s factores apunten en la misma direcci\u00f3n, mayor probabilidad de \u00e9xito.

### Sistema de Scoring

#### Factores Alcistas (Bullish Confluence)

| Factor | Peso | Criterio |
|--------|------|----------|
| **AMD Phase** | 25% | Accumulation confirmada |
| **ICT OTE** | 20% | Precio en discount zone (21-38%) |
| **ICT Killzone** | 15% | London Open o NY AM |
| **SMC CHOCH** | 15% | Bullish CHOCH reciente |
| **Order Block** | 10% | Bullish OB cerca |
| **FVG** | 5% | Bullish FVG sin rellenar |
| **Liquidity** | 5% | SSL sweep reciente |
| **Displacement** | 5% | Bullish displacement |

#### C\u00e1lculo de Confluence Score

```python
def calculate_confluence_score(signals):
    """
    Calcula score de confluence (0-1)
    """
    weights = {
        'amd_accumulation': 0.25,
        'ict_ote_discount': 0.20,
        'ict_killzone_high': 0.15,
        'smc_bullish_choch': 0.15,
        'order_block_bullish': 0.10,
        'fvg_bullish': 0.05,
        'ssl_sweep': 0.05,
        'displacement_bullish': 0.05
    }

    score = 0.0
    active_signals = []

    for signal, weight in weights.items():
        if signals.get(signal, False):
            score += weight
            active_signals.append(signal)

    return {
        'score': score,
        'active_signals': active_signals,
        'num_confirmations': len(active_signals),
        'bias': 'bullish' if score >= 0.6 else 'neutral'
    }
```

### Niveles de Confluence

| Score | Nivel | Acci\u00f3n |
|-------|-------|---------|
| **0.80-1.00** | Excelente | Tama\u00f1o de posici\u00f3n completo |
| **0.60-0.79** | Buena | Tama\u00f1o de posici\u00f3n reducido (70%) |
| **0.40-0.59** | Media | Solo operar con confirmaci\u00f3n adicional |
| **0.00-0.39** | Baja | Evitar entrada |

### Ejemplo de Setup de Alta Confluence

```
BTCUSDT - 2024-12-05 09:30 EST

FACTORES ALCISTAS ACTIVOS:
✓ AMD Phase: Accumulation (confidence: 0.78)
✓ ICT OTE: Precio en 32% del rango (discount)
✓ ICT Killzone: NY AM (09:30)
✓ SMC CHOCH: Bullish CHOCH hace 15 min
✓ Order Block: Bullish OB a $89,200
✓ SSL Sweep: Sweep de low hace 30 min

CONFLUENCE SCORE: 0.85 (Excelente)

SETUP:
Entry: $89,350
Stop Loss: $89,150 (below SSL sweep)
Take Profit: $90,100 (weekly high)
R:R: 3.75:1

RESULTADO:
TP alcanzado en 2.5 horas
+$750 (+0.84%)
```

---

## Integraci\u00f3n AMD + ICT + SMC

### Framework Unificado

```
┌─────────────────────────────────────────────────────┐
│              ANÁLISIS MULTI-LAYER                   │
├─────────────────────────────────────────────────────┤
│                                                     │
│  LAYER 1: AMD (Fase del Mercado)                   │
│  ├─ Accumulation / Manipulation / Distribution     │
│  └─ Determina DIRECCI\u00d3N general                   │
│                                                     │
│  LAYER 2: ICT (Timing & Zonas)                     │
│  ├─ Killzones (CU\u00c1NDO operar)                     │
│  ├─ OTE Zones (D\u00d3NDE entrar)                       │
│  └─ Premium/Discount (PRECIO)                      │
│                                                     │
│  LAYER 3: SMC (Estructura & Confirmaci\u00f3n)         │
│  ├─ BOS/CHOCH (Estructura)                         │
│  ├─ Inducement (Trampas)                           │
│  └─ Displacement (Fuerza)                          │
│                                                     │
│  LAYER 4: ML Models (Predicci\u00f3n)                  │
│  ├─ RangePredictor (Delta High/Low)                │
│  ├─ TPSLClassifier (Probabilidad TP)               │
│  └─ SignalGenerator (Se\u00f1al final)                 │
│                                                     │
└─────────────────────────────────────────────────────┘
```

### Decision Tree

```python
def unified_trading_decision(market_data, models):
    """
    Framework unificado de decisi\u00f3n
    """
    decision = {
        'action': 'hold',
        'confidence': 0.0,
        'reasoning': []
    }

    # LAYER 1: AMD Phase
    amd_phase = models['amd_detector'].detect_phase(market_data)
    if amd_phase['phase'] == 'accumulation' and amd_phase['confidence'] > 0.7:
        decision['reasoning'].append('AMD: Strong accumulation phase')
        decision['confidence'] += 0.25
        decision['bias'] = 'bullish'
    elif amd_phase['phase'] == 'distribution' and amd_phase['confidence'] > 0.7:
        decision['reasoning'].append('AMD: Strong distribution phase')
        decision['confidence'] += 0.25
        decision['bias'] = 'bearish'
    else:
        decision['reasoning'].append(f'AMD: {amd_phase["phase"]} (low conviction)')
        return decision  # Exit early if no clear phase

    # LAYER 2: ICT
    killzone = identify_killzone(market_data['timestamp'].iloc[-1])
    if is_high_probability_killzone(killzone):
        decision['reasoning'].append(f'ICT: High probability killzone ({killzone})')
        decision['confidence'] += 0.15

    ote_zones = calculate_ote_zones(
        market_data['high'].tail(50).max(),
        market_data['low'].tail(50).min()
    )
    current_price = market_data['close'].iloc[-1]
    position, zone = calculate_premium_discount(
        current_price,
        ote_zones['fib_100'],
        ote_zones['fib_0']
    )

    if decision['bias'] == 'bullish' and zone in ['discount', 'extreme_discount']:
        decision['reasoning'].append(f'ICT: Price in {zone} zone (good buy area)')
        decision['confidence'] += 0.20
    elif decision['bias'] == 'bearish' and zone in ['premium', 'extreme_premium']:
        decision['reasoning'].append(f'ICT: Price in {zone} zone (good sell area)')
        decision['confidence'] += 0.20

    # LAYER 3: SMC
    choch_signals = detect_choch(market_data)
    bos_signals = detect_bos(market_data)

    if decision['bias'] == 'bullish':
        bullish_choch = [s for s in choch_signals if s['type'] == 'bullish_choch']
        if bullish_choch and len(bullish_choch) > 0:
            decision['reasoning'].append('SMC: Recent bullish CHOCH')
            decision['confidence'] += 0.15

        bullish_bos = [s for s in bos_signals if s['type'] == 'bullish_bos']
        if bullish_bos:
            decision['reasoning'].append('SMC: Bullish BOS confirms uptrend')
            decision['confidence'] += 0.10

    # LAYER 4: ML Predictions
    range_pred = models['range_predictor'].predict(market_data)
    tpsl_pred = models['tpsl_classifier'].predict(market_data, current_price)

    if decision['bias'] == 'bullish':
        if range_pred['delta_high'] > range_pred['delta_low'] * 2:
            decision['reasoning'].append('ML: Range predictor favors upside')
            decision['confidence'] += 0.15

        relevant_tpsl = [p for p in tpsl_pred if p.recommended_action == 'long']
        if relevant_tpsl and relevant_tpsl[0].prob_tp_first > 0.65:
            decision['reasoning'].append(f'ML: High TP probability ({relevant_tpsl[0].prob_tp_first:.2%})')
            decision['confidence'] += 0.15

    # Final decision
    if decision['confidence'] >= 0.70:
        decision['action'] = 'long' if decision['bias'] == 'bullish' else 'short'
    elif decision['confidence'] >= 0.50:
        decision['action'] = 'wait_confirmation'
    else:
        decision['action'] = 'hold'

    return decision
```

---

## Implementaci\u00f3n en ML

### Features Derivados de ICT/SMC

```python
# Features ICT
ict_features = {
    # OTE
    'ote_position': position_in_range,  # 0-1
    'in_discount_zone': 1 if position < 0.38 else 0,
    'in_premium_zone': 1 if position > 0.62 else 0,
    'in_ote_buy_zone': 1 if 0.62 <= position <= 0.79 else 0,
    'in_ote_sell_zone': 1 if 0.21 <= position <= 0.38 else 0,

    # Killzones
    'is_london_kz': 1 if killzone == 'london_open' else 0,
    'is_ny_kz': 1 if killzone == 'ny_am' else 0,
    'killzone_strength': session_strength,

    # Ranges
    'weekly_range_position': weekly_position,
    'daily_range_position': daily_position,
    'range_expansion': current_range / average_range,

    # Market Maker Models
    'mmsm_detected': 1 if mm_model == 'MMSM' else 0,
    'mmbm_detected': 1 if mm_model == 'MMBM' else 0,
}

# Features SMC
smc_features = {
    # Structure
    'choch_bullish_recent': count_recent_bullish_choch(),
    'choch_bearish_recent': count_recent_bearish_choch(),
    'bos_bullish_recent': count_recent_bullish_bos(),
    'bos_bearish_recent': count_recent_bearish_bos(),

    # Inducement
    'inducement_detected': 1 if inducement_count > 0 else 0,
    'inducement_type': encode_inducement_type(),

    # Displacement
    'displacement_strength': displacement_atr_multiple,
    'displacement_direction': 1 if displacement == 'bullish' else -1 if displacement == 'bearish' else 0,

    # Liquidity
    'liquidity_void_proximity': distance_to_nearest_void,
    'void_fill_probability': calculate_void_fill_prob(),
}

# Combined feature vector
all_features = {
    **base_technical_features,
    **amd_features,
    **ict_features,
    **smc_features
}
```

### Target Engineering

```python
def label_with_confluence(df, i, forward_window=18):
    """
    Etiqueta considerando confluence de se\u00f1ales
    """
    future = df.iloc[i:i+forward_window]

    # Calculate confluence at time i
    confluence = calculate_confluence_score({
        'amd_accumulation': check_amd_accumulation(df, i),
        'ict_ote_discount': check_ote_discount(df, i),
        'ict_killzone_high': check_high_prob_killzone(df, i),
        'smc_bullish_choch': check_bullish_choch(df, i),
        # ... otros
    })

    # Success criteria based on confluence
    if confluence['score'] >= 0.7:
        # High confluence → higher target
        target_move = future['high'].max() / df['close'].iloc[i] - 1
        if target_move >= 0.015:  # 1.5% move
            return 1  # Strong buy
        elif target_move >= 0.008:  # 0.8% move
            return 0.5  # Weak buy
    elif confluence['score'] >= 0.5:
        # Medium confluence → normal target
        target_move = future['high'].max() / df['close'].iloc[i] - 1
        if target_move >= 0.01:  # 1% move
            return 1

    return 0  # No signal
```

---

## Referencias

### ICT Resources

1. **Inner Circle Trader YouTube** - Free educational series
2. **ICT Mentorship 2022** - Comprehensive course
3. **The Forex Mindset** - ICT concepts breakdown

### SMC Resources

4. **The Trading Channel** - SMC tutorials
5. **Stacey Burke Trading** - SMC + price action
6. **GCT (Global Capital Trading)** - SMC framework

### Combined Methodologies

7. **Trading Rush** - AMD + ICT integration
8. **Forex Mastery** - Multi-concept confluence
9. **The Secret Mindset** - Institutional trading logic

### Academic Background

10. Harris, L. (2003). "Trading and Exchanges" - Market microstructure
11. Aldridge, I. (2013). "High-Frequency Trading" - Institutional behavior
12. Narang, R. (2013). "Inside the Black Box" - Quant strategies

---

**Documento Generado:** 2025-12-05
**Pr\u00f3xima Revisi\u00f3n:** 2025-Q1
**Contacto:** trading-strategist@orbiquant.ai
