金字塔MI交易系统策略
-
相关简介:金字塔公式 金字塔模型策略源码:runmode:0; input:n(20,5,100,5); a:=close-ref(close,n); mi:=sma(a,n,1); longcond:=cross(a,mi); shortcond:=cross(mi,a); if holding=0 then begin if longcond then buy(1,1,limitr,close); end if holding=0 then begin if shortcond then buysho
-
文章来源:公式网 发布时间:2015-10-25浏览次数:
金字塔公式 金字塔模型策略源码:runmode:0;
input:n(20,5,100,5);
a:=close-ref(close,n);
mi:=sma(a,n,1);
longcond:=cross(a,mi);
shortcond:=cross(mi,a);
if holding=0 then begin
if longcond then
buy(1,1,limitr,close);
end
if holding=0 then begin
if shortcond then
buyshort(1,1,limitr,close);
end
if holding>0 then begin
if shortcond then begin
sell(1,holding,limitr,close);
buyshort(1,1,limitr,close);
end
end
if holding<0 then begin
if longcond then begin
sellshort(1,holding,limitr,close);
buy(1,1,limitr,close);
end
end
盈亏:asset,noaxis,colormagenta;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;
复制上述代码粘贴到到公式管理器
源码解的:
输出RUNMODE:0
输出INPUT:N(20,5,100,5)
A赋值:收盘价-N日前的收盘价
MI赋值:A的N日[1日权重]移动平均
LONGCOND赋值:A上穿MI
SHORTCOND赋值:MI上穿A
逻辑判断 HOLDING=0 THEN BEGIN 逻辑判断 LONGCOND THEN BUY(1,1,LIMITR,收盘价)
ENDIF HOLDING=


现在就去充值积分
加入VIP可下载100以下的所有资源