BIT LangLang v4 Strategy · BIT浪浪 v4 合约日内策略(开源版)
中文 · English
这是 BIT LangLang(BIT浪浪) 早期的 v4 加密货币合约日内交易策略 的信号引擎:5 分钟 K 线上的 LightGBM 择时模型 + 日线多头环境过滤 + 冷却与每日上限。纯 Go 实现,无第三方依赖,包含一个与 LightGBM 预测结果一致的文本模型推理器。
v4 是已经退役的研究版本,不是 BIT LangLang 现在实盘运行的策略。现行策略的每一条信号与交易所真实成交都公开在 bitlanglang.com/performance。
中文
策略逻辑
- 5m 择时打分:每根 5 分钟 K 线收盘时计算 22 个特征,交给 LightGBM 二分类模型输出概率分数。
- 日线环境过滤:只在最近一根已收盘日线处于多头环境时开仓——收盘价在 20 日均线之上,且 20 日均线高于 20 天前。
- 选点规则(
v4signal.Selector,与回测口径一致):
- 分数 ≥ 阈值才产生决策;
- 同一根 K 线上多个币按分数从高到低、同分按币名排序;
- 同币冷却期内不重复开仓;
- 全市场按本地自然日(UTC+8)限制每日开仓数,被上限挡住的信号同样刷新冷却。
特征(v4signal.Series)
| 特征 |
含义 |
m_r1 m_r3 m_r6 m_r12 m_r48 m_r288 |
对数收益率,回看 1/3/6/12/48/288 根 |
m_dh12/48/288/2016 |
收盘价相对 N 根最高价的回撤 |
m_pos12/48/288/2016 |
收盘价在 N 根高低区间中的位置 |
m_vq1 m_vq3 |
当根 / 3 根平均成交额相对 288 根均值 |
m_madev m_maslope |
相对 20 根均线偏离、均线斜率 |
m_atr m_rng |
14 根 ATR、当根振幅(占收盘价比例) |
m_upfrac12 |
最近 12 根上涨根数占比 |
m_ema50dev |
相对 EMA50 偏离 |
预热需要 2016 根 5m K 线(约 7 天),打分时建议再多给 500 根让 EMA 收敛(v4signal.HistoryBars)。
v4 冻结时的参数
{
"entryBar": "5m",
"filterBar": "1D",
"cooldownMin": 60,
"dailyLimit": 3,
"utcOffsetHours": 8,
"stopPct": 0.01,
"addAtR": 2.0,
"addSize": 0.5,
"targetR": 10.0,
"horizonMin": 10080
}
即:每天最多 3 单,同币冷却 60 分钟;1% 止损,浮盈 2R 时加半仓,目标 10R,最长持有 7 天。
使用
本仓库不附带训练好的模型。用上表 22 个特征(顺序须与 meta.json 的 features 一致)训练一个 LightGBM binary 模型并保存为文本格式,然后在模型目录放一个 meta.json:
{
"modelFile": "model.txt",
"modelSha256": "<sha256sum model.txt 的结果>",
"features": ["m_r1", "m_r3", "..."],
"threshold": 0.09,
"entryBar": "5m", "filterBar": "1D",
"cooldownMin": 60, "dailyLimit": 3, "utcOffsetHours": 8,
"stopPct": 0.01, "addAtR": 2.0, "addSize": 0.5, "targetR": 10.0, "horizonMin": 10080
}
go test ./...
go run ./cmd/v4scan -model ./model -bars5m bars_5m.csv -bars1d bars_1d.csv > decisions.csv
K 线 CSV 列为 inst,ts,open,high,low,close,vol_quote(ts 为开盘时间毫秒,可混合多个币种)。输出每个达到阈值的信号及其决策:accepted、daily_not_bull、cooldown、daily_limit。
不想自己维护?
BIT LangLang(BIT浪浪) 把现行策略做成了自动执行平台:在你自己的 OKX / 币安账户里自动开仓、带止损、平仓,资金不离开你的交易所账户,每笔信号和实盘成交公开可查。
English
This is the signal engine of v4, an early crypto perpetual-futures intraday strategy from BIT LangLang: a LightGBM timing model on 5-minute candles, a daily bullish-regime filter, plus per-coin cooldown and a daily cap. Pure Go with no third-party dependencies, including a LightGBM text-model predictor that matches LightGBM's own output.
v4 is a retired research version, not the strategy BIT LangLang runs live today. Every signal and real exchange fill of the current strategy is public at bitlanglang.com/performance.
How it works
- 5m scoring – at every 5-minute close, 22 features (see the table above) are fed to a LightGBM binary classifier.
- Daily regime filter – entries only when the latest closed daily candle is above its 20-day MA and the MA is higher than 20 days earlier.
- Selection (
v4signal.Selector, identical to the backtest) – score ≥ threshold; same-bar ties ranked by score then symbol; per-coin cooldown; market-wide daily cap by local day (UTC+8), where cap-rejected signals still refresh the cooldown.
Frozen v4 parameters: max 3 entries per day, 60-minute cooldown, 1% stop, add half size at +2R, 10R target, 7-day max holding.
Usage
No trained model is shipped. Train a LightGBM binary model on the 22 features (same order as features in meta.json), save it in text format, put a meta.json next to it (see the Chinese section for the schema), then:
go test ./...
go run ./cmd/v4scan -model ./model -bars5m bars_5m.csv -bars1d bars_1d.csv > decisions.csv
CSV columns: inst,ts,open,high,low,close,vol_quote (ts = open time in ms; multiple symbols allowed).
Want it hands-free?
BIT LangLang runs the current strategy for you on your own OKX / Binance account: automatic entries with a stop-loss and exits, funds never leave your exchange account, and every signal and live fill is publicly verifiable.
Disclaimer · 免责声明
For research and education only; not investment advice. Crypto derivatives are high-risk and you can lose your entire margin. Past backtests do not guarantee future results.
仅供研究与学习,不构成投资建议。加密货币合约风险极高,可能损失全部保证金;历史回测不代表未来表现。
License
MIT © BIT LangLang