打印本文打印本文 关闭窗口关闭窗口

请问最后一行代码有无出错?

作者:金字塔 来源:cxh99.com 发布时间:2017年04月18日
  • 咨询内容:

    请问最后一行代码有无出错?


    variable:bj=0;

    tr1 : max(max((high-low),abs(ref(close,1)-high)),abs(ref(close,1)-low));

    atr : ma(tr1,20);                               //atr公式


    ma20:ma(close,20);                               //20日均线


    a1:=0.01*valuewhen(barpos=1,asset);              //初始资金的1%


    a2:=floor(a1/(2*atr));                         //开仓手数


    a3:=ref(hhv(high,20),1);                       //20日高点


    if holding=0 and close>a3 and close>ma20 and bj=0

    then begin

    buy(1,a2,marketr);

    bj:=1;

    end                                   //第一次开仓


    if holidng=0 and close>enterprice+2*atr and bj=1 

    then begin

    buy(1,a2,marketr);

    end                                 //请问这里还是if holidng=0吗?还是应该是if holidng>0 ?



     

  • 金字塔客服:

    加仓的话要大于0,

    等于0是在空仓的情况下用,

     

  • 用户回复: 好的
打印本文打印本文 关闭窗口关闭窗口