PROTECTED SOURCE SCRIPT
Aggiornato

Directional Flow Index (DFI)

139
DFI (Directional Flow Index) — SuperTrend-Aware v2 (Synthetic Delta)
가격–거래량 공간에서 체결 우위를 근사해 만든 흐름을 누적(CVD 스타일)한 뒤,
고역통과(HP)로 추세 성분을 제거 → Z-Score 정규화 → SuperTrend 체 regime 인식까지 적용하여
추세의 ‘피로도(에너지 고갈)’를 시각화하는 보조지표입니다.

  • 목표: 단순 “상승/하락 강도”가 아니라, 그 추세가 얼마나 지속 가능/피로한지를 정량화
  • 핵심: Synthetic Delta(종가의 캔들 내 상대위치)로 매수/매도 우위 비율을 추정 → 거래량에 가중


동작 원리

Flow 구성

  • Synthetic Delta Volume: (close - low)/(high - low)로 매수우위 비율을 추정 → [-1,+1] 정규화 → × volume
  • 추가 모드: Signed Volume(ΔClose), MFM, ΔPrice×Volume (옵션)
  • CVD 스타일 누적 → HP detrend(EMA 기반) → EMA 스무딩
  • Z-Score 정규화로 종목/주기 간 스케일 통일
  • SuperTrend Regime(옵션)로 색상/알림을 방향 일치 구간에만 강조


주요 시그널

  • 0선 돌파: 흐름의 골든/데드 크로스로 추세 재개 신호
  • Signal 교차: 모멘텀 약화/회복 탐지 (상승구간에서 하향 교차 = 피로, 하락구간에서 상향 교차 = 피로)
  • Regime 일치 강조(컬러): ST가 상방+DFI > 0 또는 하방+DFI < 0 구간을 강조 표시


  • 입력(권장값)
  • Flow Method: Synthetic Delta Volume (기본)
  • Detrend Length (HP): 50 (중기 추세 제거)
  • Smoothing EMA: 10
  • Z-Score Window: 100
  • Signal EMA: 9
  • SuperTrend Factor / ATR Length: 6 / 5 (자산 변동성에 맞춰 조정)


활용 팁

  • 브레이크아웃 추종: DFI > 0(상방 Regime)에서 0선 상향 돌파 & 시그널 상향 교차 동시 확인
  • 익절/리스크 관리: DFI가 양수 유지 중 시그널 하향 교차가 반복되면 피로 누적 가능성 ↑
  • 다이버전스(옵션): 가격이 고점 갱신, DFI는 하락 고점 → 상방 피로 / 반대는 하방 피로


한계 및 주의

  • 실제 틱 Delta 아님: Synthetic Delta는 근사 모델입니다. 실제 Bid/Ask 체결 데이터 접근이 불가한 TV 환경을 보완하는 방식입니다.


  • 파라미터 민감도: HP/Z-윈도우가 너무 짧으면 노이즈, 너무 길면 반응 둔화. 자산/주기에 맞춰 튜닝 필요.


  • Regime 필터 이진성: 변곡 구간에서 오탐 가능 → 시그널 교차와 함께 확인 권장.


알림(Alerts)

  • DFI Long Thrust: (상방 Regime일 때) 0선 상향 돌파
  • DFI Short Thrust: (하방 Regime일 때) 0선 하향 돌파
  • Loss of Momentum (Up/Down): DFI와 Signal의 역교차로 모멘텀 약화 감지


버전 노트

v2: Synthetic Delta Volume 모드 추가, Regime-aware 색상/알림 개선, 다이버전스(옵션) 보조

크레딧

설계: Cyan_TPM

영감: OBV/CMF/VFI, CVD 철학, Ehlers HP/정규화 기법


[ENG]

DFI (Directional Flow Index) — SuperTrend-Aware v2 (Synthetic Delta)
models buy/sell dominance in the price–volume space, accumulates it CVD-style,
then high-pass detrends → smooths → Z-score normalizes, and finally applies a SuperTrend regime to emphasize alignment.

Goal: visualize trend “fatigue” (energy depletion) rather than mere direction.


How it works


Flow Construction
  • Synthetic Delta Volume (default): use the close’s relative position within the bar range to approximate buy dominance, map to [-1,+1], and weight by volume.


  • Alternative modes: Signed Volume (ΔClose), Money Flow Multiplier, ΔPrice×Volume.


  • CVD-like Accumulation → HP detrend (EMA-based) → EMA smoothing


  • Z-Score Normalization to make values comparable across assets/timeframes


  • SuperTrend Regime Awareness to color/alert only when direction aligns


Signals
  • Zero-line crosses: thrust (restart) of directional flow
  • Signal crosses: momentum loss/recovery (fatigue)
  • Regime-aligned coloring: highlights DFI>0 in up regime, DFI<0 in down regim


Inputs (Suggested)

  • Flow Method: Synthetic Delta Volume
  • Detrend Length (HP): 50
  • Smoothing EMA: 10
  • Z-Score Window: 100
  • Signal EMA: 9
  • SuperTrend Factor / ATR Length: 6 / 5 (tune per asset)



