longbridge-technical

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

longbridge-technical

longbridge-technical

Computes seven classic technical indicators from 200 days of OHLCV data and produces a composite buy / sell / neutral signal via a multi-dimensional voting mechanism.
Response language: match the user's input language — Simplified Chinese / Traditional Chinese / English.
基于200天的OHLCV数据计算7种经典技术指标,并通过多维度投票机制生成综合买入/卖出/中性信号。
响应语言:匹配用户输入语言——简体中文/繁体中文/英文。

When to use

使用场景

  • "NVDA MACD 金叉了吗", "TSLA RSI 超买了吗", "700.HK 技术指标怎么看"
  • "600519.SH 布林带收口", "AAPL 技術分析信號", "ADX 趋势强吗"
  • "technical analysis for NVDA", "is TSLA overbought on RSI", "MACD signal"
  • "NVDA MACD 金叉了吗", "TSLA RSI 超买了吗", "700.HK 技术指标怎么看"
  • "600519.SH 布林带收口", "AAPL 技術分析信號", "ADX 趋势强吗"
  • "technical analysis for NVDA", "is TSLA overbought on RSI", "MACD signal"

Workflow

工作流程

  1. Resolve the symbol to
    <CODE>.<MARKET>
    format.
  2. Fetch 200 daily candles:
    bash
    longbridge kline <SYMBOL> --period day --count 200 --format json
  3. Run the Python analysis below to compute all indicators and their individual votes.
  4. Report each indicator's current value and signal, then summarise with the composite vote tally.
  1. 将股票代码解析为
    <CODE>.<MARKET>
    格式。
  2. 获取200日K线数据:
    bash
    longbridge kline <SYMBOL> --period day --count 200 --format json
  3. 运行下方的Python分析代码,计算所有指标及其独立投票结果。
  4. 报告每个指标的当前值和信号,然后汇总综合投票结果。

CLI

CLI

bash
longbridge kline NVDA.US   --period day --count 200 --format json
longbridge kline 700.HK    --period day --count 200 --format json
longbridge kline 600519.SH --period day --count 200 --format json
Run
longbridge kline --help
to verify current flag names and defaults.
bash
longbridge kline NVDA.US   --period day --count 200 --format json
longbridge kline 700.HK    --period day --count 200 --format json
longbridge kline 600519.SH --period day --count 200 --format json
运行
longbridge kline --help
查看当前参数名称和默认值。

Python analysis

Python analysis

python
import pandas as pd, json, sys

data = json.loads(sys.stdin.read())
df = pd.DataFrame(data)
df = df.rename(columns={"open":"o","high":"h","low":"l","close":"c","volume":"v"})
df[["o","h","l","c","v"]] = df[["o","h","l","c","v"]].apply(pd.to_numeric)

votes = {}
python
import pandas as pd, json, sys

data = json.loads(sys.stdin.read())
df = pd.DataFrame(data)
df = df.rename(columns={"open":"o","high":"h","low":"l","close":"c","volume":"v"})
df[["o","h","l","c","v"]] = df[["o","h","l","c","v"]].apply(pd.to_numeric)

votes = {}

EMA helper

EMA helper

def ema(s, n): return s.ewm(span=n, adjust=False).mean()
def ema(s, n): return s.ewm(span=n, adjust=False).mean()

--- MACD (12, 26, 9) ---

--- MACD (12, 26, 9) ---

ema12 = ema(df["c"], 12); ema26 = ema(df["c"], 26) macd = ema12 - ema26; signal = ema(macd, 9); hist = macd - signal votes["MACD"] = +1 if hist.iloc[-1] > 0 and hist.iloc[-1] > hist.iloc[-2] else ( -1 if hist.iloc[-1] < 0 and hist.iloc[-1] < hist.iloc[-2] else 0)
ema12 = ema(df["c"], 12); ema26 = ema(df["c"], 26) macd = ema12 - ema26; signal = ema(macd, 9); hist = macd - signal votes["MACD"] = +1 if hist.iloc[-1] > 0 and hist.iloc[-1] > hist.iloc[-2] else ( -1 if hist.iloc[-1] < 0 and hist.iloc[-1] < hist.iloc[-2] else 0)

--- RSI (14) ---

--- RSI (14) ---

delta = df["c"].diff(); gain = delta.clip(lower=0); loss = (-delta).clip(lower=0) avg_g = gain.ewm(alpha=1/14, adjust=False).mean() avg_l = loss.ewm(alpha=1/14, adjust=False).mean() rsi = 100 - 100 / (1 + avg_g / avg_l.replace(0, 1e-9)) rsi_last = rsi.iloc[-1] votes["RSI"] = -1 if rsi_last > 70 else (+1 if rsi_last < 30 else 0)
delta = df["c"].diff(); gain = delta.clip(lower=0); loss = (-delta).clip(lower=0) avg_g = gain.ewm(alpha=1/14, adjust=False).mean() avg_l = loss.ewm(alpha=1/14, adjust=False).mean() rsi = 100 - 100 / (1 + avg_g / avg_l.replace(0, 1e-9)) rsi_last = rsi.iloc[-1] votes["RSI"] = -1 if rsi_last > 70 else (+1 if rsi_last < 30 else 0)

