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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件金字塔软件问题提交 → [原创]轮询交易,信号反复,导致多次开平。我参考了个程序,看看能否行?

   

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


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

主题:[原创]轮询交易,信号反复,导致多次开平。我参考了个程序,看看能否行?

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


加好友 发短信
等级:新手上路 帖子:11 积分:0 威望:0 精华:0 注册:2014/1/3 14:11:03
[原创]轮询交易,信号反复,导致多次开平。我参考了个程序,看看能否行?  发帖心情 Post By:2014/1/4 20:45:46 [显示全部帖子]

WARNING_DISABLE:4;
ss:=1; //手数
extgbdataset('t1_position',0);
//0表示没有仓位,1表示持有多头, -1表示持有空头
extgbdataset('t1_holding',0);
//0表示没有仓位,>0表示持有多头, <0表示持有空头
extgbdataset('t1_enterbarpos',0);//记录其开仓的K线

maa:ema(c,10);
bpk:=cross(c,maa);
spk:=cross(maa ,c);
//非最后一根K线退出
if not(islastbar) or workmode<>1 then exit;

//如果当是最后一根k线,执行
IF islastbar and  time<151000 then begin

 // 如果最后一根k线发生过开仓信号,则那一根k线不再交易
 if extgbdata('t1_enterbarpos') = barpos then begin
  goto continueline ;
 end
 
//没有持仓状态
if extgbdata('t1_position')=0  and extgbdata('t1_holding')=0 then begin
     if  bpk then begin
      
        buy(1,ss,c);
        extgbdataset('t1_position',1);
        extgbdataset('t1_holding',ss);
        extgbdataset('t1_enterbarpos',barpos);
        goto continueline ;
      
      end

      if spk then begin
     
         buyshort(1,ss,c);
         extgbdataset('t1_position',-1);//程序化交易 www.cxh99.com
         extgbdataset('t1_holding',-ss);
         extgbdataset('t1_enterbarpos',barpos);
         goto continueline ;
       
      end
end//没有持仓状态
   
//持有仓位状态
   //持有空头
if bpk and extgbdata('t1_position')=-1   and  extgbdata('t1_holding')<0 then begin

       sellshort(1,ss,c);
       buy(1,ss,c);
       extgbdataset('t1_position',1);
       extgbdataset('t1_holding',ss);
       extgbdataset('t1_enterbarpos',barpos);
       goto continueline ;
     
end
    //持有多头
if spk and extgbdata('t1_position')=1    and  extgbdata('t1_holding')>0  then begin

        sell(1,ss,c);
        buyshort(1,ss,c);
        extgbdataset('t1_position',-1);
        extgbdataset('t1_holding',-ss);
        extgbdataset('t1_enterbarpos',barpos);
        goto continueline ;
      
end
END//if  ISLASTBAR

if  time>=151300 then begin

             sell(extgbdata('t1_holding')>0,ss,c);
             sellshort(extgbdata('t1_holding')<0,ss,c);
             extgbdataset('t1_position',0);
             extgbdataset('t1_holding',0);
                    
end

continueline@ 资产:tasset,linethick0;
position:=extgbdata('t1_position');
t1holding:=extgbdata('t1_holding');
debugfile('d:\debug\803555.txt','position=%.0f' ,position) ;
debugfile('d:\debug\803555.txt','t1holding=%.0f' ,t1holding) ;

 

 

以上代码能在金子塔里测试吗?我用了,不能出信号。


 回到顶部
帅哥哟,离线,有人找我吗?
wang550099
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:11 积分:0 威望:0 精华:0 注册:2014/1/3 14:11:03
  发帖心情 Post By:2014/1/6 8:14:58 [显示全部帖子]

这也算是回答吗?


 回到顶部