mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 14:34:18 +08:00
feat(strategies): add zhuoyao_momentum strategy + Maotai demo screenshot
- New ZHUOYAO multi-timeframe momentum strategy (strategies/zhuoyao_momentum.py) - Entry: SHORT>0 + TREND>0 + SHORT>MID (triple resonance) - Exit: SHORT<0 or TREND<0 (conservative, any triggers sell) - Add SH600519 Maotai demo screenshot (strategies/demo/4.png) - Update README with 4th demo screenshot Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b57d8f4669
commit
8fcedeb47a
@@ -367,6 +367,11 @@ python -X utf8 run_all_strategies.py SH 600519 --count 2000 --cash 1000000 --adj
|
|||||||
<sub>SH601179 中国西电 — expma_cross 策略 | 收益 168.0%</sub>
|
<sub>SH601179 中国西电 — expma_cross 策略 | 收益 168.0%</sub>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="strategies/demo/4.png" width="700"><br>
|
||||||
|
<sub>SH600519 贵州茅台 — bollinger_breakout 策略 | 收益 187.0%</sub>
|
||||||
|
</p>
|
||||||
|
|
||||||
> **⚠️ Demo 展示,不作为操作依据。** 历史回测收益不代表未来表现,策略参数未经过样本外验证。
|
> **⚠️ Demo 展示,不作为操作依据。** 历史回测收益不代表未来表现,策略参数未经过样本外验证。
|
||||||
|
|
||||||
#### 自带策略示例
|
#### 自带策略示例
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 185 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
"""捉妖大师多周期共振策略。
|
||||||
|
|
||||||
|
基于 ZHUOYAO 指标(20/60/120 日涨幅及指数平滑),通过短中长线趋势共振判断买卖时机。
|
||||||
|
|
||||||
|
入场条件(三条件全部满足):
|
||||||
|
1. SHORT > 0 — 20 日涨幅为正,短线处于强势
|
||||||
|
2. TREND > 0 — 60 日涨幅的 EMA 为正,中期趋势向上
|
||||||
|
3. SHORT > MID — 短线强于中线,处于加速阶段(非衰竭)
|
||||||
|
|
||||||
|
出场条件(任一触发即卖出):
|
||||||
|
1. SHORT < 0 — 短线转弱
|
||||||
|
2. TREND < 0 — 中期趋势转向
|
||||||
|
|
||||||
|
适合单边趋势行情,震荡市信号较少(这是过滤噪音的设计)。
|
||||||
|
|
||||||
|
用法::
|
||||||
|
|
||||||
|
easy-tdx backtest SZ 000001 --strategy-file strategies/zhuoyao_momentum.py --count 2000 --table
|
||||||
|
"""
|
||||||
|
|
||||||
|
from easy_tdx import MyTT
|
||||||
|
from easy_tdx.backtest import Strategy
|
||||||
|
|
||||||
|
|
||||||
|
class ZhuoyaoStrategy(Strategy):
|
||||||
|
"""捉妖大师多周期共振策略。"""
|
||||||
|
|
||||||
|
def init(self) -> None:
|
||||||
|
# ZHUOYAO 返回 4 个数组: LONG, MID, SHORT, TREND
|
||||||
|
self.long, self.mid, self.short, self.trend = self.I(
|
||||||
|
MyTT.ZHUOYAO, self.data.close,
|
||||||
|
)
|
||||||
|
|
||||||
|
def next(self) -> None:
|
||||||
|
short = float(self.short[self._bar_index])
|
||||||
|
mid = float(self.mid[self._bar_index])
|
||||||
|
trend = float(self.trend[self._bar_index])
|
||||||
|
|
||||||
|
# 入场:短线强势 + 中期趋势向上 + 短线加速(短>中)
|
||||||
|
if short > 0 and trend > 0 and short > mid:
|
||||||
|
if self.position["size"] == 0:
|
||||||
|
self.buy(size=0)
|
||||||
|
|
||||||
|
# 出场:短线转弱 或 中期趋势转向(任一即卖,保守预警)
|
||||||
|
elif short < 0 or trend < 0:
|
||||||
|
if self.position["size"] > 0:
|
||||||
|
self.sell(size=0)
|
||||||
Reference in New Issue
Block a user