以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  策略编写求助区  (http://weistock.com/bbs/list.asp?boardid=11)
----  请老师帮忙。。。谢谢!  (http://weistock.com/bbs/dispbbs.asp?boardid=11&id=74321)

--  作者:pyd
--  发布时间:2015/1/13 16:53:51
--  

VARIABLE:n1=0,n2=0,n3=0,n4=0;
if d2 then n:=1;
if n=1 and d1 then begin
buy(holding=0,1,market);
n:=0;
end
if d3 then n2:=1;
if n2=1 and d4 then begin
buy(holding=0,1,market);
n2:=0;
end
if pd1 then sell(holding>0,0.5*holding,market);
if pd2 then sell(holding>0,0.5*holding,market);
if pd3 then sell(holding>0,holding,market);
if pd4 then sell(holding>0,holding,market);
if pd5 then sell(holding>0,holding,market);
if pd6 then sell(holding>0,holding,market);

if k2 then n3:=1;
if n3=1 and k1 then begin
buyshort(holding=0,1,market);
n3:=0;
end
if k3 then n4:=1;
if n4=1 and k4 then begin
buyshort(holding=0,1,market);
n4:=0;
end
if pk1 then sellshort(holding<0,0.5*holding,market);
if pk2 then sellshort(holding<0,0.5*holding,market);
if pk3 then sellshort(holding<0,holding,market);
if pk4 then sellshort(holding<0,holding,market);
if pk5 then sellshort(holding<0,holding,market);
if pk6 then sellshort(holding<0,holding,market);