以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请问应该如何理解四句话中的CC?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=149087)

--  作者:qq代人发帖
--  发布时间:2017/3/14 16:55:49
--  请问应该如何理解四句话中的CC?
请问应该如何理解四句话中的CC?

图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

--  作者:jinzhe
--  发布时间:2017/3/14 16:59:38
--  
就你这些代码而言,就是CC小于等于大于等于0,大于小于0的判断
--  作者:xunzhe
--  发布时间:2017/3/14 17:17:58
--  
holding>0后面为什么接着是cc<=0?
--  作者:jinzhe
--  发布时间:2017/3/14 17:22:27
--  
就你这点代码而言,看不出为什么
--  作者:xunzhe
--  发布时间:2017/3/14 17:24:43
--  
 

runmode:0;

variable:zs=0,cc=0,hl=0;

ma5:=ma(c,5);

ma20:=ma(c,20);

entertime:=time>100000 and time<144500;

if holding>0 and cc<=0 then sell(1,1,limitr,o);

if holding<0 and cc>=0 then sellshort(1,1,limitr,o);

if holding=0 and cc>0 then buy(1,1,limitr,o);

if holding=0 and cc<0 then buyshort(1,1,limitr,o);

if cc>0 and l<zs then begin

 sell(1,1,limitr,min(o,zs-0.6));

 cc:=0;

end

if cc<0 and h>zs then begin

 sellshort(1,1,limitr,max(o,zs+0.6));

 cc:=0;

end

if cc>0 and ma5<ma20 then cc:=0;

if cc<0 and ma5>ma20 then cc:=0;

if cc=0 and ma5>ma20 and entertime then begin

 cc:=1;

 zs:=c-10;

 hl:=h;

end

if cc=0 and ma5<ma20 and entertime then begin

 cc:=-1;

 zs:=c+10;

 hl:=l;

end

if cc>0 and h>hl then begin//创新高后,上移hl

 hl:=h;

 zs:=hl-10;

end

if cc<0 and l<hl then begin//创新低后,下移hl

 hl:=l;

 zs:=hl+10;

end

if time>=150000 then begin

 cc:=0;

end

 

如何更简单的理解全局变量的用法?


--  作者:jinzhe
--  发布时间:2017/3/14 17:26:18
--  
这段代码是干嘛的?你在哪里看到的?
--  作者:xunzhe
--  发布时间:2017/3/14 17:28:52
--  
移动止损的编写。
--  作者:jinzhe
--  发布时间:2017/3/14 17:34:07
--  

如果是你写的,麻烦注释下思路,如果不是,麻烦给出原来的连接,或者你贴出注释也行


--  作者:xunzhe
--  发布时间:2017/3/14 17:38:34
--  
http://www.weistock.com/bbs/dispbbs.asp?boardid=10&id=9439&star=1
--  作者:jinzhe
--  发布时间:2017/3/15 8:51:25
--  

这cc用来实现在固定轮训下用走完k线下单。cc是一个标记,标记好下根k线是该开多平多开空平空中的哪一个,配合上holding的判断,实现固定轮训下走完k线下单。比如这两段:

if holding=0 and cc>0 then buy(1,1,limitr,o);

 

if cc=0 and ma5>ma20 and entertime then begin

 cc:=1;

 zs:=c-10;

 hl:=h;

end

 

因为cc初值是0,所以先运行第二段代码,if后面是开多条件,所以开多条件满足后赋值CC为1,然后在下一根k线上,运行第一段代码开多,从而实现固定轮训下走完k线下单