以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  求出模型中连续亏损的最大次数  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=147812)

--  作者:srxiaobing
--  发布时间:2017/2/16 9:32:00
--  求出模型中连续亏损的最大次数
求出模型在连续亏损的状态下的最大次数 中途只要有1次盈利该统计就重新开始 只要是一直亏损的统计继续 
--  作者:jinzhe
--  发布时间:2017/2/16 9:37:44
--  

variable:n=0;

 

if 平多条件 and holding>0 then begin

    sell(1,0,marketr);

    if numprofit(1)>0 then n:=0;

    if numprofit(1)<0 then n:=n+1;

end

 

if 平空条件 and holding<0 then begin

    sellshort(1,0,marketr);

    if numprofit(1)>0 then n:=0;

    if numprofit(1)<0 then n:=n+1;

end

 

最大连亏次数:hhv(n,0);