# VPOF Engine — Volume Profile + Order Flow (Velocity 2.16)

Entry-side signal layer on the existing Premium OF/VP stack. **Does not close positions** and does not touch ProfitScouter.

## Thesis

1. **Volume profile = context** — prior completed session POC / VAH / VAL / HVN / LVN.
2. **Order flow = trigger** — M1 delta / absorption rolled to each closed M5 bar.

Regime first, trigger second. Expect signals on roughly **5–15%** of M5 bars. Flow without a level behind it is noise (`not at a level`).

## Modes (`InpOFVPMode`)

Master switch remains `InpOFVPEnable` (default **false** → Velocity legacy, byte-identical).

| Mode | Behavior |
|---|---|
| **GATE** (default when enabled) | Existing 2.15 sequential gate: engines agree → VP level → OF trigger/veto |
| **FILTER** | Engines agree as usual; non-zero VPOF signal **vetoes** the opposite direction |
| **VOTE** | VPOF is a 4th MinAgree voter when quality allows (PROXY/NONE abstain) |
| **SOLO** | Non-zero VPOF signal may arm entry alone; still subject to spread/fleet/prop/event gates |

## Data quality

| Operator label | Internal | Behavior |
|---|---|---|
| **EXCHANGE** | FULL | Aggressor flags / real volume — full rules |
| **LAST** | FULL | `last` vs bid/ask classify — full rules × `InpVPOFProxyConfidence` |
| **PROXY** | VP_ONLY | FX / bid-ask only — VA location + acceptance; **absorb/delta off** |
| **NONE** | OFF | Abstain entirely |

On FX, signed delta is a **reconstruction**, not exchange-reported volume. Do not treat PROXY confidence as tape truth.

## Regimes (vs prior session VA)

- **BALANCE** — fade VAL/VAH on M1 absorption + close location
- **TREND** — quiet LVN pullback with POC drift (never fade)
- **TRANSITION** — breakout acceptance (POC migrate 2×) or failed auction back to POC

## Key inputs (`InpOFVP*` / `InpVPOF*` / `InpVP*` / `InpOF*`)

| Input | Default | Role |
|---|---|---|
| `InpOFVPEnable` | false | Master off |
| `InpOFVPMode` | GATE | Participation mode |
| `InpVPRowTicks` | 4 | Profile bin width in ticks |
| `InpVPValueAreaPct` | 70 | Value area % |
| `InpVPCryptoLookbackHours` | 24 | Crypto rolling session |
| `InpVPOFLevelProxTicks` | 6 | Level proximity |
| `InpVPOFMinConfidence` | 0.45 | Min fire confidence |
| `InpVPOFCooldownBars` | 2 | Post-signal suppress |
| `InpVPOFSessionEdgeMin` | 15 | Open/close edge suppress |
| `InpOFAbsorbEffPct` | 75 | M1 absorb efficiency percentile |
| `InpOFZWindow` | 60 | M5 z-score window |

## Modules

| File | Role |
|---|---|
| `FlowQuality.mqh` | Tape probe + VPOF labels |
| `VolumeProfile.mqh` | Prior / developing session builds |
| `OrderFlow.mqh` | Legacy tape + M1→M5 absorb rollup |
| `FlowSignal.mqh` | Regime + directional rules |
| `FlowPairing.mqh` | GATE setups / veto |
| `FlowGates.mqh` | Orchestration, modes, `GSX_OFVP_` drawings |

## Self-test

Run script `VPOF_SelfTest.mq5` on a liquid symbol. Confirm:

1. Quality label (FX → PROXY)
2. Prior POC/VAH/VAL and no-lookahead assertion
3. Fire rate in 5–15% over last 50 M5 bars
4. `vp_rebuild_count` = 1 for the run

Do **not** retune thresholds to force the band.

## Chart

- Toggle **OF/VP | OF OFF** — draw + local participation only; never closes
- Status row: regime, arrow, confidence, quality, reason
- Drawings prefix `GSX_OFVP_`: prior POC solid, VAH/VAL dashed, HVN/LVN dotted, developing POC magenta
