以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://www.weistock.com/bbs/list.asp?boardid=4)
----  止盈的问题  (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=12094)

--  作者:acerap
--  发布时间:2012/6/1 21:59:01
--  止盈的问题

variable:hl=0,zs=0,zy=0;
cc:=CALLSTOCK(STKLABEL,VTCLOSE,6);
c5:=CALLSTOCK(STKLABEL,VTCLOSE,2);
jx5:=ma(cc,5);
jx20:=ma(cc,20);
jx5f5:=ma(c5,5);
jx5f20:=ma(c5,20);
sc:=cross(jx5f5,jx5f20);
xc:=cross(jx5f20,jx5f5);

             
if jx5>jx20 then
begin
sellshort(holding<0,0,thisclose);
buy(sc and  holding=0,10,thisclose);
hl:=h;
zs:=enterprice*0.9;
zy:=enterprice*1.1;

end

if jx20>jx5 then
begin
sell(holding>0,0,thisclose);
buyshort(xc and holding=0,10,thisclose);
hl:=l;
zs:=enterprice*1.1;
zy:=enterprice*0.9;

end

if low<=zs then
sell(holding>0,0,market);

if high>=zs then
sellshort(holding<0,0,market);

 

if hl>zy then
sell(holding>0,50%,market);

 

if hl<zy  then
sellshort(holding<0,50%,market);

 

最后2句设定盈利达到10%的时候,平仓一半,但是系统却因满足条件一直不停的平仓,直到没有仓位,哪位高手能帮忙解决此问题啊?


--  作者:阿火
--  发布时间:2012/6/2 21:07:10
--  

if holding>0 and hl>zy then begin sell(1,50%,market);hl:=drawnull;end

 

if holding<0 and hl<zy then begin sellshort(1,50%,market); hl:=drawnull;end


--  作者:acerap
--  发布时间:2012/6/2 22:36:48
--  K线走完模式转固定轮询模式的问题
谢谢火哥!!
--  作者:acerap
--  发布时间:2012/6/2 22:40:56
--  
不得,还是不停平仓