Dynamic Anchor Flow & Pressure Profile

496
# Dynamic Anchor Flow & Pressure Profile (DAFP Profile)

### 1. Introduction: What It Is & Purpose
The **Dynamic Anchor Flow & Pressure Profile (DAFP Profile)** is an advanced order-flow and market-microstructure visualization tool engineered for TradingView Pine Script v6. Traditional moving averages and trend baselines only tell traders where the average price has been, leaving the space between the baseline and current price completely empty. Conversely, traditional volume profiles aggregate activity across static horizontal price buckets over fixed sessions, often lagging behind rapid trend transitions.

The **DAFP Profile** bridges this gap by transforming the empty "corridor" between a dynamic trend baseline (the Anchor) and each candle’s real body into a **12-band rolling pressure heatmap**. Its primary purpose is to reveal whether the price space supporting a trend expansion is backed by genuine buying accumulation, distribution, wick rejection forces, or exhaustion—and to pinpoint high-probability **BUY** and **SELL** order entry signals when structural trend alignment meets dominant localized pressure.

---
### 2. Core Mechanism: How It Detects Trading Signals
At the heart of the indicator is a multi-stage mathematical engine that decomposes price action and volume into localized pressure fields before projecting them across a 12-level geometric corridor:

* **Dynamic Anchor Baseline:** Users can anchor the profile to an **EMA, SMA, VWMA, VWAP, or Donchian Midline**. If volume-dependent baselines (`VWMA` or `VWAP`) lack volume data on specific feeds, the script automatically falls back to an EMA to ensure uninterrupted rendering.
* **Intrabar & Chart-Level Pressure Decomposition:** When Lower Timeframe (LTF) mode is active, the script fetches up to 90 intrabar candles per chart bar via `request.security_lower_tf()`. For every step, it evaluates three normalized geometric ratios relative to the bar’s range:
1. **Directional Efficiency** (open-to-close body displacement),
2. **Bar-to-Bar Travel** (close-to-previous-close momentum), and
3. **Close Location Value** (where the close settles within the high-low range).
These three components are blended into a composite **Response Score** (`0.55 * travel + 0.25 * directional + 0.20 * closeLoc`) and multiplied by a **Continuation Factor** (`1.45` when momentum aligns with the prior step, `0.55` when reversing).
* **Five-Component Force & Centroid Mapping:** Each bar’s activity is separated into five distinct forces—**Buy Thrust, Sell Thrust, Lower-Wick Bullish Rejection, Upper-Wick Bearish Rejection, and Indecision Stall**—each assigned to its exact price center of gravity (centroid). The forces are then normalized against a 55-bar exponential baseline (`flowScale`) so sudden volume or volatility spikes are scaled proportionally.
* **12-Band Cubic Kernel Corridor:** Whenever a candle’s body separates from the Anchor line, the space between the Anchor and the nearest body edge is sliced into **12 equal micro-bands**. For each band, the engine scans backward up to **60 bars**, accumulating historical buying and selling forces using a smooth **Cubic Kernel function** $q^2(3 - 2q)$ weighted by an exponential **Age Decay** ($\text{half-life} = 3\text{ bars}$). This ensures recent price memory and nearby price centroids exert the strongest influence on each band's color and opacity.
* **Order Entry Signal Detection:** A **BUY** or **SELL** signal is triggered only on the first bar where five strict conditions converge:
1. At least `minBands` (default 7 of 12) are actively populated with visible pressure.
2. Price closes on the trend side of the Anchor (`close > anchor` for Buy; `close < anchor` for Sell) while the Anchor itself slopes in the same direction.
3. Net corridor pressure bias (`profBias`) exceeds the user-defined **Dominance Threshold (`sigDom`)**.
4. The count of bullish bands exceeds bearish bands (or vice versa for sells).
5. At least `sigGap` bars have elapsed since the prior same-side signal.

---
### 3. How to Use: Optimal Settings & Best Markets
* **Crypto, Stocks, and Futures (High Volume Reliability):** Switch **Pressure Mode** to `"Hybrid"` or `"Volume Delta"` and set **Anchor Type** to `"VWAP"` (for intraday scalping on 5m–15m charts) or `"VWMA"` (for swing trading on 1H–4H charts). This incorporates real transaction volume into the 12-band corridor.
* **Forex & CFDs (Tick Volume Environments):** Use the default `"Price Pressure"` mode with an `"EMA"` or `"Donchian Mid"` Anchor (Length `21` to `34`). If price wicks frequently hunt liquidity before reversing, increase **Wick Weight (`wickW`)** to `1.10–1.30` to emphasize rejection tails.
* **Filtering Choppy Markets:** In noisy or ranging conditions, raise **Dominance Threshold (`sigDom`)** from `0.25` to `0.35` and increase **Minimum Active Bands (`minBands`)** to `8` or `9` so signals only fire during decisive, full-corridor momentum breakouts. Use the built-in tooltips on each `BUY`/`SELL` label to inspect exact Buy/Sell percentages and active band counts before executing a trade.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.