TOP35量化策略是根据K线的动能原理设计的一套逻辑简单普适性较高的策略。我们设计了以下指标描述K线的动能原理。
指标源码(MC语:easy language)
inputs:dx(72);
variables:var0(0),var1(0),var2(0),var3(0),var4(0),var5(0),var6(0),var7(0),var8(0),oParCl(0),oParOp(0),oPostion(0),oTransition(0),mp(0),var11(0),v ar12(0);
varl=high-low;
应变量1=K线最高价-K线最低价var2=Average(varl,dx);
应变量2=应变量1的DX加权平均(计算DX个周期K线的平均波幅)
ifclose>openandhigh-close<close-lowthenbegin
var3=close-low;
end;
如果K线是阳线同时满足K线最高价-收盘价<收盘价-最低价
上涨动能应变量3=收盘价-最低价
ifclose<openandclose-low>high-closethenbegin
var3=close-low;
end;
如果K线是阴线同时满足K线收盘价-最低价>最高价-收盘价
上涨动能应变量3=收盘价-最低价
ifclose<openandclose-low<high-closethenbegin
var3=high-close;
end;
如果K线是阴线同时满足K线收盘价-最低价<最高价-收盘价
下跌动能应变量3=最高价-收盘价
ifclose>openandhigh-close>close-lowthenbegin
var3=high-close;
end;
如果K线是阳线同时满足K线最高价-收盘价>收盘价-最低价
下跌动能应变量3=最高价-收盘价
plot2(var3);
plot4(var2);
ifclose>openandhigh-close<close-lowthenSetPlotColor(2,red);ifclose<openandclose-low>high-closethenSetPlotColor(2,red);ifclose<openandclose-low<high-closethenSetPlotColor(2,green);ifclose>openandhigh-close>close-lowthenSetPlotColor(2,green);
上图指标中,白色横线为DX周期K线的平均波幅。我们认为当K线高于平均波幅时代表K线动能超过正常标准,因此将此定义为触发趋势行情的一种信号。可通过结合其他信号设计交易策略。
策略核心逻辑:
通过飞跃线判断开仓范围、K线动能指标发出信号结合价格突破重要高低点(即大阳线或大阴线突破重要支撑阻力)进场顺势开单,以自适应均线做离场。