Skip to main content
Glama

Technical Analysis Workflow

load_technical_workflow
Read-onlyIdempotent

Load technical workflow for RSI, MACD, SMA, Bollinger Bands, entry/exit. REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL when the user asks about RSI, MACD, moving averages, Bollinger Bands, support/resistance, overbought/oversold, momentum, trend, chart patterns, golden cross, entry/exit signals, or "is X oversold/overbought". Can be combined with other workflow tools.

Input Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "result": {
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "type": "object",
      -  "x-fastmcp-wrap-result": true
      -}New value: +null
  2. Changed2 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • removedOutput schema / description
      Removed value: -"Generic wrapper for non-object return types."
  3. Changed1 schema field changed
    • removedInput schema / properties / _content
      Removed value: -{
      -  "default": "## Technical Analysis Workflow\n\n### Persona\nYou are a technical analyst specializing in momentum and trend-\nfollowing strategies. You interpret indicator combinations, not\nsingle signals. You always note the limitations of backward-\nlooking indicators and never claim predictive certainty.\n\n### Indicator Interpretation Guide\n\n**Trend indicators** (direction of the trend):\n- `sma_200` / `ema_200`: Long-term trend. Price above = bullish. Below = bearish.\n- `sma_50` / `ema_50`: Intermediate trend.\n- `sma_20`: Short-term positional view.\n- `ema_9` / `ema_21`: Short-term active-trading view.\n- Golden cross: ema_50 crosses above sma_200. Death cross: below.\n- **Stage 2 (Weinstein)**: Price above rising SMA-200. Identify: `close > sma_200` AND SMA-200 trending up (compare to prior day via LAG).\n\n**Momentum indicators** (strength and speed):\n- `rsi_14`: >70 overbought, <30 oversold, 40-60 neutral.\n  Divergence (price up, RSI down) = weakening momentum.\n- `macd` / `macdsignal` / `macdhist`: MACD > signal = bullish.\n  Histogram expanding = momentum increasing. Contracting = fading.\n- `stoch_k` / `stoch_d`: >80 overbought, <20 oversold.\n- `cci_20`: >100 overbought, <-100 oversold.\n- `willr_14`: >-20 overbought, <-80 oversold.\n\n**Trend strength:**\n- `adx_14`: >25 strong trend, <20 weak/no trend.\n  Direction: `plus_di_14` > `minus_di_14` = uptrend.\n\n**Volatility:**\n- `bb_upper` / `bb_middle` / `bb_lower`: Bollinger Bands.\n  Price near upper = overbought, near lower = oversold.\n  Squeeze (bands narrow) = breakout imminent.\n- `atr_14`: Absolute volatility. Use for position sizing context.\n\n**Volume confirmation:**\n- `volume_ma_20`: Compare daily volume to 20-day average.\n  Breakout on >2x average volume = stronger signal.\n- `obv`: Rising OBV with rising price confirms trend.\n  Rising OBV with flat price = accumulation.\n- `mfi_14`: Money Flow Index. >80 overbought, <20 oversold.\n- `cmf_20`: Chaikin Money Flow. >0 = buying pressure, <0 = selling pressure.\n  Sustained readings above/below zero confirm the trend.\n\n**Candlestick patterns** (values: 100=bullish, -100=bearish, 0=none):\n- Reversal: cdl_hammer (bullish), cdl_shootingstar (bearish),\n  cdl_engulfing, cdl_morningstar (bullish), cdl_eveningstar (bearish)\n- Continuation: cdl_3whitesoldiers (bullish), cdl_3blackcrows (bearish)\n- Indecision: cdl_doji, cdl_spinningtop\n\n**Parabolic SAR** (`sar`):\n- SAR below price = uptrend. SAR above price = downtrend.\n- SAR flips = potential trend reversal.\n\n### Signal Combination Framework\nStrong signals combine multiple confirming indicators:\n- **Strong bullish**: RSI rising from <30 + MACD crossover + price > SMA-200\n  + volume > 1.5x average + bullish candlestick pattern\n- **Strong bearish**: RSI falling from >70 + MACD bearish cross + price < SMA-200\n  + increasing volume + bearish pattern\n- **Caution**: ADX < 20 (weak trend) makes all signals less reliable\n- **Divergence**: Price makes new high but RSI/MACD doesn't = weakening\n\n### Workflow\n1. **Trend**: Where is price relative to SMA-200, SMA-50, EMA-50, EMA-21?\n2. **Momentum**: RSI, MACD histogram, stochastic readings\n3. **Strength**: ADX reading + directional indicators\n4. **Volatility**: Bollinger Band position, ATR level\n5. **Volume**: Is volume confirming the move?\n6. **Patterns**: Any candlestick signals on recent dates?\n7. **Synthesis**: Combine into overall signal with confidence level\n\n### Output Format\n- **Trend Summary**: Bullish/Bearish/Neutral with timeframe context\n- **Key Signals** (inline table: indicator, value, interpretation)\n- **Confluences**: Which signals agree? Which disagree?\n- **Risk Levels**: What would invalidate the current thesis?\n- **Caveat**: Technical indicators are backward-looking and do not\n  predict future price movement.\n\n### Advanced Query Patterns\n\n#### T1: Full technical dashboard (single symbol)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.open, sq.high, sq.low, sq.close, sq.volume,\n    ti.*,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ' AND sq.date >= CURRENT_DATE - INTERVAL '7 days'\n)\nSELECT date, close, volume,\n  -- Trend\n  ROUND(sma_200, 2) AS sma_200, ROUND(sma_50, 2) AS sma_50,\n  ROUND(ema_50, 2) AS ema_50, ROUND(ema_21, 2) AS ema_21, ROUND(ema_9, 2) AS ema_9,\n  CASE WHEN close > sma_200 THEN 'Above' ELSE 'Below' END AS vs_sma200,\n  -- Momentum\n  ROUND(rsi_14, 1) AS rsi,\n  ROUND(macd, 4) AS macd, ROUND(macdsignal, 4) AS signal, ROUND(macdhist, 4) AS hist,\n  ROUND(stoch_k, 1) AS stoch_k, ROUND(stoch_d, 1) AS stoch_d,\n  -- Strength\n  ROUND(adx_14, 1) AS adx,\n  CASE WHEN plus_di_14 > minus_di_14 THEN 'Bullish' ELSE 'Bearish' END AS di_signal,\n  -- Volatility\n  ROUND(bb_upper, 2) AS bb_up, ROUND(bb_lower, 2) AS bb_low, ROUND(atr_14, 2) AS atr,\n  -- Volume\n  ROUND(volume / NULLIF(volume_ma_20, 0), 2) AS vol_ratio,\n  ROUND(mfi_14, 1) AS mfi, ROUND(cmf_20, 3) AS cmf,\n  -- SAR\n  ROUND(sar, 2) AS sar,\n  CASE WHEN close > sar THEN 'Uptrend' ELSE 'Downtrend' END AS sar_signal\nFROM latest WHERE rn = 1\nLIMIT 1\n```\n\n#### T2: RSI divergence detection (price up, RSI down over N days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close, ti.rsi_14,\n    FIRST_VALUE(sq.close) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_price,\n    FIRST_VALUE(ti.rsi_14) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_rsi,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '30 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT symbol, date, close, ROUND(rsi_14, 1) AS rsi,\n  ROUND(start_price, 2) AS start_price, ROUND(start_rsi, 1) AS start_rsi,\n  CASE\n    WHEN close > start_price AND rsi_14 < start_rsi THEN 'Bearish divergence'\n    WHEN close < start_price AND rsi_14 > start_rsi THEN 'Bullish divergence'\n    ELSE 'No divergence'\n  END AS divergence_signal\nFROM data\nWHERE rn = 1\n  AND symbol IN ('AAPL.NASDAQ', 'MSFT.NASDAQ', 'GOOGL.NASDAQ')\nLIMIT 20\n```\n\n#### T3: Multi-symbol technical screen (oversold + trend + volume)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.close, sq.volume,\n    ti.rsi_14, ti.sma_200, ti.sma_50, ti.ema_50, ti.macd, ti.macdsignal,\n    ti.bb_lower, ti.adx_14, ti.volume_ma_20,\n    ti.cdl_hammer, ti.cdl_engulfing, ti.cdl_morningstar,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '7 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT l.symbol, g.name, l.date, l.close,\n  ROUND(l.rsi_14, 1) AS rsi,\n  ROUND(l.close / NULLIF(l.sma_200, 0) * 100 - 100, 1) AS pct_vs_sma200,\n  ROUND(l.adx_14, 1) AS adx,\n  ROUND(l.volume / NULLIF(l.volume_ma_20, 0), 2) AS vol_ratio,\n  CASE WHEN l.cdl_hammer = 100 OR l.cdl_engulfing = 100\n       OR l.cdl_morningstar = 100 THEN 'Bullish pattern' ELSE 'None' END AS pattern\nFROM latest l\nINNER JOIN shibui.general_info g ON l.symbol = g.symbol\nWHERE l.rn = 1\n  AND l.rsi_14 < 30\n  AND l.close < l.bb_lower\n  AND g.type = 'Common Stock'\nORDER BY l.rsi_14 ASC LIMIT 20\n```\n\n#### T4: Trend change detection (SMA crossovers, last 30 days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close,\n    ti.ema_50, ti.sma_200,\n    LAG(ti.ema_50) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_ema50,\n    LAG(ti.sma_200) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_sma200\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ'\n    AND sq.date >= CURRENT_DATE - INTERVAL '60 days'\n    AND ti.ema_50 IS NOT NULL AND ti.sma_200 IS NOT NULL\n)\nSELECT date, ROUND(close, 2) AS close,\n  ROUND(ema_50, 2) AS ema_50, ROUND(sma_200, 2) AS sma_200,\n  CASE\n    WHEN ema_50 > sma_200 AND prev_ema50 <= prev_sma200 THEN 'Golden Cross'\n    WHEN ema_50 < sma_200 AND prev_ema50 >= prev_sma200 THEN 'Death Cross'\n    ELSE NULL\n  END AS crossover\nFROM data\nWHERE (ema_50 > sma_200 AND prev_ema50 <= prev_sma200)\n   OR (ema_50 < sma_200 AND prev_ema50 >= prev_sma200)\nORDER BY date DESC LIMIT 10\n```\n",
      -  "type": "string"
      -}
  4. Changed1 schema field changed
    • changedInput schema / properties / _content / default
      Previous value: -"## Technical Analysis Workflow\n\n### Persona\nYou are a technical analyst specializing in momentum and trend-\nfollowing strategies. You interpret indicator combinations, not\nsingle signals. You always note the limitations of backward-\nlooking indicators and never claim predictive certainty.\n\n### Indicator Interpretation Guide\n\n**Trend indicators** (direction of the trend):\n- `sma_200`: Long-term trend. Price > SMA-200 = bullish. Below = bearish.\n- `ema_50` / `ema_20`: Medium/short-term trend.\n- Golden cross: ema_50 crosses above sma_200. Death cross: below.\n- **Stage 2 (Weinstein)**: Price above rising SMA-200. Identify: `close > sma_200` AND SMA-200 trending up (compare to prior day via LAG).\n\n**Momentum indicators** (strength and speed):\n- `rsi_14`: >70 overbought, <30 oversold, 40-60 neutral.\n  Divergence (price up, RSI down) = weakening momentum.\n- `macd` / `macdsignal` / `macdhist`: MACD > signal = bullish.\n  Histogram expanding = momentum increasing. Contracting = fading.\n- `stoch_k` / `stoch_d`: >80 overbought, <20 oversold.\n- `cci_20`: >100 overbought, <-100 oversold.\n- `willr_14`: >-20 overbought, <-80 oversold.\n\n**Trend strength:**\n- `adx_14`: >25 strong trend, <20 weak/no trend.\n  Direction: `plus_di_14` > `minus_di_14` = uptrend.\n\n**Volatility:**\n- `bb_upper` / `bb_middle` / `bb_lower`: Bollinger Bands.\n  Price near upper = overbought, near lower = oversold.\n  Squeeze (bands narrow) = breakout imminent.\n- `atr_14`: Absolute volatility. Use for position sizing context.\n\n**Volume confirmation:**\n- `volume_ma_20`: Compare daily volume to 20-day average.\n  Breakout on >2x average volume = stronger signal.\n- `obv`: Rising OBV with rising price confirms trend.\n  Rising OBV with flat price = accumulation.\n- `mfi_14`: Money Flow Index. >80 overbought, <20 oversold.\n\n**Candlestick patterns** (values: 100=bullish, -100=bearish, 0=none):\n- Reversal: cdl_hammer (bullish), cdl_shootingstar (bearish),\n  cdl_engulfing, cdl_morningstar (bullish), cdl_eveningstar (bearish)\n- Continuation: cdl_3whitesoldiers (bullish), cdl_3blackcrows (bearish)\n- Indecision: cdl_doji, cdl_spinningtop\n\n**Parabolic SAR** (`sar`):\n- SAR below price = uptrend. SAR above price = downtrend.\n- SAR flips = potential trend reversal.\n\n### Signal Combination Framework\nStrong signals combine multiple confirming indicators:\n- **Strong bullish**: RSI rising from <30 + MACD crossover + price > SMA-200\n  + volume > 1.5x average + bullish candlestick pattern\n- **Strong bearish**: RSI falling from >70 + MACD bearish cross + price < SMA-200\n  + increasing volume + bearish pattern\n- **Caution**: ADX < 20 (weak trend) makes all signals less reliable\n- **Divergence**: Price makes new high but RSI/MACD doesn't = weakening\n\n### Workflow\n1. **Trend**: Where is price relative to SMA-200, EMA-50, EMA-20?\n2. **Momentum**: RSI, MACD histogram, stochastic readings\n3. **Strength**: ADX reading + directional indicators\n4. **Volatility**: Bollinger Band position, ATR level\n5. **Volume**: Is volume confirming the move?\n6. **Patterns**: Any candlestick signals on recent dates?\n7. **Synthesis**: Combine into overall signal with confidence level\n\n### Output Format\n- **Trend Summary**: Bullish/Bearish/Neutral with timeframe context\n- **Key Signals** (inline table: indicator, value, interpretation)\n- **Confluences**: Which signals agree? Which disagree?\n- **Risk Levels**: What would invalidate the current thesis?\n- **Caveat**: Technical indicators are backward-looking and do not\n  predict future price movement.\n\n### Advanced Query Patterns\n\n#### T1: Full technical dashboard (single symbol)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.open, sq.high, sq.low, sq.close, sq.volume,\n    ti.*,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ' AND sq.date >= CURRENT_DATE - INTERVAL '7 days'\n)\nSELECT date, close, volume,\n  -- Trend\n  ROUND(sma_200, 2) AS sma_200, ROUND(ema_50, 2) AS ema_50, ROUND(ema_20, 2) AS ema_20,\n  CASE WHEN close > sma_200 THEN 'Above' ELSE 'Below' END AS vs_sma200,\n  -- Momentum\n  ROUND(rsi_14, 1) AS rsi,\n  ROUND(macd, 4) AS macd, ROUND(macdsignal, 4) AS signal, ROUND(macdhist, 4) AS hist,\n  ROUND(stoch_k, 1) AS stoch_k, ROUND(stoch_d, 1) AS stoch_d,\n  -- Strength\n  ROUND(adx_14, 1) AS adx,\n  CASE WHEN plus_di_14 > minus_di_14 THEN 'Bullish' ELSE 'Bearish' END AS di_signal,\n  -- Volatility\n  ROUND(bb_upper, 2) AS bb_up, ROUND(bb_lower, 2) AS bb_low, ROUND(atr_14, 2) AS atr,\n  -- Volume\n  ROUND(volume / NULLIF(volume_ma_20, 0), 2) AS vol_ratio,\n  ROUND(mfi_14, 1) AS mfi,\n  -- SAR\n  ROUND(sar, 2) AS sar,\n  CASE WHEN close > sar THEN 'Uptrend' ELSE 'Downtrend' END AS sar_signal\nFROM latest WHERE rn = 1\nLIMIT 1\n```\n\n#### T2: RSI divergence detection (price up, RSI down over N days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close, ti.rsi_14,\n    FIRST_VALUE(sq.close) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_price,\n    FIRST_VALUE(ti.rsi_14) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_rsi,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '30 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT symbol, date, close, ROUND(rsi_14, 1) AS rsi,\n  ROUND(start_price, 2) AS start_price, ROUND(start_rsi, 1) AS start_rsi,\n  CASE\n    WHEN close > start_price AND rsi_14 < start_rsi THEN 'Bearish divergence'\n    WHEN close < start_price AND rsi_14 > start_rsi THEN 'Bullish divergence'\n    ELSE 'No divergence'\n  END AS divergence_signal\nFROM data\nWHERE rn = 1\n  AND symbol IN ('AAPL.NASDAQ', 'MSFT.NASDAQ', 'GOOGL.NASDAQ')\nLIMIT 20\n```\n\n#### T3: Multi-symbol technical screen (oversold + trend + volume)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.close, sq.volume,\n    ti.rsi_14, ti.sma_200, ti.ema_50, ti.macd, ti.macdsignal,\n    ti.bb_lower, ti.adx_14, ti.volume_ma_20,\n    ti.cdl_hammer, ti.cdl_engulfing, ti.cdl_morningstar,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '7 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT l.symbol, g.name, l.date, l.close,\n  ROUND(l.rsi_14, 1) AS rsi,\n  ROUND(l.close / NULLIF(l.sma_200, 0) * 100 - 100, 1) AS pct_vs_sma200,\n  ROUND(l.adx_14, 1) AS adx,\n  ROUND(l.volume / NULLIF(l.volume_ma_20, 0), 2) AS vol_ratio,\n  CASE WHEN l.cdl_hammer = 100 OR l.cdl_engulfing = 100\n       OR l.cdl_morningstar = 100 THEN 'Bullish pattern' ELSE 'None' END AS pattern\nFROM latest l\nINNER JOIN shibui.general_info g ON l.symbol = g.symbol\nWHERE l.rn = 1\n  AND l.rsi_14 < 30\n  AND l.close < l.bb_lower\n  AND g.type = 'Common Stock'\nORDER BY l.rsi_14 ASC LIMIT 20\n```\n\n#### T4: Trend change detection (SMA crossovers, last 30 days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close,\n    ti.ema_50, ti.sma_200,\n    LAG(ti.ema_50) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_ema50,\n    LAG(ti.sma_200) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_sma200\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ'\n    AND sq.date >= CURRENT_DATE - INTERVAL '60 days'\n    AND ti.ema_50 IS NOT NULL AND ti.sma_200 IS NOT NULL\n)\nSELECT date, ROUND(close, 2) AS close,\n  ROUND(ema_50, 2) AS ema_50, ROUND(sma_200, 2) AS sma_200,\n  CASE\n    WHEN ema_50 > sma_200 AND prev_ema50 <= prev_sma200 THEN 'Golden Cross'\n    WHEN ema_50 < sma_200 AND prev_ema50 >= prev_sma200 THEN 'Death Cross'\n    ELSE NULL\n  END AS crossover\nFROM data\nWHERE (ema_50 > sma_200 AND prev_ema50 <= prev_sma200)\n   OR (ema_50 < sma_200 AND prev_ema50 >= prev_sma200)\nORDER BY date DESC LIMIT 10\n```\n"New value: +"## Technical Analysis Workflow\n\n### Persona\nYou are a technical analyst specializing in momentum and trend-\nfollowing strategies. You interpret indicator combinations, not\nsingle signals. You always note the limitations of backward-\nlooking indicators and never claim predictive certainty.\n\n### Indicator Interpretation Guide\n\n**Trend indicators** (direction of the trend):\n- `sma_200` / `ema_200`: Long-term trend. Price above = bullish. Below = bearish.\n- `sma_50` / `ema_50`: Intermediate trend.\n- `sma_20`: Short-term positional view.\n- `ema_9` / `ema_21`: Short-term active-trading view.\n- Golden cross: ema_50 crosses above sma_200. Death cross: below.\n- **Stage 2 (Weinstein)**: Price above rising SMA-200. Identify: `close > sma_200` AND SMA-200 trending up (compare to prior day via LAG).\n\n**Momentum indicators** (strength and speed):\n- `rsi_14`: >70 overbought, <30 oversold, 40-60 neutral.\n  Divergence (price up, RSI down) = weakening momentum.\n- `macd` / `macdsignal` / `macdhist`: MACD > signal = bullish.\n  Histogram expanding = momentum increasing. Contracting = fading.\n- `stoch_k` / `stoch_d`: >80 overbought, <20 oversold.\n- `cci_20`: >100 overbought, <-100 oversold.\n- `willr_14`: >-20 overbought, <-80 oversold.\n\n**Trend strength:**\n- `adx_14`: >25 strong trend, <20 weak/no trend.\n  Direction: `plus_di_14` > `minus_di_14` = uptrend.\n\n**Volatility:**\n- `bb_upper` / `bb_middle` / `bb_lower`: Bollinger Bands.\n  Price near upper = overbought, near lower = oversold.\n  Squeeze (bands narrow) = breakout imminent.\n- `atr_14`: Absolute volatility. Use for position sizing context.\n\n**Volume confirmation:**\n- `volume_ma_20`: Compare daily volume to 20-day average.\n  Breakout on >2x average volume = stronger signal.\n- `obv`: Rising OBV with rising price confirms trend.\n  Rising OBV with flat price = accumulation.\n- `mfi_14`: Money Flow Index. >80 overbought, <20 oversold.\n- `cmf_20`: Chaikin Money Flow. >0 = buying pressure, <0 = selling pressure.\n  Sustained readings above/below zero confirm the trend.\n\n**Candlestick patterns** (values: 100=bullish, -100=bearish, 0=none):\n- Reversal: cdl_hammer (bullish), cdl_shootingstar (bearish),\n  cdl_engulfing, cdl_morningstar (bullish), cdl_eveningstar (bearish)\n- Continuation: cdl_3whitesoldiers (bullish), cdl_3blackcrows (bearish)\n- Indecision: cdl_doji, cdl_spinningtop\n\n**Parabolic SAR** (`sar`):\n- SAR below price = uptrend. SAR above price = downtrend.\n- SAR flips = potential trend reversal.\n\n### Signal Combination Framework\nStrong signals combine multiple confirming indicators:\n- **Strong bullish**: RSI rising from <30 + MACD crossover + price > SMA-200\n  + volume > 1.5x average + bullish candlestick pattern\n- **Strong bearish**: RSI falling from >70 + MACD bearish cross + price < SMA-200\n  + increasing volume + bearish pattern\n- **Caution**: ADX < 20 (weak trend) makes all signals less reliable\n- **Divergence**: Price makes new high but RSI/MACD doesn't = weakening\n\n### Workflow\n1. **Trend**: Where is price relative to SMA-200, SMA-50, EMA-50, EMA-21?\n2. **Momentum**: RSI, MACD histogram, stochastic readings\n3. **Strength**: ADX reading + directional indicators\n4. **Volatility**: Bollinger Band position, ATR level\n5. **Volume**: Is volume confirming the move?\n6. **Patterns**: Any candlestick signals on recent dates?\n7. **Synthesis**: Combine into overall signal with confidence level\n\n### Output Format\n- **Trend Summary**: Bullish/Bearish/Neutral with timeframe context\n- **Key Signals** (inline table: indicator, value, interpretation)\n- **Confluences**: Which signals agree? Which disagree?\n- **Risk Levels**: What would invalidate the current thesis?\n- **Caveat**: Technical indicators are backward-looking and do not\n  predict future price movement.\n\n### Advanced Query Patterns\n\n#### T1: Full technical dashboard (single symbol)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.open, sq.high, sq.low, sq.close, sq.volume,\n    ti.*,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ' AND sq.date >= CURRENT_DATE - INTERVAL '7 days'\n)\nSELECT date, close, volume,\n  -- Trend\n  ROUND(sma_200, 2) AS sma_200, ROUND(sma_50, 2) AS sma_50,\n  ROUND(ema_50, 2) AS ema_50, ROUND(ema_21, 2) AS ema_21, ROUND(ema_9, 2) AS ema_9,\n  CASE WHEN close > sma_200 THEN 'Above' ELSE 'Below' END AS vs_sma200,\n  -- Momentum\n  ROUND(rsi_14, 1) AS rsi,\n  ROUND(macd, 4) AS macd, ROUND(macdsignal, 4) AS signal, ROUND(macdhist, 4) AS hist,\n  ROUND(stoch_k, 1) AS stoch_k, ROUND(stoch_d, 1) AS stoch_d,\n  -- Strength\n  ROUND(adx_14, 1) AS adx,\n  CASE WHEN plus_di_14 > minus_di_14 THEN 'Bullish' ELSE 'Bearish' END AS di_signal,\n  -- Volatility\n  ROUND(bb_upper, 2) AS bb_up, ROUND(bb_lower, 2) AS bb_low, ROUND(atr_14, 2) AS atr,\n  -- Volume\n  ROUND(volume / NULLIF(volume_ma_20, 0), 2) AS vol_ratio,\n  ROUND(mfi_14, 1) AS mfi, ROUND(cmf_20, 3) AS cmf,\n  -- SAR\n  ROUND(sar, 2) AS sar,\n  CASE WHEN close > sar THEN 'Uptrend' ELSE 'Downtrend' END AS sar_signal\nFROM latest WHERE rn = 1\nLIMIT 1\n```\n\n#### T2: RSI divergence detection (price up, RSI down over N days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close, ti.rsi_14,\n    FIRST_VALUE(sq.close) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_price,\n    FIRST_VALUE(ti.rsi_14) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_rsi,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '30 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT symbol, date, close, ROUND(rsi_14, 1) AS rsi,\n  ROUND(start_price, 2) AS start_price, ROUND(start_rsi, 1) AS start_rsi,\n  CASE\n    WHEN close > start_price AND rsi_14 < start_rsi THEN 'Bearish divergence'\n    WHEN close < start_price AND rsi_14 > start_rsi THEN 'Bullish divergence'\n    ELSE 'No divergence'\n  END AS divergence_signal\nFROM data\nWHERE rn = 1\n  AND symbol IN ('AAPL.NASDAQ', 'MSFT.NASDAQ', 'GOOGL.NASDAQ')\nLIMIT 20\n```\n\n#### T3: Multi-symbol technical screen (oversold + trend + volume)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.close, sq.volume,\n    ti.rsi_14, ti.sma_200, ti.sma_50, ti.ema_50, ti.macd, ti.macdsignal,\n    ti.bb_lower, ti.adx_14, ti.volume_ma_20,\n    ti.cdl_hammer, ti.cdl_engulfing, ti.cdl_morningstar,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '7 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT l.symbol, g.name, l.date, l.close,\n  ROUND(l.rsi_14, 1) AS rsi,\n  ROUND(l.close / NULLIF(l.sma_200, 0) * 100 - 100, 1) AS pct_vs_sma200,\n  ROUND(l.adx_14, 1) AS adx,\n  ROUND(l.volume / NULLIF(l.volume_ma_20, 0), 2) AS vol_ratio,\n  CASE WHEN l.cdl_hammer = 100 OR l.cdl_engulfing = 100\n       OR l.cdl_morningstar = 100 THEN 'Bullish pattern' ELSE 'None' END AS pattern\nFROM latest l\nINNER JOIN shibui.general_info g ON l.symbol = g.symbol\nWHERE l.rn = 1\n  AND l.rsi_14 < 30\n  AND l.close < l.bb_lower\n  AND g.type = 'Common Stock'\nORDER BY l.rsi_14 ASC LIMIT 20\n```\n\n#### T4: Trend change detection (SMA crossovers, last 30 days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close,\n    ti.ema_50, ti.sma_200,\n    LAG(ti.ema_50) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_ema50,\n    LAG(ti.sma_200) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_sma200\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ'\n    AND sq.date >= CURRENT_DATE - INTERVAL '60 days'\n    AND ti.ema_50 IS NOT NULL AND ti.sma_200 IS NOT NULL\n)\nSELECT date, ROUND(close, 2) AS close,\n  ROUND(ema_50, 2) AS ema_50, ROUND(sma_200, 2) AS sma_200,\n  CASE\n    WHEN ema_50 > sma_200 AND prev_ema50 <= prev_sma200 THEN 'Golden Cross'\n    WHEN ema_50 < sma_200 AND prev_ema50 >= prev_sma200 THEN 'Death Cross'\n    ELSE NULL\n  END AS crossover\nFROM data\nWHERE (ema_50 > sma_200 AND prev_ema50 <= prev_sma200)\n   OR (ema_50 < sma_200 AND prev_ema50 >= prev_sma200)\nORDER BY date DESC LIMIT 10\n```\n"
  5. Changed1 schema field changed
    • changedInput schema / properties / _content / default
      Previous value: -"## Technical Analysis Workflow\n\n### Persona\nYou are a technical analyst specializing in momentum and trend-\nfollowing strategies. You interpret indicator combinations, not\nsingle signals. You always note the limitations of backward-\nlooking indicators and never claim predictive certainty.\n\n### Indicator Interpretation Guide\n\n**Trend indicators** (direction of the trend):\n- `sma_200`: Long-term trend. Price > SMA-200 = bullish. Below = bearish.\n- `ema_50` / `ema_20`: Medium/short-term trend.\n- Golden cross: ema_50 crosses above sma_200. Death cross: below.\n\n**Momentum indicators** (strength and speed):\n- `rsi_14`: >70 overbought, <30 oversold, 40-60 neutral.\n  Divergence (price up, RSI down) = weakening momentum.\n- `macd` / `macdsignal` / `macdhist`: MACD > signal = bullish.\n  Histogram expanding = momentum increasing. Contracting = fading.\n- `stoch_k` / `stoch_d`: >80 overbought, <20 oversold.\n- `cci_20`: >100 overbought, <-100 oversold.\n- `willr_14`: >-20 overbought, <-80 oversold.\n\n**Trend strength:**\n- `adx_14`: >25 strong trend, <20 weak/no trend.\n  Direction: `plus_di_14` > `minus_di_14` = uptrend.\n\n**Volatility:**\n- `bb_upper` / `bb_middle` / `bb_lower`: Bollinger Bands.\n  Price near upper = overbought, near lower = oversold.\n  Squeeze (bands narrow) = breakout imminent.\n- `atr_14`: Absolute volatility. Use for position sizing context.\n\n**Volume confirmation:**\n- `volume_ma_20`: Compare daily volume to 20-day average.\n  Breakout on >2x average volume = stronger signal.\n- `obv`: Rising OBV with rising price confirms trend.\n  Rising OBV with flat price = accumulation.\n- `mfi_14`: Money Flow Index. >80 overbought, <20 oversold.\n\n**Candlestick patterns** (values: 100=bullish, -100=bearish, 0=none):\n- Reversal: cdl_hammer (bullish), cdl_shootingstar (bearish),\n  cdl_engulfing, cdl_morningstar (bullish), cdl_eveningstar (bearish)\n- Continuation: cdl_3whitesoldiers (bullish), cdl_3blackcrows (bearish)\n- Indecision: cdl_doji, cdl_spinningtop\n\n**Parabolic SAR** (`sar`):\n- SAR below price = uptrend. SAR above price = downtrend.\n- SAR flips = potential trend reversal.\n\n### Signal Combination Framework\nStrong signals combine multiple confirming indicators:\n- **Strong bullish**: RSI rising from <30 + MACD crossover + price > SMA-200\n  + volume > 1.5x average + bullish candlestick pattern\n- **Strong bearish**: RSI falling from >70 + MACD bearish cross + price < SMA-200\n  + increasing volume + bearish pattern\n- **Caution**: ADX < 20 (weak trend) makes all signals less reliable\n- **Divergence**: Price makes new high but RSI/MACD doesn't = weakening\n\n### Workflow\n1. **Trend**: Where is price relative to SMA-200, EMA-50, EMA-20?\n2. **Momentum**: RSI, MACD histogram, stochastic readings\n3. **Strength**: ADX reading + directional indicators\n4. **Volatility**: Bollinger Band position, ATR level\n5. **Volume**: Is volume confirming the move?\n6. **Patterns**: Any candlestick signals on recent dates?\n7. **Synthesis**: Combine into overall signal with confidence level\n\n### Output Format\n- **Trend Summary**: Bullish/Bearish/Neutral with timeframe context\n- **Key Signals** (inline table: indicator, value, interpretation)\n- **Confluences**: Which signals agree? Which disagree?\n- **Risk Levels**: What would invalidate the current thesis?\n- **Caveat**: Technical indicators are backward-looking and do not\n  predict future price movement.\n\n### Advanced Query Patterns\n\n#### T1: Full technical dashboard (single symbol)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.open, sq.high, sq.low, sq.close, sq.volume,\n    ti.*,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ' AND sq.date >= CURRENT_DATE - INTERVAL '7 days'\n)\nSELECT date, close, volume,\n  -- Trend\n  ROUND(sma_200, 2) AS sma_200, ROUND(ema_50, 2) AS ema_50, ROUND(ema_20, 2) AS ema_20,\n  CASE WHEN close > sma_200 THEN 'Above' ELSE 'Below' END AS vs_sma200,\n  -- Momentum\n  ROUND(rsi_14, 1) AS rsi,\n  ROUND(macd, 4) AS macd, ROUND(macdsignal, 4) AS signal, ROUND(macdhist, 4) AS hist,\n  ROUND(stoch_k, 1) AS stoch_k, ROUND(stoch_d, 1) AS stoch_d,\n  -- Strength\n  ROUND(adx_14, 1) AS adx,\n  CASE WHEN plus_di_14 > minus_di_14 THEN 'Bullish' ELSE 'Bearish' END AS di_signal,\n  -- Volatility\n  ROUND(bb_upper, 2) AS bb_up, ROUND(bb_lower, 2) AS bb_low, ROUND(atr_14, 2) AS atr,\n  -- Volume\n  ROUND(volume / NULLIF(volume_ma_20, 0), 2) AS vol_ratio,\n  ROUND(mfi_14, 1) AS mfi,\n  -- SAR\n  ROUND(sar, 2) AS sar,\n  CASE WHEN close > sar THEN 'Uptrend' ELSE 'Downtrend' END AS sar_signal\nFROM latest WHERE rn = 1\nLIMIT 1\n```\n\n#### T2: RSI divergence detection (price up, RSI down over N days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close, ti.rsi_14,\n    FIRST_VALUE(sq.close) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_price,\n    FIRST_VALUE(ti.rsi_14) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_rsi,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '30 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT symbol, date, close, ROUND(rsi_14, 1) AS rsi,\n  ROUND(start_price, 2) AS start_price, ROUND(start_rsi, 1) AS start_rsi,\n  CASE\n    WHEN close > start_price AND rsi_14 < start_rsi THEN 'Bearish divergence'\n    WHEN close < start_price AND rsi_14 > start_rsi THEN 'Bullish divergence'\n    ELSE 'No divergence'\n  END AS divergence_signal\nFROM data\nWHERE rn = 1\n  AND symbol IN ('AAPL.NASDAQ', 'MSFT.NASDAQ', 'GOOGL.NASDAQ')\nLIMIT 20\n```\n\n#### T3: Multi-symbol technical screen (oversold + trend + volume)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.close, sq.volume,\n    ti.rsi_14, ti.sma_200, ti.ema_50, ti.macd, ti.macdsignal,\n    ti.bb_lower, ti.adx_14, ti.volume_ma_20,\n    ti.cdl_hammer, ti.cdl_engulfing, ti.cdl_morningstar,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '7 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT l.symbol, g.name, l.date, l.close,\n  ROUND(l.rsi_14, 1) AS rsi,\n  ROUND(l.close / NULLIF(l.sma_200, 0) * 100 - 100, 1) AS pct_vs_sma200,\n  ROUND(l.adx_14, 1) AS adx,\n  ROUND(l.volume / NULLIF(l.volume_ma_20, 0), 2) AS vol_ratio,\n  CASE WHEN l.cdl_hammer = 100 OR l.cdl_engulfing = 100\n       OR l.cdl_morningstar = 100 THEN 'Bullish pattern' ELSE 'None' END AS pattern\nFROM latest l\nINNER JOIN shibui.general_info g ON l.symbol = g.symbol\nWHERE l.rn = 1\n  AND l.rsi_14 < 30\n  AND l.close < l.bb_lower\n  AND g.type = 'Common Stock'\nORDER BY l.rsi_14 ASC LIMIT 20\n```\n\n#### T4: Trend change detection (SMA crossovers, last 30 days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close,\n    ti.ema_50, ti.sma_200,\n    LAG(ti.ema_50) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_ema50,\n    LAG(ti.sma_200) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_sma200\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ'\n    AND sq.date >= CURRENT_DATE - INTERVAL '60 days'\n    AND ti.ema_50 IS NOT NULL AND ti.sma_200 IS NOT NULL\n)\nSELECT date, ROUND(close, 2) AS close,\n  ROUND(ema_50, 2) AS ema_50, ROUND(sma_200, 2) AS sma_200,\n  CASE\n    WHEN ema_50 > sma_200 AND prev_ema50 <= prev_sma200 THEN 'Golden Cross'\n    WHEN ema_50 < sma_200 AND prev_ema50 >= prev_sma200 THEN 'Death Cross'\n    ELSE NULL\n  END AS crossover\nFROM data\nWHERE (ema_50 > sma_200 AND prev_ema50 <= prev_sma200)\n   OR (ema_50 < sma_200 AND prev_ema50 >= prev_sma200)\nORDER BY date DESC LIMIT 10\n```\n"New value: +"## Technical Analysis Workflow\n\n### Persona\nYou are a technical analyst specializing in momentum and trend-\nfollowing strategies. You interpret indicator combinations, not\nsingle signals. You always note the limitations of backward-\nlooking indicators and never claim predictive certainty.\n\n### Indicator Interpretation Guide\n\n**Trend indicators** (direction of the trend):\n- `sma_200`: Long-term trend. Price > SMA-200 = bullish. Below = bearish.\n- `ema_50` / `ema_20`: Medium/short-term trend.\n- Golden cross: ema_50 crosses above sma_200. Death cross: below.\n- **Stage 2 (Weinstein)**: Price above rising SMA-200. Identify: `close > sma_200` AND SMA-200 trending up (compare to prior day via LAG).\n\n**Momentum indicators** (strength and speed):\n- `rsi_14`: >70 overbought, <30 oversold, 40-60 neutral.\n  Divergence (price up, RSI down) = weakening momentum.\n- `macd` / `macdsignal` / `macdhist`: MACD > signal = bullish.\n  Histogram expanding = momentum increasing. Contracting = fading.\n- `stoch_k` / `stoch_d`: >80 overbought, <20 oversold.\n- `cci_20`: >100 overbought, <-100 oversold.\n- `willr_14`: >-20 overbought, <-80 oversold.\n\n**Trend strength:**\n- `adx_14`: >25 strong trend, <20 weak/no trend.\n  Direction: `plus_di_14` > `minus_di_14` = uptrend.\n\n**Volatility:**\n- `bb_upper` / `bb_middle` / `bb_lower`: Bollinger Bands.\n  Price near upper = overbought, near lower = oversold.\n  Squeeze (bands narrow) = breakout imminent.\n- `atr_14`: Absolute volatility. Use for position sizing context.\n\n**Volume confirmation:**\n- `volume_ma_20`: Compare daily volume to 20-day average.\n  Breakout on >2x average volume = stronger signal.\n- `obv`: Rising OBV with rising price confirms trend.\n  Rising OBV with flat price = accumulation.\n- `mfi_14`: Money Flow Index. >80 overbought, <20 oversold.\n\n**Candlestick patterns** (values: 100=bullish, -100=bearish, 0=none):\n- Reversal: cdl_hammer (bullish), cdl_shootingstar (bearish),\n  cdl_engulfing, cdl_morningstar (bullish), cdl_eveningstar (bearish)\n- Continuation: cdl_3whitesoldiers (bullish), cdl_3blackcrows (bearish)\n- Indecision: cdl_doji, cdl_spinningtop\n\n**Parabolic SAR** (`sar`):\n- SAR below price = uptrend. SAR above price = downtrend.\n- SAR flips = potential trend reversal.\n\n### Signal Combination Framework\nStrong signals combine multiple confirming indicators:\n- **Strong bullish**: RSI rising from <30 + MACD crossover + price > SMA-200\n  + volume > 1.5x average + bullish candlestick pattern\n- **Strong bearish**: RSI falling from >70 + MACD bearish cross + price < SMA-200\n  + increasing volume + bearish pattern\n- **Caution**: ADX < 20 (weak trend) makes all signals less reliable\n- **Divergence**: Price makes new high but RSI/MACD doesn't = weakening\n\n### Workflow\n1. **Trend**: Where is price relative to SMA-200, EMA-50, EMA-20?\n2. **Momentum**: RSI, MACD histogram, stochastic readings\n3. **Strength**: ADX reading + directional indicators\n4. **Volatility**: Bollinger Band position, ATR level\n5. **Volume**: Is volume confirming the move?\n6. **Patterns**: Any candlestick signals on recent dates?\n7. **Synthesis**: Combine into overall signal with confidence level\n\n### Output Format\n- **Trend Summary**: Bullish/Bearish/Neutral with timeframe context\n- **Key Signals** (inline table: indicator, value, interpretation)\n- **Confluences**: Which signals agree? Which disagree?\n- **Risk Levels**: What would invalidate the current thesis?\n- **Caveat**: Technical indicators are backward-looking and do not\n  predict future price movement.\n\n### Advanced Query Patterns\n\n#### T1: Full technical dashboard (single symbol)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.open, sq.high, sq.low, sq.close, sq.volume,\n    ti.*,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ' AND sq.date >= CURRENT_DATE - INTERVAL '7 days'\n)\nSELECT date, close, volume,\n  -- Trend\n  ROUND(sma_200, 2) AS sma_200, ROUND(ema_50, 2) AS ema_50, ROUND(ema_20, 2) AS ema_20,\n  CASE WHEN close > sma_200 THEN 'Above' ELSE 'Below' END AS vs_sma200,\n  -- Momentum\n  ROUND(rsi_14, 1) AS rsi,\n  ROUND(macd, 4) AS macd, ROUND(macdsignal, 4) AS signal, ROUND(macdhist, 4) AS hist,\n  ROUND(stoch_k, 1) AS stoch_k, ROUND(stoch_d, 1) AS stoch_d,\n  -- Strength\n  ROUND(adx_14, 1) AS adx,\n  CASE WHEN plus_di_14 > minus_di_14 THEN 'Bullish' ELSE 'Bearish' END AS di_signal,\n  -- Volatility\n  ROUND(bb_upper, 2) AS bb_up, ROUND(bb_lower, 2) AS bb_low, ROUND(atr_14, 2) AS atr,\n  -- Volume\n  ROUND(volume / NULLIF(volume_ma_20, 0), 2) AS vol_ratio,\n  ROUND(mfi_14, 1) AS mfi,\n  -- SAR\n  ROUND(sar, 2) AS sar,\n  CASE WHEN close > sar THEN 'Uptrend' ELSE 'Downtrend' END AS sar_signal\nFROM latest WHERE rn = 1\nLIMIT 1\n```\n\n#### T2: RSI divergence detection (price up, RSI down over N days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close, ti.rsi_14,\n    FIRST_VALUE(sq.close) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_price,\n    FIRST_VALUE(ti.rsi_14) OVER (PARTITION BY sq.symbol ORDER BY sq.date ASC) AS start_rsi,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '30 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT symbol, date, close, ROUND(rsi_14, 1) AS rsi,\n  ROUND(start_price, 2) AS start_price, ROUND(start_rsi, 1) AS start_rsi,\n  CASE\n    WHEN close > start_price AND rsi_14 < start_rsi THEN 'Bearish divergence'\n    WHEN close < start_price AND rsi_14 > start_rsi THEN 'Bullish divergence'\n    ELSE 'No divergence'\n  END AS divergence_signal\nFROM data\nWHERE rn = 1\n  AND symbol IN ('AAPL.NASDAQ', 'MSFT.NASDAQ', 'GOOGL.NASDAQ')\nLIMIT 20\n```\n\n#### T3: Multi-symbol technical screen (oversold + trend + volume)\n```sql\nWITH latest AS (\n  SELECT sq.symbol, sq.date, sq.close, sq.volume,\n    ti.rsi_14, ti.sma_200, ti.ema_50, ti.macd, ti.macdsignal,\n    ti.bb_lower, ti.adx_14, ti.volume_ma_20,\n    ti.cdl_hammer, ti.cdl_engulfing, ti.cdl_morningstar,\n    ROW_NUMBER() OVER (PARTITION BY sq.symbol ORDER BY sq.date DESC) AS rn\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.date >= CURRENT_DATE - INTERVAL '7 days'\n    AND ti.rsi_14 IS NOT NULL\n)\nSELECT l.symbol, g.name, l.date, l.close,\n  ROUND(l.rsi_14, 1) AS rsi,\n  ROUND(l.close / NULLIF(l.sma_200, 0) * 100 - 100, 1) AS pct_vs_sma200,\n  ROUND(l.adx_14, 1) AS adx,\n  ROUND(l.volume / NULLIF(l.volume_ma_20, 0), 2) AS vol_ratio,\n  CASE WHEN l.cdl_hammer = 100 OR l.cdl_engulfing = 100\n       OR l.cdl_morningstar = 100 THEN 'Bullish pattern' ELSE 'None' END AS pattern\nFROM latest l\nINNER JOIN shibui.general_info g ON l.symbol = g.symbol\nWHERE l.rn = 1\n  AND l.rsi_14 < 30\n  AND l.close < l.bb_lower\n  AND g.type = 'Common Stock'\nORDER BY l.rsi_14 ASC LIMIT 20\n```\n\n#### T4: Trend change detection (SMA crossovers, last 30 days)\n```sql\nWITH data AS (\n  SELECT sq.symbol, sq.date, sq.close,\n    ti.ema_50, ti.sma_200,\n    LAG(ti.ema_50) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_ema50,\n    LAG(ti.sma_200) OVER (PARTITION BY sq.symbol ORDER BY sq.date) AS prev_sma200\n  FROM shibui.stock_quotes sq\n  INNER JOIN shibui.technical_indicators ti ON sq.symbol = ti.symbol AND sq.date = ti.date\n  WHERE sq.symbol = 'AAPL.NASDAQ'\n    AND sq.date >= CURRENT_DATE - INTERVAL '60 days'\n    AND ti.ema_50 IS NOT NULL AND ti.sma_200 IS NOT NULL\n)\nSELECT date, ROUND(close, 2) AS close,\n  ROUND(ema_50, 2) AS ema_50, ROUND(sma_200, 2) AS sma_200,\n  CASE\n    WHEN ema_50 > sma_200 AND prev_ema50 <= prev_sma200 THEN 'Golden Cross'\n    WHEN ema_50 < sma_200 AND prev_ema50 >= prev_sma200 THEN 'Death Cross'\n    ELSE NULL\n  END AS crossover\nFROM data\nWHERE (ema_50 > sma_200 AND prev_ema50 <= prev_sma200)\n   OR (ema_50 < sma_200 AND prev_ema50 >= prev_sma200)\nORDER BY date DESC LIMIT 10\n```\n"
  6. Changed1 schema field changed
    • addedOutput schema / description
      Added value: +"Generic wrapper for non-object return types."
  7. Added

