RSI divergence occurs when price makes a new high or low but RSI fails to confirm momentum. Filtered correctly, this can provide a robust mean-reversion entry signal.
Detecting Divergence Programmatically
import pandas as pd
def compute_rsi(series, period=14):
delta = series.diff()
gain = delta.clip(lower=0)
loss = -delta.clip(upper=0)
avg_gain = gain.ewm(com=period - 1, min_periods=period).mean()
avg_loss = loss.ewm(com=period - 1, min_periods=period).mean()
rs = avg_gain / avg_loss
return 100 - (100 / (1 + rs))QuantumEdge
Explore these ideas in live bot templates
See how this setup translates into production-ready workflows.
Browse QuantumEdge bot templatesFiltering False Signals
Require oversold context, minimum bar spacing, and confirmation candles before execution. Raw divergence detections are too noisy in live crypto markets.
Deployment Notes
Start with paper trading, enforce position sizing constraints, and use a kill switch based on drawdown or execution anomalies.