indicator-chart

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Create an interactive Plotly chart for a technical indicator on a symbol.
为某一标的的技术指标创建交互式Plotly图表。

Arguments

参数说明

Parse
$ARGUMENTS
as: indicator symbol exchange interval
  • $0
    = indicator name (e.g., ema, rsi, macd, supertrend, bbands, adx, stochastic, ichimoku, obv, vwap). Default: ema
  • $1
    = symbol (e.g., SBIN, RELIANCE, NIFTY, AAPL). Default: SBIN
  • $2
    = exchange (e.g., NSE, BSE, NFO, NSE_INDEX). Default: NSE. For US symbols use: YFINANCE
  • $3
    = interval (e.g., D, 1h, 5m). Default: D
If no arguments, ask the user which indicator and symbol they want.
$ARGUMENTS
解析为:indicator symbol exchange interval
  • $0
    = 指标名称(例如:ema、rsi、macd、supertrend、bbands、adx、stochastic、ichimoku、obv、vwap)。默认值:ema
  • $1
    = 标的代码(例如:SBIN、RELIANCE、NIFTY、AAPL)。默认值:SBIN
  • $2
    = 交易所(例如:NSE、BSE、NFO、NSE_INDEX)。默认值:NSE。美股标的请使用:YFINANCE
  • $3
    = 时间周期(例如:D、1h、5m)。默认值:D
如果未提供任何参数,请询问用户想要查看的指标和标的。

Instructions

操作步骤

  1. Read the indicator-expert skill rules for reference patterns
  2. Create
    charts/{indicator_name}/
    directory if it doesn't exist (on-demand)
  3. Create a
    .py
    file in
    charts/{indicator_name}/
    named
    {symbol}_{indicator}_chart.py
  4. Use the matching template from
    rules/assets/{indicator}_chart/chart.py
    as starting point (if available)
  5. The script must:
    • Load
      .env
      from project root using
      find_dotenv()
    • Fetch data via OpenAlgo
      client.history()
      (or yfinance for US symbols)
    • Normalize data: convert index to datetime, sort, strip timezone
    • Compute the indicator using
      openalgo.ta
    • Create a Plotly chart with
      template="plotly_dark"
      and
      xaxis_type="category"
    • Overlay indicators (EMA, Bollinger, Supertrend, Ichimoku) go on the candlestick panel
    • Subplot indicators (RSI, MACD, Stochastic, ADX, Volume, OBV) go below in separate panels
    • Use
      make_subplots
      for multi-panel layouts
    • Add horizontal reference lines where appropriate (RSI 30/70, Stochastic 20/80)
    • Print a plain-language explanation of the current indicator reading
    • Save chart as HTML:
      {symbol}_{indicator}_chart.html
    • Show chart with
      fig.show()
  6. Never use icons/emojis in code or output
  1. 参考indicator-expert技能规则中的模式
  2. 按需创建
    charts/{indicator_name}/
    目录(若不存在)
  3. charts/{indicator_name}/
    目录下创建名为
    {symbol}_{indicator}_chart.py
    的Python文件
  4. 若有可用模板,以
    rules/assets/{indicator}_chart/chart.py
    中的匹配模板为起点
  5. 脚本必须实现以下功能:
    • 使用
      find_dotenv()
      从项目根目录加载
      .env
      文件
    • 通过OpenAlgo的
      client.history()
      获取数据(美股标的使用yfinance)
    • 数据标准化:将索引转换为日期时间格式,排序并移除时区信息
    • 使用
      openalgo.ta
      计算技术指标
    • 创建Plotly图表,设置
      template="plotly_dark"
      xaxis_type="category"
    • 叠加指标(EMA、布林带、Supertrend、Ichimoku)需放置在K线图面板中
    • 子图指标(RSI、MACD、Stochastic、ADX、成交量、OBV)需放置在下方独立面板中
    • 使用
      make_subplots
      创建多面板布局
    • 按需添加水平参考线(如RSI的30/70线、Stochastic的20/80线)
    • 打印当前指标读数的通俗解释
    • 将图表保存为HTML文件:
      {symbol}_{indicator}_chart.html
    • 使用
      fig.show()
      展示图表
  6. 代码或输出中不得使用图标/表情符号

