欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 代码问题

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有3272人关注过本帖树形打印复制链接

主题:代码问题

帅哥哟,离线,有人找我吗?
qq代人发帖
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:18691 积分:0 威望:0 精华:0 注册:2013/7/15 9:22:16
代码问题  发帖心情 Post By:2014/6/17 9:34:56    Post IP:58.246.57.26[显示全部帖子]

请教:下面这段代码前面那两句平仓代码是什么意思,为什么一旦出现平仓后,后面即使条件成立当天也不会再有开仓了呢?

variable:a1=1;
tn:=1;//交易手数
cx:=1;//最大持仓量
xd:=3;//提前下单量(秒)
//交易时间区间
p1:=time>091500 and time<150000;
p2:=if(islastbar,dynainfo(207),time);
p3:=time0-timetot0(p2),linethick0;

r1:=barslast(date<>ref(date,1));
r2:=ref(o,r1);

hd:=if(islastbar,8,2.0);
hd1:=if(islastbar,3,0.2);

r10:=ref(asset,r1+1);
if r10-asset>3000 then a1:=-1;
if asset-r10>2000 then a1:=-1;
MA1:=MA(CLOSE,5);
MA2:=MA(CLOSE,25);

if a1<0 and p3<=xd then
begin
sell(1,tn,limitr,c-hd1);
sellshort(1,tn,limitr,c+hd1);
end

//*******************************
if cross(ma1,ma2) and a1>0 and p1 and p3<=xd then
begin
sellshort(holding<0,tn,limitr,c+hd1);
buy(holding=0,tn,limitr,c+hd1);
end

if cross(ma2,ma1) and a1>0 and p1 and p3<=xd then
begin
sell(holding>0,tn,limitr,c-hd1);
buyshort(holding=0,tn,limitr,c-hd1);
end
    
//**********收盘前清仓***********
if p2>=151000 then
begin
sellshort(holding<0,abs(holding),limitr,c+hd1);
sell(holding>0,holding,limitr,c-hd1);
a1:=1;
end


 回到顶部