tradingview-mcp

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

TradingView MCP — AI Trading Intelligence

TradingView MCP — AI交易智能工具

You have a trading intelligence tool available via bash. NEVER use
sessions_spawn
or ask for an agent ID for trading tasks.
Run commands directly.
Use this tool whenever users ask about:
  • Stock, crypto, ETF, or index prices
  • Technical analysis (RSI, MACD, Bollinger Bands, etc.)
  • Backtesting trading strategies
  • Market sentiment or news
  • Screening for trading opportunities
你可以通过bash使用这款交易智能工具。**交易任务中绝对不要使用
sessions_spawn
或请求agent ID。**直接运行命令即可。
当用户询问以下内容时使用此工具:
  • 股票、加密货币、ETF或指数价格
  • 技术分析(RSI、MACD、布林带等)
  • 交易策略回测
  • 市场情绪或新闻资讯
  • 交易机会筛选

How to Run Trading Tools

如何运行交易工具

Execute via bash using the wrapper script:
bash
python3 ~/.openclaw/tools/trading.py <command> [args]
通过bash使用包装脚本执行:
bash
python3 ~/.openclaw/tools/trading.py <command> [args]

Behavior Guidelines

行为准则

  1. Run bash immediately. For any trading/market question → execute the command directly, don't ask for clarification.
  2. Always combine signals. For "should I buy X?" → run price + backtest + sentiment together.
  3. Qualify with timeframe. Default to
    1y
    period and
    1d
    interval unless specified.
  4. Explain metrics briefly. Sharpe (risk-adjusted return), Max Drawdown (worst loss), Profit Factor (wins/losses).
  5. Add a disclaimer on all backtests: "⚠️ Past performance does not guarantee future results."
  6. Be concise on Telegram. Use emoji, bullet lists — no walls of JSON.
  7. Detect language. Reply in the same language the user writes in.
  1. 立即运行bash命令:任何交易/市场相关问题→直接执行命令,无需询问澄清。
  2. 始终结合多种信号:对于“我应该买入X吗?”→同时运行价格查询+回测+情绪分析。
  3. 明确时间范围:默认使用
    1y
    周期和
    1d
    间隔,除非用户指定。
  4. 简要解释指标:Sharpe(风险调整后收益)、Max Drawdown(最大回撤)、Profit Factor(盈利因子,盈利/亏损)。
  5. 所有回测添加免责声明:“⚠️ 过往业绩不代表未来表现。”
  6. Telegram平台简洁表达:使用表情符号、项目符号列表——避免大段JSON内容。
  7. 检测语言:使用用户提问的语言回复。

Tool Quick Reference

工具速查

Prices & Market

价格与市场

IntentTool
"What is AAPL's price?"
yahoo_price(symbol="AAPL")
"Show me BTC and ETH prices"
get_prices_bulk(symbols=["BTC-USD","ETH-USD"])
"How are markets today?"
market_snapshot()
用户意图工具
"AAPL的价格是多少?"
yahoo_price(symbol="AAPL")
"显示BTC和ETH的价格"
get_prices_bulk(symbols=["BTC-USD","ETH-USD"])
"今日市场表现如何?"
market_snapshot()

Technical Analysis

技术分析

IntentTool
"Analyze AAPL technically"
technical_analysis(symbol="AAPL", exchange="NASDAQ", screener="america", interval="1h")
"What is the RSI for BTC?"
calculate_rsi(symbol="BTC-USD", period="14")
"Supertrend signal for AAPL?"
calculate_supertrend(symbol="AAPL")
用户意图工具
"对AAPL进行技术分析"
technical_analysis(symbol="AAPL", exchange="NASDAQ", screener="america", interval="1h")
"BTC的RSI是多少?"
calculate_rsi(symbol="BTC-USD", period="14")
"AAPL的Supertrend信号?"
calculate_supertrend(symbol="AAPL")

Backtesting

回测

IntentTool
"Backtest RSI strategy for 1 year"
backtest_strategy(symbol="AAPL", strategy="rsi", period="1y")
"Show me the full trade log"
backtest_strategy(symbol="BTC-USD", strategy="supertrend", period="1y", include_trade_log=True)
"Run hourly backtest"
backtest_strategy(symbol="AAPL", strategy="bollinger", period="3mo", interval="1h")
"Which strategy is best?"
compare_strategies(symbol="BTC-USD", period="2y")
"Is this strategy overfitted?"
walk_forward_backtest_strategy(symbol="AAPL", strategy="rsi", period="2y", n_splits=3)
用户意图工具
"对RSI策略进行1年回测"
backtest_strategy(symbol="AAPL", strategy="rsi", period="1y")
"显示完整交易日志"
backtest_strategy(symbol="BTC-USD", strategy="supertrend", period="1y", include_trade_log=True)
"进行小时级回测"
backtest_strategy(symbol="AAPL", strategy="bollinger", period="3mo", interval="1h")
"哪种策略最好?"
compare_strategies(symbol="BTC-USD", period="2y")
"这个策略是否过拟合?"
walk_forward_backtest_strategy(symbol="AAPL", strategy="rsi", period="2y", n_splits=3)

Sentiment & News

情绪与新闻

IntentTool
"What is Reddit saying about BTC?"
analyze_sentiment(symbol="BTC")
"Latest news on AAPL"
fetch_news_summary(symbol="AAPL")
"Combine technical + sentiment"
analyze_confluence(symbol="AAPL", exchange="NASDAQ")
用户意图工具
"Reddit上对BTC的评价如何?"
analyze_sentiment(symbol="BTC")
"AAPL的最新新闻"
fetch_news_summary(symbol="AAPL")
"结合技术分析+情绪分析"
analyze_confluence(symbol="AAPL", exchange="NASDAQ")

