以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请教:价格回落平仓怎么写?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=30962)

--  作者:wubiao888
--  发布时间:2012/11/28 12:16:50
--  请教:价格回落平仓怎么写?

多头回落平仓:开多后超过20个周期以后,如果价格从最高点回落超过8%,则平多;

空头回落平仓:开空后超过20个周期以后,如果价格从最低点上升超过8%,则平空;

 

 


--  作者:jinzhe
--  发布时间:2012/11/28 13:15:16
--  

//开多超过20周期

 

cond1 :=  barslast(开多条件)>20;

cond2 := barslast(开空条件)>20;

价格最高点回落8%

 

//variable:hh=0;

 

if 开多条件 then begin

buy();

hh:=h;

end

 

if h>hh then hh:=h;

 

if (hh-c)/hh>0.08  and  cond1 then begin

sell();

end

//最低点回升8%

variable:ll=0;

if 开空条件 then begin

buyshort();;

ll:=l;

end

 

if l<ll then ll:=l;

 

if (c-l)/l>0.08 and cond2 then

sellshort();

end

 


--  作者:wubiao888
--  发布时间:2012/12/1 14:52:02
--  

已经解决,谢谢