Binance Signal Engine
Multi-timeframe technical analysis signal generator for cryptocurrency markets. Layers three timeframes into a single weighted score and outputs a structured trade plan with position sizing.
When to Use
Use this skill when the user wants to:
- - Analyze any Binance-listed crypto pair technically
- Get a directional bias or trading signal (bullish/bearish/neutral)
- Generate entry, stop-loss, and take-profit levels for a trade
- Check trend regime (1D), momentum (4H), and entry timing (15m)
- Size a position based on account risk parameters
- Scan multiple symbols in one pass
- Get a backtest-ready data row for a symbol
How It Works
The engine scores three independent timeframe layers and combines them:
1D — Trend Regime
EMA structure (9/21/50), ADX with directional indicators (DI+/DI−). Determines whether the macro environment is bullish, bearish, or neutral. This is the directional anchor — momentum and trigger signals are interpreted relative to this regime.
4H — Momentum
MACD line vs signal crossovers, histogram direction, and Stochastic Oscillator crosses. Stochastic signals are weighted asymmetrically depending on the regime (e.g. a bullish stoch cross from oversold in a bullish regime scores higher than in a bearish one).
15m — Entry Trigger
RSI oversold/overbought reclaims, Bollinger Band re-entries, volume spikes relative to the 20-period moving average, and RSI divergence detection over a 20-bar lookback. This layer determines whether right now is a valid entry moment.
Each component contributes a configurable weighted score. The composite maps to a five-tier bias scale: STRONG BULLISH → BULLISH → NEUTRAL → BEARISH → STRONG BEARISH, with corresponding action recommendations (BUY, WATCH LONG, WAIT, WATCH SHORT, SELL/SHORT).
When conditions align, the trade planner generates a full plan using rolling support/resistance levels, ATR-based stops, and configurable risk-reward targets. The position sizer respects account balance, risk percentage, exchange lot size rules, and minimum notional constraints.
Usage
CODEBLOCK0
CLI Flags
| Flag | Short | Default | Description |
|---|
| INLINECODE0 | | (required) | One or more trading pairs, e.g. INLINECODE1 |
| INLINECODE2 |
-m |
spot | Market type:
spot or
futures |
|
--exchange |
-e |
binance | Exchange ID (ccxt-compatible) |
|
--balance |
-b |
10000 | Account balance in USD |
|
--risk |
-r |
1.0 | Risk per trade as a percentage |
|
--leverage |
-l |
1.0 | Leverage multiplier (futures only) |
|
--config |
-c |
None | Path to a JSON config file for full parameter override |
|
--output |
-o |
summary | Output format:
summary (human) or
json (machine) |
|
--debug | |
off | Enable debug-level logging |
Output Structure
The JSON output contains four sections:
signal — composite score, per-layer breakdown (trend/momentum/trigger), bias, regime, action recommendation, and an array of human-readable reasoning strings explaining every scoring decision.
trade_plan — side (long/short), entry type (market/limit), entry price, stop-loss, take-profit, support, resistance, effective risk-reward ratio, tradeable flag, and plan status (ready/waiting/reject/invalid).
position_size — units, notional value, risk budget, actual dollar risk, potential dollar reward, position as a percentage of account, and whether the position was capped by the notional limit.
backtest_row — flat key-value record with timestamp, symbol, 15m close, total score, bias, plan side, tradeable flag, effective RR, and sized units. Suitable for appending to a CSV or DataFrame for historical analysis.
Configuration
All parameters are configurable via a JSON file passed with --config. Key areas include:
- - EMA periods (fast: 9, slow: 21, trend: 50)
- MACD parameters (12/26/9)
- ADX period and trend threshold (14, 25.0)
- RSI period and oversold/overbought levels (14, 35/65)
- Stochastic window, smoothing, and levels (14, 3, 20/80)
- Bollinger Band window and standard deviation (20, 2.0)
- ATR period and stop-loss multiplier (14, 1.5)
- Volume MA period and spike threshold (20, 1.5x)
- Support/resistance lookback and buffer multipliers
- Per-layer scoring weights (15 weights total)
- Score thresholds for weak/strong signals (10/30)
- Risk-reward ratio, minimum acceptable RR, slippage buffer
- Account balance, risk percentage, max notional, leverage
Defaults are tuned for swing/intraday crypto trading on Binance.
Dependencies
Requires Python 3.8+ with the following packages:
CODEBLOCK1
No API key is required. The skill uses only Binance's public OHLCV endpoints.
Limitations
- - Signals are analytical tools, not financial advice. Always apply your own judgment and risk management.
- Public API rate limits apply (~1200 weight/min on Binance). The skill includes built-in delays between requests.
- The most recent (still-open) candle is automatically dropped to prevent lookahead bias.
- Short signals and position sizing for shorts are only available in
futures mode. - Backtest rows are point-in-time snapshots — this is not a full backtesting engine.
External Endpoints
| Endpoint | Data Sent | Purpose |
|---|
| INLINECODE31 (via ccxt) | Symbol name, timeframe, candle limit | Fetch public OHLCV price data |
No authenticated endpoints are called. No orders are placed. No private data leaves your machine.
Security & Privacy
- - No API keys needed — only public market data endpoints are used
- No data exfiltration — all indicator computation and scoring runs locally in Python
- No writes to exchange — strictly read-only; no orders, no account access
- No local file writes — output goes to stdout only unless you redirect it
- No background processes — runs once, prints results, exits
Model Invocation Note
This skill may be invoked automatically by the agent when your request matches the trigger phrases in the description. This is standard OpenClaw behavior. You can disable automatic invocation by setting disable-model-invocation: true in the frontmatter if you prefer explicit /binance-signal-engine invocation only.
Trust Statement
By installing this skill, you trust that: (1) the ccxt library will make HTTPS requests to Binance's public REST API to fetch candle data, and (2) all analysis runs locally on your machine. No credentials are required or sent. Only install if you are comfortable with public market data requests to api.binance.com.
币安信号引擎
面向加密货币市场的多时间框架技术分析信号生成器。将三个时间框架分层整合为单一加权评分,并输出包含头寸规模的完整交易计划。
使用场景
当用户需要以下功能时使用此技能:
- - 对任何币安上市加密货币对进行技术分析
- 获取方向性偏向或交易信号(看涨/看跌/中性)
- 生成交易的入场、止损和止盈水平
- 检查趋势状态(日线)、动量(4小时)和入场时机(15分钟)
- 基于账户风险参数计算头寸规模
- 一次性扫描多个交易对
- 获取某个交易对可用于回测的数据行
工作原理
引擎对三个独立的时间框架层进行评分并整合:
日线 — 趋势状态
EMA结构(9/21/50),ADX及方向性指标(DI+/DI-)。判断宏观环境为看涨、看跌或中性。这是方向性锚点——动量和触发信号将相对于此状态进行解读。
4小时 — 动量
MACD线与信号线交叉、柱状图方向以及随机震荡指标交叉。随机指标信号根据趋势状态进行非对称加权(例如,在看涨趋势中从超卖区域出现的看涨随机交叉,其评分高于在看跌趋势中的同类信号)。
15分钟 — 入场触发
RSI超买/超卖回归、布林带重新入场、相对于20周期均线的成交量突增,以及基于20根K线回溯的RSI背离检测。该层决定当前时刻是否为有效的入场时机。
每个组成部分贡献一个可配置的加权评分。综合评分映射到五级偏向量表:强烈看涨 → 看涨 → 中性 → 看跌 → 强烈看跌,并附带相应的操作建议(买入、关注做多、等待、关注做空、卖出/做空)。
当条件一致时,交易计划生成器将使用滚动支撑/阻力位、基于ATR的止损以及可配置的风险回报目标,生成完整的交易计划。头寸计算器会考虑账户余额、风险百分比、交易所最小交易量规则以及最低名义价值限制。
使用方法
bash
单个交易对 — 人类可读摘要
python3 {baseDir}/scripts/binance
signalengine.py BTC/USDT
多个交易对
python3 {baseDir}/scripts/binance
signalengine.py BTC/USDT ETH/USDT SOL/USDT
程序化使用的JSON输出
python3 {baseDir}/scripts/binance
signalengine.py BTC/USDT --output json
带自定义风险参数的合约模式
python3 {baseDir}/scripts/binance
signalengine.py BTC/USDT \
--market futures --leverage 3 --balance 5000 --risk 2
使用JSON配置文件覆盖所有指标/评分参数
python3 {baseDir}/scripts/binance
signalengine.py ETH/USDT --config my_config.json
调试模式,输出详细日志
python3 {baseDir}/scripts/binance
signalengine.py BTC/USDT --debug
命令行参数
| 参数 | 缩写 | 默认值 | 描述 |
|---|
| symbols | | (必填) | 一个或多个交易对,例如 BTC/USDT ETH/USDT |
| --market |
-m | spot | 市场类型:spot(现货)或 futures(合约) |
| --exchange | -e | binance | 交易所ID(兼容ccxt) |
| --balance | -b | 10000 | 账户余额(美元) |
| --risk | -r | 1.0 | 每笔交易风险百分比 |
| --leverage | -l | 1.0 | 杠杆倍数(仅合约模式) |
| --config | -c | None | JSON配置文件路径,用于完全覆盖参数 |
| --output | -o | summary | 输出格式:summary(人类可读)或 json(机器可读) |
| --debug | | off | 启用调试级别日志 |
输出结构
JSON输出包含四个部分:
signal — 综合评分、各层分解(趋势/动量/触发)、偏向、状态、操作建议,以及解释每个评分决策的人类可读推理字符串数组。
trade_plan — 方向(做多/做空)、入场类型(市价/限价)、入场价格、止损、止盈、支撑位、阻力位、有效风险回报比、可交易标志以及计划状态(就绪/等待/拒绝/无效)。
position_size — 数量、名义价值、风险预算、实际美元风险、潜在美元收益、头寸占账户百分比,以及头寸是否受名义价值限制。
backtest_row — 扁平键值记录,包含时间戳、交易对、15分钟收盘价、总分、偏向、计划方向、可交易标志、有效风险回报比以及计算后的数量。适用于追加到CSV或DataFrame进行历史分析。
配置
所有参数均可通过 --config 传递的JSON文件进行配置。关键领域包括:
- - EMA周期(快线:9,慢线:21,趋势线:50)
- MACD参数(12/26/9)
- ADX周期和趋势阈值(14,25.0)
- RSI周期和超买/超卖水平(14,35/65)
- 随机指标窗口、平滑度和水平(14,3,20/80)
- 布林带窗口和标准差(20,2.0)
- ATR周期和止损倍数(14,1.5)
- 成交量均线周期和突增阈值(20,1.5倍)
- 支撑/阻力回溯周期和缓冲倍数
- 各层评分权重(共15个权重)
- 弱/强信号评分阈值(10/30)
- 风险回报比、最低可接受风险回报比、滑点缓冲
- 账户余额、风险百分比、最大名义价值、杠杆
默认值针对币安上的波段/日内加密货币交易进行了调优。
依赖项
需要Python 3.8+及以下包:
bash
pip install ccxt pandas numpy ta
无需API密钥。该技能仅使用币安的公开OHLCV数据接口。
局限性
- - 信号是分析工具,而非金融建议。请始终运用自己的判断和风险管理。
- 受公开API速率限制影响(币安约每分钟1200权重)。技能内置了请求之间的延迟。
- 最新的(仍在进行中的)K线会自动丢弃,以防止未来数据偏差。
- 做空信号和做空头寸规模计算仅在 futures(合约)模式下可用。
- 回测数据行是时间点快照——这不是完整的回测引擎。
外部接口
| 接口 | 发送的数据 | 用途 |
|---|
| https://api.binance.com(通过ccxt) | 交易对名称、时间框架、K线数量 | 获取公开OHLCV价格数据 |
不调用任何需要认证的接口。不下达任何订单。无私人数据离开您的机器。
安全与隐私
- - 无需API密钥 — 仅使用公开市场数据接口
- 无数据泄露 — 所有指标计算和评分均在本地Python环境中运行
- 不对交易所进行写入操作 — 严格只读;无订单操作,无账户访问
- 不写入本地文件 — 输出仅发送到标准输出,除非您重定向
- 无后台进程 — 运行一次,打印结果,然后退出
模型调用说明
当您的请求与描述中的触发短语匹配时,代理可能会自动调用此技能。这是OpenClaw的标准行为。如果您希望仅通过显式 /binance-signal-engine 调用,可以在前置元数据中设置 disable-model-invocation: true。
信任声明
安装此技能即表示您信任:(1) ccxt 库将向币安的公开REST API发起HTTPS请求以获取K线数据,以及(2) 所有分析均在您的本地机器上运行。无需也不发送任何凭证。仅当您接受向 api.binance.com 发起公开市场数据请求时才进行安装。