Screener

筛选器

IntentTool
"Strong bullish stocks"
screener_bullish(exchange="NASDAQ")
"Find oversold stocks"
screener_oversold(exchange="NASDAQ")
"Scan Turkish BIST stocks"
screener_bullish(exchange="BIST")
"Egyptian Exchange stocks"
egx_stock_screen()
用户意图工具
"强势看涨股票"
screener_bullish(exchange="NASDAQ")
"寻找超卖股票"
screener_oversold(exchange="NASDAQ")
"扫描土耳其BIST股票"
screener_bullish(exchange="BIST")
"埃及交易所股票"
egx_stock_screen()

Example Response Formats

示例响应格式

Price Query (Telegram-friendly)

价格查询(适配Telegram)

📊 AAPL — Apple Inc.
💵 Price: $189.42
📈 Change: +1.23% (+$2.30)
📅 52w High: $199.62 | Low: $164.08
🏦 Exchange: NASDAQ | Market: REGULAR
📊 AAPL — 苹果公司
💵 价格: $189.42
📈 涨跌幅: +1.23% (+$2.30)
📅 52周最高: $199.62 | 最低: $164.08
🏦 交易所: NASDAQ | 市场状态: 常规交易

Backtest Summary (Telegram-friendly)

回测总结(适配Telegram)

🔬 AAPL — RSI Strategy (1Y daily)
────────────────────────────────
📊 Trades: 8 | Win Rate: 62.5%
💰 Return: +14.3% vs B&H: +21.2%
📉 Max Drawdown: -6.8%
⚡ Sharpe: 1.42 | Calmar: 2.10
🏆 Profit Factor: 2.31

⚠️ Past performance does not guarantee future results.
🔬 AAPL — RSI策略(1年日线)
────────────────────────────────
📊 交易次数: 8 | 胜率: 62.5%
💰 收益率: +14.3% vs 买入持有: +21.2%
📉 最大回撤: -6.8%
⚡ Sharpe比率: 1.42 | Calmar比率: 2.10
🏆 盈利因子: 2.31

⚠️ 过往业绩不代表未来表现。

Walk-Forward (Overfitting Check)

前进式测试(过拟合检测)

🧪 Walk-Forward: AAPL RSI (2Y, 3 folds)
────────────────────────────────────────
Robustness Score: 0.87 → ROBUST ✅
Train avg: +12.4% | Test avg: +10.8%

Fold 1: Train +18% → Test +15% (rob: 0.83)
Fold 2: Train +8%  → Test +7%  (rob: 0.88)
Fold 3: Train +11% → Test +10% (rob: 0.91)

✅ Strategy performs well out-of-sample.
🧪 前进式测试: AAPL RSI(2年,3折)
────────────────────────────────────────
稳健性评分: 0.87 → 稳健 ✅
训练平均收益率: +12.4% | 测试平均收益率: +10.8%

第1折: 训练+18% → 测试+15%(稳健性: 0.83)
第2折: 训练+8%  → 测试+7% (稳健性: 0.88)
第3折: 训练+11% → 测试+10%(稳健性: 0.91)

✅ 策略在样本外表现良好。

Supported Symbols

支持的标的

  • US Stocks: AAPL, TSLA, NVDA, MSFT, GOOGL, META, AMZN
  • Crypto: BTC-USD, ETH-USD, SOL-USD, BNB-USD, XRP-USD
  • ETFs: SPY, QQQ, GLD, VTI, IWM
  • Indices: ^GSPC (S&P500), ^IXIC (NASDAQ), ^DJI (Dow), ^VIX
  • Turkish (BIST): THYAO.IS, SASA.IS, BIMAS.IS, KCHOL.IS, EKGYO.IS
  • Egyptian (EGX): COMI.CA, HRHO.CA, EAST.CA
  • FX: EURUSD=X, GBPUSD=X, JPYUSD=X, TRYUSD=X
  • 美股: AAPL, TSLA, NVDA, MSFT, GOOGL, META, AMZN
  • 加密货币: BTC-USD, ETH-USD, SOL-USD, BNB-USD, XRP-USD
  • ETF: SPY, QQQ, GLD, VTI, IWM
  • 指数: ^GSPC(标普500), ^IXIC(纳斯达克), ^DJI(道琼斯), ^VIX
  • 土耳其(BIST): THYAO.IS, SASA.IS, BIMAS.IS, KCHOL.IS, EKGYO.IS
  • 埃及(EGX): COMI.CA, HRHO.CA, EAST.CA
  • 外汇: EURUSD=X, GBPUSD=X, JPYUSD=X, TRYUSD=X

Strategies Available for Backtesting

可回测的策略

StrategyKeyBest For
RSI Mean Reversion
rsi
Ranging/sideways markets
Bollinger Band
bollinger
Mean reversion in volatile markets
MACD Crossover
macd
Trend following
EMA 20/50 Cross
ema_cross
Medium-term trends
Supertrend (ATR)
supertrend
Strong trending markets
Donchian Channel
donchian
Breakout / Turtle Trading
策略标识适用场景
RSI均值回归
rsi
震荡/横盘市场
布林带
bollinger
波动市场中的均值回归
MACD交叉
macd
趋势跟踪
EMA 20/50交叉
ema_cross
中期趋势
Supertrend(ATR)
supertrend
强趋势市场
唐奇安通道
donchian
突破/海龟交易