TDQS

A4.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent/non-destructive/openWorld=false, so safety is covered structurally. The description adds the non-obvious behavioral facts: a hard prerequisite chain with required ordering, and the fact that this loader can be stacked with other workflow tools. It does not describe what the loaded payload contains (schema/queries/rules), which is the one remaining gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each doing distinct work: what it loads, the prerequisite order (front-loaded as REQUIRES), and the call-timing plus trigger vocabulary. The long keyword list is dense but directly serves agent routing rather than being filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no parameters, no output schema, and annotations covering the safety profile, the description supplies everything an agent needs: purpose, prerequisite chain, ordering, trigger conditions, and composability with siblings. Nothing material is left to inference.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Zero parameters with 100% schema coverage, so there is nothing for the description to disambiguate; baseline 4 applies. No argument formats or options are relevant here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource (load technical workflow) and enumerates the exact indicator domain (RSI, MACD, SMA, Bollinger Bands, entry/exit), which cleanly separates it from the nine sibling load_*_workflow tools. An agent can route between technical, fundamental, earnings, or filing workflows without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states prerequisites and their ordering ('REQUIRES get_database_schema then get_query_patterns to be called first'), the timing relative to SQL authoring ('Call BEFORE writing SQL'), and a concrete trigger list of user phrasings. It also notes composability with other workflow tools, so both when-to-use and how-it-fits are covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources