generating-trading-signals
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGenerating Trading Signals
生成交易信号
Overview
概述
Multi-indicator signal generation system that analyzes price action using 7 technical indicators and produces composite BUY/SELL signals with confidence scores and risk management levels.
Indicators Used:
- RSI (Relative Strength Index) - Overbought/oversold
- MACD (Moving Average Convergence Divergence) - Trend and momentum
- Bollinger Bands - Mean reversion and volatility
- Trend (SMA 20/50/200 crossovers) - Trend direction
- Volume - Confirmation of moves
- Stochastic Oscillator - Short-term momentum
- ADX (Average Directional Index) - Trend strength
多指标信号生成系统,通过7种技术指标分析价格走势,生成带有置信度评分和风险管理等级的复合买入/卖出信号。
使用的指标:
- RSI(相对强弱指数)- 超买/超卖
- MACD(移动平均收敛发散指标)- 趋势与动量
- 布林带 - 均值回归与波动率
- 趋势(SMA 20/50/200交叉)- 趋势方向
- 成交量 - 走势确认
- 随机震荡指标 - 短期动量
- ADX(平均方向指数)- 趋势强度
Prerequisites
前提条件
Install required dependencies:
bash
pip install yfinance pandas numpyOptional for visualization:
bash
pip install matplotlib安装所需依赖:
bash
pip install yfinance pandas numpy可视化可选依赖:
bash
pip install matplotlibInstructions
操作步骤
Step 1: Quick Signal Scan
步骤1:快速信号扫描
Scan multiple assets for trading opportunities:
bash
python {baseDir}/scripts/scanner.py --watchlist crypto_top10 --period 6mOutput shows signal type (STRONG_BUY/BUY/NEUTRAL/SELL/STRONG_SELL) and confidence for each asset.
扫描多类资产寻找交易机会:
bash
python {baseDir}/scripts/scanner.py --watchlist crypto_top10 --period 6m输出结果会显示每类资产的信号类型(STRONG_BUY/买入/中性/卖出/STRONG_SELL)和置信度。
Step 2: Detailed Signal Analysis
步骤2:详细信号分析
Get full indicator breakdown for a specific symbol:
bash
python {baseDir}/scripts/scanner.py --symbols BTC-USD --detailShows each indicator's contribution:
- Individual signal (BUY/SELL/NEUTRAL)
- Indicator value
- Reasoning (e.g., "RSI oversold at 28.5")
获取特定标的的完整指标细分结果:
bash
python {baseDir}/scripts/scanner.py --symbols BTC-USD --detail展示每个指标的贡献:
- 单个信号(买入/卖出/中性)
- 指标数值
- 推理依据(例如:“RSI超卖,数值为28.5”)
Step 3: Filter and Rank Signals
步骤3:过滤与排序信号
Find the best opportunities:
bash
undefined筛选最佳交易机会:
bash
undefinedOnly buy signals with 70%+ confidence
仅显示置信度70%以上的买入信号
python {baseDir}/scripts/scanner.py --filter buy --min-confidence 70 --rank confidence
python {baseDir}/scripts/scanner.py --filter buy --min-confidence 70 --rank confidence
Rank by most bullish
按看涨程度排序
python {baseDir}/scripts/scanner.py --rank bullish
python {baseDir}/scripts/scanner.py --rank bullish
Save results to JSON
将结果保存为JSON
python {baseDir}/scripts/scanner.py --output signals.json
undefinedpython {baseDir}/scripts/scanner.py --output signals.json
undefinedStep 4: Use Custom Watchlists
步骤4:使用自定义观察列表
Available predefined watchlists:
bash
python {baseDir}/scripts/scanner.py --list-watchlists
python {baseDir}/scripts/scanner.py --watchlist crypto_defiWatchlists: , , , ,
crypto_top10crypto_deficrypto_layer2stocks_techetfs_major可用的预定义观察列表:
bash
python {baseDir}/scripts/scanner.py --list-watchlists
python {baseDir}/scripts/scanner.py --watchlist crypto_defi观察列表包括:、、、、
crypto_top10crypto_deficrypto_layer2stocks_techetfs_majorOutput
输出结果
Signal Summary Table
信号汇总表
================================================================================
SIGNAL SCANNER RESULTS
================================================================================
Symbol Signal Confidence Price Stop Loss
--------------------------------------------------------------------------------
BTC-USD STRONG_BUY 78.5% $67,234.00 $64,890.00
ETH-USD BUY 62.3% $3,456.00 $3,312.00
SOL-USD NEUTRAL 45.0% $142.50 N/A
--------------------------------------------------------------------------------
Summary: 2 Buy | 1 Neutral | 0 Sell
Scanned: 3 assets | [timestamp]
================================================================================================================================================================
SIGNAL SCANNER RESULTS
================================================================================
Symbol Signal Confidence Price Stop Loss
--------------------------------------------------------------------------------
BTC-USD STRONG_BUY 78.5% $67,234.00 $64,890.00
ETH-USD BUY 62.3% $3,456.00 $3,312.00
SOL-USD NEUTRAL 45.0% $142.50 N/A
--------------------------------------------------------------------------------
Summary: 2 Buy | 1 Neutral | 0 Sell
Scanned: 3 assets | [timestamp]
================================================================================Detailed Signal Output
详细信号输出
======================================================================
BTC-USD - STRONG_BUY
Confidence: 78.5% | Price: $67,234.00
======================================================================
Risk Management:
Stop Loss: $64,890.00
Take Profit: $71,922.00
Risk/Reward: 1:2.0
Signal Components:
----------------------------------------------------------------------
RSI | STRONG_BUY | Oversold at 28.5 (< 30)
MACD | BUY | MACD above signal, positive momentum
Bollinger Bands | BUY | Price near lower band (%B = 0.15)
Trend | BUY | Uptrend: price above key MAs
Volume | STRONG_BUY | High volume (2.3x) on up move
Stochastic | STRONG_BUY | Oversold (%K=18.2, %D=21.5)
ADX | BUY | Strong uptrend (ADX=32.1)
----------------------------------------------------------------------======================================================================
BTC-USD - STRONG_BUY
Confidence: 78.5% | Price: $67,234.00
======================================================================
风险管理:
止损价: $64,890.00
止盈价: $71,922.00
风险收益比: 1:2.0
信号构成:
----------------------------------------------------------------------
RSI | STRONG_BUY | 超卖,数值28.5(<30)
MACD | BUY | MACD线在信号线之上,动量为正
布林带 | BUY | 价格接近下轨(%B = 0.15)
趋势 | BUY | 上涨趋势:价格高于关键移动平均线
成交量 | STRONG_BUY | 上涨伴随高成交量(2.3倍均值)
随机震荡指标 | STRONG_BUY | 超卖(%K=18.2,%D=21.5)
ADX | BUY | 上涨趋势强劲(ADX=32.1)
----------------------------------------------------------------------Signal Types
信号类型
| Signal | Score | Meaning |
|---|---|---|
| STRONG_BUY | +2 | Multiple strong buy signals aligned |
| BUY | +1 | Moderate buy signals |
| NEUTRAL | 0 | No clear direction |
| SELL | -1 | Moderate sell signals |
| STRONG_SELL | -2 | Multiple strong sell signals aligned |
| 信号类型 | 评分 | 含义 |
|---|---|---|
| STRONG_BUY | +2 | 多个强烈买入信号一致 |
| BUY | +1 | 中等买入信号 |
| NEUTRAL | 0 | 无明确方向 |
| SELL | -1 | 中等卖出信号 |
| STRONG_SELL | -2 | 多个强烈卖出信号一致 |
Confidence Interpretation
置信度解读
| Confidence | Interpretation |
|---|---|
| 70-100% | High conviction, strong signal |
| 50-70% | Moderate conviction |
| 30-50% | Weak signal, mixed indicators |
| 0-30% | No clear direction, avoid trading |
| 置信度 | 解读 |
|---|---|
| 70-100% | 高确信度,信号强劲 |
| 50-70% | 中等确信度 |
| 30-50% | 信号较弱,指标表现混杂 |
| 0-30% | 无明确方向,避免交易 |
Configuration
配置
Edit :
{baseDir}/config/settings.yamlyaml
indicators:
rsi:
period: 14
overbought: 70
oversold: 30
signals:
weights:
rsi: 1.0
macd: 1.0
bollinger: 1.0
trend: 1.0
volume: 0.5编辑 :
{baseDir}/config/settings.yamlyaml
indicators:
rsi:
period: 14
overbought: 70
oversold: 30
signals:
weights:
rsi: 1.0
macd: 1.0
bollinger: 1.0
trend: 1.0
volume: 0.5Error Handling
错误处理
See for common issues:
{baseDir}/references/errors.md- API rate limits
- Insufficient data handling
- Network errors
常见问题请参考 :
{baseDir}/references/errors.md- API速率限制
- 数据不足处理
- 网络错误
Examples
示例
See for detailed examples:
{baseDir}/references/examples.md- Multi-timeframe analysis
- Custom indicator parameters
- Combining with backtester
- Automated scanning schedules
详细示例请参考 :
{baseDir}/references/examples.md- 多时间框架分析
- 自定义指标参数
- 与回测工具结合
- 自动扫描计划
Integration with Backtester
与回测工具集成
Test signals historically:
bash
undefined历史回测信号:
bash
undefinedGenerate signal
生成信号
python {baseDir}/scripts/scanner.py --symbols BTC-USD --detail
python {baseDir}/scripts/scanner.py --symbols BTC-USD --detail
Backtest the strategy that generated the signal
回测生成该信号的策略
python {baseDir}/../trading-strategy-backtester/skills/backtesting-trading-strategies/scripts/backtest.py
--strategy rsi_reversal --symbol BTC-USD --period 1y
--strategy rsi_reversal --symbol BTC-USD --period 1y
undefinedpython {baseDir}/../trading-strategy-backtester/skills/backtesting-trading-strategies/scripts/backtest.py
--strategy rsi_reversal --symbol BTC-USD --period 1y
--strategy rsi_reversal --symbol BTC-USD --period 1y
undefinedFiles
文件说明
| File | Purpose |
|---|---|
| Main signal scanner |
| Signal generation logic |
| Technical indicator calculations |
| Configuration |
| 文件 | 用途 |
|---|---|
| 主信号扫描程序 |
| 信号生成逻辑 |
| 技术指标计算 |
| 配置文件 |
Resources
资源
- yfinance for price data
- pandas/numpy for calculations
- Compatible with trading-strategy-backtester plugin
- yfinance用于获取价格数据
- pandas/numpy用于计算
- 兼容trading-strategy-backtester插件