Indicator Chart Types

指标图表类型

Overlay Indicators (on candlestick panel)

叠加指标(K线图面板内)

IndicatorChart Type
ema, sma, wma, dema, tema, hmaLine overlay
bbandsFill-between bands + midline
supertrendColor-coded line (green=up, red=down)
ichimoku5 lines + cloud fill
keltner, donchianFill-between channels
sarDot markers above/below price
ma-envelopesUpper/lower band lines
指标图表类型
ema, sma, wma, dema, tema, hma折线叠加
bbands填充区间带 + 中线
supertrend颜色编码折线(绿色=上涨,红色=下跌)
ichimoku5条线 + 云状填充
keltner, donchian填充区间通道
sar价格上下方的点状标记
ma-envelopes上下轨折线

Subplot Indicators (separate panel below)

子图指标(下方独立面板)

IndicatorChart Type
rsiLine + horizontal 30/70 zones
macdLine + signal + histogram bars
stochasticK% + D% lines + 20/80 zones
adxDI+, DI-, ADX lines + 25 threshold
cciLine + horizontal +100/-100 zones
williams_rLine + -20/-80 zones
obvLine (cumulative)
mfiLine + 20/80 zones
volumeBar chart (green/red by price direction)
atrLine (volatility)
指标图表类型
rsi折线 + 30/70水平区间
macd折线 + 信号线 + 柱状图
stochasticK% + D%线 + 20/80区间
adxDI+、DI-、ADX线 + 25阈值
cci折线 + +100/-100水平区间
williams_r折线 + -20/-80区间
obv累积折线
mfi折线 + 20/80区间
volume柱状图(根据价格方向显示绿色/红色)
atr波动率折线

Multi-Indicator Charts

多指标图表

If user asks for "multi" or multiple indicators, create a comprehensive multi-panel chart with:
  • Row 1: Candlestick + EMA overlays
  • Row 2: RSI(14)
  • Row 3: MACD(12,26,9)
  • Row 4: Volume bars
若用户要求“multi”或多个指标,创建包含以下内容的综合多面板图表:
  • 第一行:K线图 + EMA叠加层
  • 第二行:RSI(14)
  • 第三行:MACD(12,26,9)
  • 第四行:成交量柱状图

Signal Markers

信号标记

If the indicator generates clear buy/sell signals (e.g., crossover, supertrend direction change), add triangle markers:
  • Buy: green triangle-up markers
  • Sell: red triangle-down markers
若指标生成明确的买卖信号(如交叉、Supertrend方向变化),添加三角形标记:
  • 买入信号:绿色向上三角形标记
  • 卖出信号:红色向下三角形标记

Data Periods

数据周期

IntervalDefault Lookback
D1 year (365 days)
1h6 months (180 days)
15m, 30m3 months (90 days)
5m1 month (30 days)
1m7 days
时间周期默认回溯周期
D1年(365天)
1h6个月(180天)
15m, 30m3个月(90天)
5m1个月(30天)
1m7天

Plain-Language Explanation

通俗解释

After creating the chart, print a brief explanation:
SBIN — RSI(14) Analysis
Current RSI: 42.3
Interpretation: Neutral zone (between 30-70). Neither overbought nor oversold.
Trend: RSI has been declining from 65 over the past 5 bars, suggesting weakening momentum.
创建图表后,打印简要说明:
SBIN — RSI(14) 分析
当前RSI值:42.3
解读:中性区间(介于30-70之间),既未超买也未超卖。
趋势:RSI在过去5根K线中从65持续下跌,表明动能正在减弱。

Example Usage

使用示例

/indicator-chart ema SBIN NSE D
/indicator-chart rsi RELIANCE NSE D
/indicator-chart macd AAPL YFINANCE D
/indicator-chart supertrend NIFTY NSE_INDEX D
/indicator-chart multi SBIN NSE D
/indicator-chart bbands INFY NSE 1h
/indicator-chart ema SBIN NSE D
/indicator-chart rsi RELIANCE NSE D
/indicator-chart macd AAPL YFINANCE D
/indicator-chart supertrend NIFTY NSE_INDEX D
/indicator-chart multi SBIN NSE D
/indicator-chart bbands INFY NSE 1h