Indicators · beginner · 6 phút
Hàm: Momentum
RSI, Stochastic, MACD, ROC
#indicator#momentum
Chỉ báo Dao động & Động lượng
- `rsi(c, n)`: Trả về Series 0-100.
- `macd(c, fast, slow, sig)`: Trả về struct chứa
.line,.signal,.hist. - `stoch(h, l, c, n)`: Trả về struct chứa
.kvà.d. - `roc(c, n)`: Trả về giá trị % thay đổi (vd 0.05 = 5%).
Ví dụ MACD & RSI kết hợp:
quanta
detect: c = market.close r = rsi(c, 14) m = macd(c, 12, 26, 9) act: when (m.line crossover m.signal) and (r < 70): enter long with wnav 10pct
Wiki liên quan
rsi(x: 'pd.Series', n: 'int' = 14) -> 'pd.Series'macd(x: 'pd.Series', fast: 'int' = 12, slow: 'int' = 26, signal_n: 'int' = 9) -> 'dict'stoch(high: 'pd.Series', low: 'pd.Series', close: 'pd.Series', n: 'int' = 14, smooth_k: 'int' = 3, smooth_d: 'int' = 3) -> 'dict'roc(x: 'pd.Series', n: 'int' = 10) -> 'pd.Series'