以文本方式查看主题

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

--  作者:a77887
--  发布时间:2013/9/28 17:37:39
--  帮忙编写下 谢谢
固定止损:7个跳动点,
移动止盈:盈利20个跳动点后,如果盈利回撤20%就执行止盈,     

--  作者:jinzhe
--  发布时间:2013/9/29 10:10:20
--  

写了一个大概的框架,需要把对应的下单条件,下单平仓语句填写进去就行

 

下单条件:=;

variable:n=0;

 

if 下单条件  and holding=0 then begin

   下单语句;

   n:=h;

end

 

if h>n then n:=h;

 

if holding>0 and enterprice-c>7*mindiff then 平仓语句;

 

if n-enterprice>20*mindiff and (n-h)/n<=0.2 then 平仓语句;

[此贴子已经被作者于2013/9/29 10:10:50编辑过]

--  作者:a77887
--  发布时间:2013/10/1 10:55:23
--  
弄不懂。。
开多条件:A1 and holding=0 and time<144500 and time>91800;//开多条件
平空条件:A1 and holding<0 ;//平空条件
开空条件:=A2  and holding=0 and time<144500 and time>91800;//开空条件
平多条件:=A2 and holding>0 ;//平多条件


帮忙完整编下 谢谢


--  作者:jinzhe
--  发布时间:2013/10/8 8:56:59
--  
开多条件:A1 and holding=0 and time<144500 and time>91800;//开多条件
平空条件:A1 and holding<0 ;//平空条件
开空条件:=A2  and holding=0 and time<144500 and time>91800;//开空条件
平多条件:=A2 and holding>0 ;//平多条件

variable:n=0;

 

if 开多条件  and holding=0 then begin

   buy(1,1,market);

   n:=h;

end

 

if h>n then n:=h;

 

if holding>0 and enterprice-c>7*mindiff then sell(1,0,market);//固定止损多

 

if n-enterprice>20*mindiff and (n-enterprice)/enterprice<=0.2 then sell(1,0,market);//移动止盈多

 

if 平多条件 then sell(holding>0,0,market);

 

 

if 开空条件 and holding=0 then begin

   buyshort(1,1,market);

   n:=l;

end

 

if l<n then n:=l; 

 

if holding<0 and enterprice-c>7*mindiff then sell(1,0,market);//固定止损空

 

if enterprice-n>20*mindiff and (enterprice-n)/n<=0.2 then sell(1,0,market);//移动止盈空

 

if 平空条件 and holding<0 then sellshort(1,0,market);