--- KDJ (9, 3, 3) ---

--- KDJ (9, 3, 3) ---

low9 = df["l"].rolling(9).min(); high9 = df["h"].rolling(9).max() rsv = (df["c"] - low9) / (high9 - low9 + 1e-9) * 100 K = rsv.ewm(alpha=1/3, adjust=False).mean() D = K.ewm(alpha=1/3, adjust=False).mean() J = 3K - 2D votes["KDJ"] = +1 if J.iloc[-1] < 20 else (-1 if J.iloc[-1] > 80 else 0)
low9 = df["l"].rolling(9).min(); high9 = df["h"].rolling(9).max() rsv = (df["c"] - low9) / (high9 - low9 + 1e-9) * 100 K = rsv.ewm(alpha=1/3, adjust=False).mean() D = K.ewm(alpha=1/3, adjust=False).mean() J = 3K - 2D votes["KDJ"] = +1 if J.iloc[-1] < 20 else (-1 if J.iloc[-1] > 80 else 0)

--- Bollinger Bands (20, 2) ---

--- Bollinger Bands (20, 2) ---

mid = df["c"].rolling(20).mean(); std = df["c"].rolling(20).std() upper_bb = mid + 2std; lower_bb = mid - 2std c_last = df["c"].iloc[-1] votes["Bollinger"] = +1 if c_last < lower_bb.iloc[-1] else ( -1 if c_last > upper_bb.iloc[-1] else 0)
mid = df["c"].rolling(20).mean(); std = df["c"].rolling(20).std() upper_bb = mid + 2std; lower_bb = mid - 2std c_last = df["c"].iloc[-1] votes["Bollinger"] = +1 if c_last < lower_bb.iloc[-1] else ( -1 if c_last > upper_bb.iloc[-1] else 0)

--- EMA cross (50 / 200) ---

--- EMA cross (50 / 200) ---

e50 = ema(df["c"], 50); e200 = ema(df["c"], 200) votes["EMA_cross"] = +1 if e50.iloc[-1] > e200.iloc[-1] else -1
e50 = ema(df["c"], 50); e200 = ema(df["c"], 200) votes["EMA_cross"] = +1 if e50.iloc[-1] > e200.iloc[-1] else -1

--- ADX (14) ---

--- ADX (14) ---

tr = pd.concat([df["h"]-df["l"], (df["h"]-df["c"].shift()).abs(), (df["l"]-df["c"].shift()).abs()], axis=1).max(axis=1) dm_plus = (df["h"]-df["h"].shift()).clip(lower=0) dm_minus = (df["l"].shift()-df["l"]).clip(lower=0) atr14 = tr.ewm(alpha=1/14, adjust=False).mean() di_plus = 100 * dm_plus.ewm(alpha=1/14, adjust=False).mean() / atr14 di_minus = 100 * dm_minus.ewm(alpha=1/14, adjust=False).mean() / atr14 dx = (di_plus - di_minus).abs() / (di_plus + di_minus + 1e-9) * 100 adx = dx.ewm(alpha=1/14, adjust=False).mean()
tr = pd.concat([df["h"]-df["l"], (df["h"]-df["c"].shift()).abs(), (df["l"]-df["c"].shift()).abs()], axis=1).max(axis=1) dm_plus = (df["h"]-df["h"].shift()).clip(lower=0) dm_minus = (df["l"].shift()-df["l"]).clip(lower=0) atr14 = tr.ewm(alpha=1/14, adjust=False).mean() di_plus = 100 * dm_plus.ewm(alpha=1/14, adjust=False).mean() / atr14 di_minus = 100 * dm_minus.ewm(alpha=1/14, adjust=False).mean() / atr14 dx = (di_plus - di_minus).abs() / (di_plus + di_minus + 1e-9) * 100 adx = dx.ewm(alpha=1/14, adjust=False).mean()

ADX > 25 confirms trend; direction from DI cross

ADX > 25 confirms trend; direction from DI cross

votes["ADX"] = +1 if adx.iloc[-1] > 25 and di_plus.iloc[-1] > di_minus.iloc[-1] else ( -1 if adx.iloc[-1] > 25 and di_minus.iloc[-1] > di_plus.iloc[-1] else 0)
votes["ADX"] = +1 if adx.iloc[-1] > 25 and di_plus.iloc[-1] > di_minus.iloc[-1] else ( -1 if adx.iloc[-1] > 25 and di_minus.iloc[-1] > di_plus.iloc[-1] else 0)

--- OBV ---

--- OBV ---

obv = (df["v"] * df["c"].diff().apply(lambda x: 1 if x > 0 else (-1 if x < 0 else 0))).cumsum() votes["OBV"] = +1 if obv.iloc[-1] > obv.iloc[-5] else (-1 if obv.iloc[-1] < obv.iloc[-5] else 0)
obv = (df["v"] * df["c"].diff().apply(lambda x: 1 if x > 0 else (-1 if x < 0 else 0))).cumsum() votes["OBV"] = +1 if obv.iloc[-1] > obv.iloc[-5] else (-1 if obv.iloc[-1] < obv.iloc[-5] else 0)

