PROTECTED SOURCE SCRIPT
Updated

Directional Flow Index (DFI)

52
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

Release Notes
[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).

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.