Skip to content

Signal 4 — Delta Divergence

Thuộc tínhGiá trị
Phân loạiOrder Flow
Khung thời gian15–60 phút
Paper gốcHasbrouck (1991); biến thể từ Volume Profile literature
Loại dữ liệuTick với side classification
Hướng giao dịchMean Reversion / Reversal
CapacityTrung bình

Logic. Delta = cumulative buy_volume − sell_volume. Bearish divergence: giá tạo higher-high nhưng delta tạo lower-high → áp lực mua suy yếu → SELL. Bullish divergence: giá lower-low nhưng delta higher-low → BUY. Confirm bằng RSI(14) ở vùng cực đoan.

Code Python.

python
def detect_divergence(price, delta, lookback=20):
    """Return: +1 bullish, -1 bearish, 0 none."""
    p_hh = price.iloc[-1] > price.iloc[-lookback:-1].max()
    p_ll = price.iloc[-1] < price.iloc[-lookback:-1].min()
    d_lh = delta.iloc[-1] < delta.iloc[-lookback:-1].max()
    d_hl = delta.iloc[-1] > delta.iloc[-lookback:-1].min()
    if p_hh and d_lh:
        return -1
    if p_ll and d_hl:
        return 1
    return 0

QuantConnect setup. Maintain cumulative delta trong OnData bằng cách phân loại từng trade với Lee-Ready hoặc tick rule. Reset delta mỗi đầu phiên. Lưu rolling buffer 60 thanh nến 5 phút để detect swing high/low.

Powered by dautu.tech