Usage
  • Breakout follow-through: zero-up cross + signal up cross in up regime
  • Risk/TP management: repeated signal-down crosses while DFI > 0 → accumulating fatigue
  • (Optional) Divergence: Price HH but DFI LH → upside fatigue; inverse for downside


Limitations

  • Not true tick delta: Synthetic Delta approximates orderflow without bid/ask prints.
  • Parameter sensitivity (HP/Z windows) → tune for your market.
  • Binary regime filter can misfire near turning points → confirm with signal cross.


Alerts
DFI Long Thrust / Short Thrust (zero-line crosses under regime)
Loss of Momentum (Up/Down) via DFI–Signal counter-cross

Version
v2: Synthetic Delta mode added, regime-aware coloring/alerts refined, optional divergence helper

Credits

Design: Cyan_TPM
References: OBV/CMF/VFI, CVD philosophy, Ehlers HP/normalization

Note di rilascio
[KOR]
Fatigue% (추세 피로도)

DFI 절대값의 평균(에너지)과 피크값의 비율로 에너지 소모율(%) 계산.
“현재 추세가 얼마나 소모되었는가”를 0~100%로 표현:
0~30% → Fresh (신선한 추세)
30~60% → Active (정상 지속 구간)
60~80% → Tiring (과열 주의)
80~100% → Exhausted (탈진 상태)

Reset on Regime Change 옵션 추가:

  • SuperTrend 추세가 전환되면 Fatigue%를 자동 초기화하여
  • 새 추세 구간의 체력만 다시 측정.
  • Fatigue%는 EMA 평활 처리 + 피크 Lookback 기반으로 계산.
  • 테이블 UI에 실시간 표시 (top-right 기본).
  • Fatigue%, Regime, Flow Method 확인 가능.


Fatigue Alert System

Fatigue% 수준 기반 Exhaustion / Freshness 알림 추가:
  • Exhaustion Sell → Fatigue% ≥ High & DFI↓
  • Exhaustion Buy → Fatigue% ≥ High & DFI↑
  • Fresh Thrust Buy/Sell → 피로도가 낮을 때 DFI가 0선 돌파


UI / 구조 개선

Fatigue% 테이블 추가 (좌/우 하단 위치 선택 가능).
Fatigue 색상 자동 강조 (Lime → Orange → Red).
코드 구조 완전 리팩토링:
grp_ 그룹화로 UI 정리.
Fatigue / Flow / ST / Plotting 구간별 모듈화.
Divergence Scanner 유지 (옵션 Off 기본).

[ENG]

Measures how “tired” the current trend is, from 0% (fresh) to 100% (fully exhausted).
Based on the ratio between recent average DFI energy (|DFI| EMA) and its historical peak.

Interpretation:

  • 0–30% → Fresh trend
  • 30–60% → Active / Sustained phase
  • 60–80% → Tiring / Overheated
  • 80–100% → Exhausted trend


New option: Reset on Regime Change

When the SuperTrend direction flips, Fatigue% resets — measuring only the current trend’s internal strength.
Smoothed via EMA to prevent volatility spikes.

Real-time Fatigue Table added (top-right by default):
Displays Fatigue%, Regime, and Flow Method.

Fatigue-Based Alert System

Exhaustion Alerts

  • Exhaustion Sell: Fatigue% ≥ High & DFI crosses under Signal (Up Regime)
  • Exhaustion Buy: Fatigue% ≥ High & DFI crosses over Signal (Down Regime)


Freshness Alerts

  • Fresh Thrust Buy/Sell: DFI crosses zero while Fatigue% is low
  • Complements the existing DFI Thrust & Momentum Loss signals


UI / Structural Improvements

Introduced a Fatigue Table panel with optional position (top/bottom corners).

Adaptive color palette:

Lime → Orange → Red, matching Fatigue severity.
Fully modularized code:
Grouped inputs (grp_st, grp_flow, grp_fat, etc.).
Clear separation between core logic, normalization, visuals, and alerts.
Divergence scanner retained as optional (disabled by default).
Note di rilascio
Version: v2.2 ~ v2.2.2
Scope: Fatigue System Enhancement / Statistical Robustness / UX Integration


v2.2 — Decaying Peak & Directional Peaks
Overview:
[KOR]
이 버전은 Fatigue(추세 피로도)의 해석을 한 단계 끌어올린 대규모 내부 업데이트입니다.
기존 고정 피크(max DFI) 기반 구조의 비대칭 문제를 해소하고, 실제 시장의 에너지 소모 구조를 반영하도록 개선했습니다.

[ENG]
This update redefines the Fatigue (%) logic to better capture real market “trend exhaustion.”
Fixed max-peak normalization has been replaced with a decaying, direction-aware model —
resolving asymmetry between uptrend and downtrend behavior.

Core Changes:

Decaying Peak System
[KOR]
  • Fatigue 계산 시 “과거 피크값”이 반감기(Half-life) 기반으로 서서히 감쇠하도록 설계.
  • 오래된 극단값이 현재 피로도에 과도한 영향을 주지 않음 → 추세 지속성 계산의 현실화.


[ENG]
  • Historical peak values now decay exponentially based on a half-life parameter.
  • Prevents ancient spikes from skewing the fatigue baseline.


Directional Peaks (Up/Down Separation)
[KOR]
  • 상승/하락 에너지를 각각 추적 (abs_up, abs_dn)하고, SuperTrend 또는 DFI 부호에 따라 해당 방향 피로만 계산.
  • 상승-하락 간의 비대칭 문제(편향) 해결.

[ENG]
  • Independently tracks positive and negative DFI energy.
  • Measures fatigue within the active regime only (Up → Up-energy, Down → Down-energy).


Regime Reset Integration
[KOR]
  • SuperTrend 방향 전환 시, 각 방향의 피크 및 평균을 리셋.
  • 현재 추세 구간의 체력만 측정 → 단방향 추세 대응형 Fatigue.


[ENG]
  • SuperTrend regime flips automatically reset energy & peak tracking.
  • Captures only the current directional cycle’s fatigue


Expected Impact:
[KOR]
  • 장기 피크 왜곡 감소
  • 방향별 피로도 정확성 향상
  • 추세 전환 구간에서 자연스러운 피로 초기화

[ENG]
  • Eliminates peak bias across regime changes.
  • More realistic exhaustion measurement during long trends.
  • Clearer visualization of one-sided trend sustainability.


v2.2.1 — Robust Winsorizing & MAD Clipping
Overview:
[KOR]
Fatigue 계산의 안정성을 높이기 위한 통계적 방어 계층(Statistical Defense Layer)을 추가했습니다.
이상치(Outlier)나 비정상 거래량 급증이 지표 왜곡을 일으키지 않도록 설계했습니다.

[ENG]
Introduces statistical defenses to improve Fatigue stability under extreme market events.
Outliers and one-off volume spikes are now properly constrained for smoother, more reliable readings.

Core Changes:

Z-Std Winsorization
[KOR]
  • mean ± k × std 범위 밖의 값을 클리핑(Winsorize).
  • 체결량 급등/급락으로 인한 노이즈 제거.

[ENG]
  • Clamps values outside mean ± k·std range.
  • Filters temporary volatility bursts or aggressive volume outliers.

EMA–MAD Robust Mode
[KOR]
  • 중앙값 편차(MAD)에 기반한 강건(robust) 클리핑 도입.
  • EMA ± k × (MAD × 1.4826) 형태로, 표준편차보다 이상치에 훨씬 덜 민감.

[ENG]
  • A median-absolute-deviation–based clipping using EMA ± k·(MAD × 1.4826).
  • More resilient to heavy tails and non-normal data.

Mode Selector
[KOR]
  • "Off", "Z-Std", "EMA-MAD (Robust)" 세 가지 중 선택 가능.
  • 실험적 환경에서도 안정적인 피로도 산출.

[ENG]
  • "Off", "Z-Std", or "EMA-MAD (Robust)" options for different environments.


Expected Impact:
[KOR]
  • 이벤트성 체결 스파이크 제거
  • Fatigue%의 통계적 일관성 유지
  • 비정상 구간에서도 매끄러운 추세 피로도 추정

[ENG]
  • Maintains statistical consistency in non-stationary data.
  • Prevents fatigue distortion from anomalous trades.
  • Provides a more trustworthy energy curve in volatile assets.


v2.2.2 — Full Tooltip Integration & UX Polish
Overview:
[KOR]
기능적 완성 이후, 사용자 경험(UX) 개선.
모든 주요 파라미터에 툴팁을 추가하여 지표의 해석과 조정이 명확해졌습니다.
[ENG]
A user-experience refinement —
all inputs now include tooltips explaining purpose, logic, and interpretation.

Core Changes:
Tooltip Enhancements
[KOR]
  • 각 입력항목에 의미·계산방식·해석 가이드 내장.
  • Fatigue%, Flow Method, Winsor Mode 등 모든 주요 섹션에 적용.
  • 단순 파라미터가 아닌 “학습형 인터페이스” 완성.

[ENG]
  • Every major parameter (Flow Method, Fatigue%, Winsor Mode, etc.) includes built-in explanations.
  • The indicator doubles as an educational interface for system-trading users.


Fatigue Level Guide
  • 0–30% → Fresh
  • 30–60% → Active
  • 60–80% → Tiring
  • 80–100% → Exhausted


Expected Impact:
[KOR]
직관적인 파라미터 튜닝
[ENG]
Dramatically improved clarity for parameter tuning.


v2.2 계열은 DFI를 단순 모멘텀 지표가 아닌, 추세 에너지의 "소모-회복 사이클"을 정량화 하는 시스템형 오실레이터의 시도 입니다.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.