--- Composite ---

--- Composite ---

total = sum(votes.values()) composite = "买入/Buy" if total >= 3 else ("卖出/Sell" if total <= -3 else "持观望/Neutral")
print(f"Composite vote: {total:+d} → {composite}") print(f" MACD hist={hist.iloc[-1]:.4f} vote={votes['MACD']:+d}") print(f" RSI(14)={rsi_last:.1f} vote={votes['RSI']:+d}") print(f" KDJ J={J.iloc[-1]:.1f} vote={votes['KDJ']:+d}") print(f" Bollinger vote={votes['Bollinger']:+d} (price vs bands)") print(f" EMA50/200 vote={votes['EMA_cross']:+d} (50={'above' if e50.iloc[-1]>e200.iloc[-1] else 'below'} 200)") print(f" ADX={adx.iloc[-1]:.1f} DI+={di_plus.iloc[-1]:.1f} DI-={di_minus.iloc[-1]:.1f} vote={votes['ADX']:+d}") print(f" OBV trend vote={votes['OBV']:+d}")
undefined
total = sum(votes.values()) composite = "买入/Buy" if total >= 3 else ("卖出/Sell" if total <= -3 else "持观望/Neutral")
print(f"Composite vote: {total:+d} → {composite}") print(f" MACD hist={hist.iloc[-1]:.4f} vote={votes['MACD']:+d}") print(f" RSI(14)={rsi_last:.1f} vote={votes['RSI']:+d}") print(f" KDJ J={J.iloc[-1]:.1f} vote={votes['KDJ']:+d}") print(f" Bollinger vote={votes['Bollinger']:+d} (price vs bands)") print(f" EMA50/200 vote={votes['EMA_cross']:+d} (50={'above' if e50.iloc[-1]>e200.iloc[-1] else 'below'} 200)") print(f" ADX={adx.iloc[-1]:.1f} DI+={di_plus.iloc[-1]:.1f} DI-={di_minus.iloc[-1]:.1f} vote={votes['ADX']:+d}") print(f" OBV trend vote={votes['OBV']:+d}")
undefined

Output

输出格式

Present a table of indicator values, individual votes (+1 / 0 / -1), and a composite summary row. End with a one-sentence interpretation in the user's language.
指标 / 指標 / Indicator当前值 / 當前值 / Value信号 / 訊號 / Signal
MACDhist 值多/空/中性
RSI(14)数值超卖/中性/超买
KDJ J数值超卖/中性/超买
Bollinger价格位置超卖/中性/超买
EMA 50/200多空排列多头/空头
ADX趋势强度趋势/震荡
OBV5日趋势流入/流出
展示指标值、独立投票结果(+1/0/-1)的表格,以及综合汇总行。最后用用户使用的语言给出一句解读。
指标 / 指標 / Indicator当前值 / 當前值 / Value信号 / 訊號 / Signal
MACDhist 值多/空/中性
RSI(14)数值超卖/中性/超买
KDJ J数值超卖/中性/超买
Bollinger价格位置超卖/中性/超买
EMA 50/200多空排列多头/空头
ADX趋势强度趋势/震荡
OBV5日趋势流入/流出

Error handling

错误处理

Situation简体回复 / 繁體回覆 / English reply
command not found: longbridge
请安装 longbridge-terminal / 請安裝 longbridge-terminal / Install longbridge-terminal first
stderr
not logged in
/
unauthorized
请运行
longbridge auth login
/ 請執行
longbridge auth login
/ Run
longbridge auth login
Other stderr直接展示错误信息 / 直接顯示錯誤訊息 / Surface error verbatim
Situation简体回复 / 繁體回覆 / English reply
command not found: longbridge
请安装 longbridge-terminal / 請安裝 longbridge-terminal / Install longbridge-terminal first
stderr
not logged in
/
unauthorized
请运行
longbridge auth login
/ 請執行
longbridge auth login
/ Run
longbridge auth login
Other stderr直接展示错误信息 / 直接顯示錯誤訊息 / Surface error verbatim

MCP fallback

MCP备用方案

If
longbridge
binary is unavailable, call
mcp__longbridge__kline
with equivalent parameters and run the same analysis.
如果
longbridge
二进制文件不可用,请调用
mcp__longbridge__kline
并传入等效参数,然后运行相同的分析。

Related skills

相关技能

  • longbridge-kline
    — raw OHLCV data and charting
  • longbridge-candlestick
    — K-line pattern recognition
  • longbridge-ichimoku
    — Ichimoku Cloud system
  • longbridge-capital-flow
    — intraday capital-flow signals
  • longbridge-kline
    — 原始OHLCV数据与绘图
  • longbridge-candlestick
    — K线形态识别
  • longbridge-ichimoku
    — 一目均衡表系统
  • longbridge-capital-flow
    — 日内资金流信号