QuantAgent’s Indicator Agent computes five technical indicators using TA-Lib. Each indicator targets a different dimension of price behavior, giving the downstream Decision Agent a broad signal basis.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Y-Research-SBU/QuantAgent/llms.txt
Use this file to discover all available pages before exploring further.
Indicators
RSI — Relative Strength Index (period: 14)
RSI — Relative Strength Index (period: 14)
RSI measures the speed and magnitude of recent price changes to identify momentum extremes.The last 28 values are returned to state.
- Values above 70 indicate overbought conditions (potential reversal or pullback)
- Values below 30 indicate oversold conditions (potential bounce or reversal)
- RSI divergence — when price makes a new high/low but RSI does not — is treated as a high-weight signal by the Decision Agent
MACD — Moving Average Convergence Divergence (12, 26, 9)
MACD — Moving Average Convergence Divergence (12, 26, 9)
MACD tracks the relationship between two exponential moving averages of closing prices.
Key signals the Decision Agent weighs heavily:
| Component | Description |
|---|---|
| MACD line | EMA(12) − EMA(26) |
| Signal line | EMA(9) of the MACD line |
| Histogram | MACD line − Signal line |
- Bullish crossover — MACD line crosses above signal line
- Bearish crossover — MACD line crosses below signal line
- Histogram expansion — increasing divergence confirms momentum direction
Stochastic Oscillator (%K / %D)
Stochastic Oscillator (%K / %D)
The Stochastic Oscillator compares a closing price to its price range over a recent period, surfacing overbought and oversold levels relative to recent trading range rather than absolute price.
| Component | Parameters | Description |
|---|---|---|
| %K | fastk_period=14 | Raw stochastic value |
| %D | slowk_period=3, slowd_period=3 | 3-period SMA of %K |
- Values above 80: overbought
- Values below 20: oversold
- %K crossing above %D signals bullish momentum; crossing below signals bearish momentum
Williams %R (period: 14)
Williams %R (period: 14)
Williams %R measures where the closing price sits within the high-low range of the last 14 periods. It is particularly sensitive to short-term overbought and oversold extremes.
- Range: 0 to −100
- Above −20: overbought
- Below −80: oversold
ROC — Rate of Change (period: 10)
ROC — Rate of Change (period: 10)
ROC measures the percentage change in price over the last 10 periods, making it a direct proxy for price momentum:
- Positive ROC: upward momentum
- Negative ROC: downward momentum
- ROC moving toward zero from positive territory can signal momentum exhaustion
All five indicators return the last 28 values to state. This window is wide enough for the LLM to assess recent trend direction while remaining concise enough for reliable token-based analysis.
Trendline fitting
The Trend Agent uses a custom least-squares trendline fitting algorithm implemented ingraph_util.py. It fits both a close-price channel and a high/low channel.
Algorithm overview
Least-squares baseline
np.polyfit fits a line of best fit to the closing prices (or high/low series). This gives an initial slope and intercept that represents the overall directional trend.Pivot identification
The algorithm identifies two pivot points:
- Upper pivot — the candle index where price deviates furthest above the baseline (used for resistance)
- Lower pivot — the candle index where price deviates furthest below the baseline (used for support)
Slope optimization
optimize_slope refines the initial slope for each trendline so it stays entirely above (resistance) or below (support) all price data while minimizing the sum of squared distances to price. It uses numerical gradient descent with a halving step size.check_trend_line enforces the validity constraint — if a support line has any value above actual prices, it returns −1 (invalid). The optimizer keeps reducing the step size (curr_step *= 0.5) until it converges below min_step = 0.0001.Dual channel rendering
Two sets of trendlines are computed and overlaid on the chart:
- Close-based channel (blue support, red resistance) — fitted to closing prices via
fit_trendlines_single - High/Low channel (white lines) — fitted to candle highs and lows via
fit_trendlines_high_low
Validity check
check_trend_line returns −1.0 for any slope that violates the channel constraint:
Candle window selection
The two chart generation tools use different lookback windows, each tuned to the type of analysis being performed:| Tool | Candles used | Source |
|---|---|---|
generate_kline_image (Pattern Agent) | Last 40 candles | df.tail(40) in graph_util.py:278 |
generate_trend_image (Trend Agent) | Last 50 candles | data.iloc[-50:] in graph_util.py:169 |