indicator-chart
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate an interactive Plotly chart for a technical indicator on a symbol.
为某一标的的技术指标创建交互式Plotly图表。
Arguments
参数说明
Parse as: indicator symbol exchange interval
$ARGUMENTS- = indicator name (e.g., ema, rsi, macd, supertrend, bbands, adx, stochastic, ichimoku, obv, vwap). Default: ema
$0 - = symbol (e.g., SBIN, RELIANCE, NIFTY, AAPL). Default: SBIN
$1 - = exchange (e.g., NSE, BSE, NFO, NSE_INDEX). Default: NSE. For US symbols use: YFINANCE
$2 - = interval (e.g., D, 1h, 5m). Default: D
$3
If no arguments, ask the user which indicator and symbol they want.
将解析为:indicator symbol exchange interval
$ARGUMENTS- = 指标名称(例如:ema、rsi、macd、supertrend、bbands、adx、stochastic、ichimoku、obv、vwap)。默认值:ema
$0 - = 标的代码(例如:SBIN、RELIANCE、NIFTY、AAPL)。默认值:SBIN
$1 - = 交易所(例如:NSE、BSE、NFO、NSE_INDEX)。默认值:NSE。美股标的请使用:YFINANCE
$2 - = 时间周期(例如:D、1h、5m)。默认值:D
$3
如果未提供任何参数,请询问用户想要查看的指标和标的。
Instructions
操作步骤
- Read the indicator-expert skill rules for reference patterns
- Create directory if it doesn't exist (on-demand)
charts/{indicator_name}/ - Create a file in
.pynamedcharts/{indicator_name}/{symbol}_{indicator}_chart.py - Use the matching template from as starting point (if available)
rules/assets/{indicator}_chart/chart.py - The script must:
- Load from project root using
.envfind_dotenv() - Fetch data via OpenAlgo (or yfinance for US symbols)
client.history() - Normalize data: convert index to datetime, sort, strip timezone
- Compute the indicator using
openalgo.ta - Create a Plotly chart with and
template="plotly_dark"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 for multi-panel layouts
make_subplots - 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()
- Load
- Never use icons/emojis in code or output
- 参考indicator-expert技能规则中的模式
- 按需创建目录(若不存在)
charts/{indicator_name}/ - 在目录下创建名为
charts/{indicator_name}/的Python文件{symbol}_{indicator}_chart.py - 若有可用模板,以中的匹配模板为起点
rules/assets/{indicator}_chart/chart.py - 脚本必须实现以下功能:
- 使用从项目根目录加载
find_dotenv()文件.env - 通过OpenAlgo的获取数据(美股标的使用yfinance)
client.history() - 数据标准化:将索引转换为日期时间格式,排序并移除时区信息
- 使用计算技术指标
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()
- 使用
- 代码或输出中不得使用图标/表情符号
Indicator Chart Types
指标图表类型
Overlay Indicators (on candlestick panel)
叠加指标(K线图面板内)
| Indicator | Chart Type |
|---|---|
| ema, sma, wma, dema, tema, hma | Line overlay |
| bbands | Fill-between bands + midline |
| supertrend | Color-coded line (green=up, red=down) |
| ichimoku | 5 lines + cloud fill |
| keltner, donchian | Fill-between channels |
| sar | Dot markers above/below price |
| ma-envelopes | Upper/lower band lines |
| 指标 | 图表类型 |
|---|---|
| ema, sma, wma, dema, tema, hma | 折线叠加 |
| bbands | 填充区间带 + 中线 |
| supertrend | 颜色编码折线(绿色=上涨,红色=下跌) |
| ichimoku | 5条线 + 云状填充 |
| keltner, donchian | 填充区间通道 |
| sar | 价格上下方的点状标记 |
| ma-envelopes | 上下轨折线 |
Subplot Indicators (separate panel below)
子图指标(下方独立面板)
| Indicator | Chart Type |
|---|---|
| rsi | Line + horizontal 30/70 zones |
| macd | Line + signal + histogram bars |
| stochastic | K% + D% lines + 20/80 zones |
| adx | DI+, DI-, ADX lines + 25 threshold |
| cci | Line + horizontal +100/-100 zones |
| williams_r | Line + -20/-80 zones |
| obv | Line (cumulative) |
| mfi | Line + 20/80 zones |
| volume | Bar chart (green/red by price direction) |
| atr | Line (volatility) |
| 指标 | 图表类型 |
|---|---|
| rsi | 折线 + 30/70水平区间 |
| macd | 折线 + 信号线 + 柱状图 |
| stochastic | K% + D%线 + 20/80区间 |
| adx | DI+、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
数据周期
| Interval | Default Lookback |
|---|---|
| D | 1 year (365 days) |
| 1h | 6 months (180 days) |
| 15m, 30m | 3 months (90 days) |
| 5m | 1 month (30 days) |
| 1m | 7 days |
| 时间周期 | 默认回溯周期 |
|---|---|
| D | 1年(365天) |
| 1h | 6个月(180天) |
| 15m, 30m | 3个月(90天) |
| 5m | 1个月(30天) |
| 1m | 7天 |
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