您现在的位置:程序化交易>> 期货公式>> 金字塔等>> 金字塔知识>>正文内容

请问一下,在序列模式下,标注MACD红绿柱面积的代码,错在哪? [金字塔]

  • 咨询内容: DIFF :=EMA(C,12) - EMA(C,26);
    DEA  :=EMA(DIFF,9);
    MACD :=2*(DIFF-DEA), COLORSTICK;
    MJ:=C;
    MJ[1]:=macd[1];
    if (ref(macd,1)<=0 and macd>0) or (ref(macd,1)>=0 and macd<0) then MJ:=MACD;
    else MJ[barpos]:=MJ[barpos-1]+macd[barpos];
    drawnumber((refx(macd,1)<=0 and macd>0) or (refx(macd,1)>=0 and macd<0),C,MJ[barpos],0,colormagenta);

     

  • 金字塔客服:

    数组用序列,就会最后一根值全部往前赋值成一个值。

     

    下列公式用逐k线模式

    DIFF :=EMA(C,12) - EMA(C,26);
    DEA  :=EMA(DIFF,9);
    MACD :=2*(DIFF-DEA), COLORSTICK;
    MJ:=C;
    MJ[1]:=macd[1];

    if (ref(macd,1)<=0 and macd>0) or (ref(macd,1)>=0 and macd<0) and barpos>1 then MJ:=MACD;
    if barpos>1 and ref(macd,1)>0 and macd<=0 or ref(macd,1)<0 and macd>=0 then  MJ[barpos]:=MJ[barpos-1]+macd[barpos];
    drawnumber((refx(macd,1)<=0 and macd>0) or (refx(macd,1)>=0 and macd<0),C,MJ[barpos],0,colormagenta);

     

  • 用户回复:

    是否说明这段代码没法改成序列模式?因为我的指标中,还有其他代码,只能采用序列模式。

     

  • 网友回复: 不能用序列,或者说序列很难改,和数组的赋值思路相反 [此贴子已经被作者于2013/7/23 9:08:01编辑过]

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 511411198  点击这里给我发消息进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容