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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 怎么编写5日下穿了30日后当周期的bar后面的4跟bar的收盘价都在ma30之下呢?

   

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


  共有4482人关注过本帖平板打印复制链接

主题:怎么编写5日下穿了30日后当周期的bar后面的4跟bar的收盘价都在ma30之下呢?

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


加好友 发短信
等级:新手上路 帖子:34 积分:0 威望:0 精华:0 注册:2014/12/7 22:54:26
  发帖心情 Post By:2015/1/21 14:53:50    Post IP:61.164.203.182[只看该作者]

RUNMODE:0;
input: barcout1(1),barcout2(2),barcout3(3);
input:SHORTPRIED(3,0,60,5);
VARIABLE:myholding:=0,recentlyc:=0,i=0,times=0;
第一根bar:=BARSLAST(times) = barcout1,NOAXIS;
第二根bar:=BARSLAST(times) = barcout2,NOAXIS;
第三根bar:=BARSLAST(times) = barcout2,NOAXIS;
开多条件1:=cross(雷,资);
开多条件2:=cross(投,资);
开多条件2.1:=投>资 and 雷>投;
开多条件2.2:=雷>=REF(雷,SHORTPRIED);
开多条件3:=cross(雷,投);
平多条件:=雷<=REF(雷,SHORTPRIED);

开空条件1:=cross(资,雷);
开空条件2:=cross(资,投);
开空条件2.1:=投<资 and 雷<投;
开空条件2.2:=雷<=REF(雷,SHORTPRIED);
开空条件3:=cross(投,雷);
平空条件:=雷>=REF(雷,SHORTPRIED);


if holding=0 then BEGIN
    if  投<资 and 开多条件1 THEN   begin 
        times=1;
        
    //过滤条件
     if 第一根bar then recentlyc=close;
        if recentlyc>资 then  i=1;
     if i=1 and 第二根bar then recentlyc=close;
        if recentlyc>资 then  i=2;
     if i=2 and 第三根bar then recentlyc=close;
        if recentlyc>资 then  i=3;
         if i=3 then begin   
           开多:BUY(1,10%,limitr,CLOSE);
      end
    end
      if 开多条件2.1 and 开多条件2.2 then begin
      开多3:buy(1,intpart(myholding/2),limitr,CLOSE);
   end
end

if holding>0 then begin
     myholding:=0;
   if 开多条件2 then begin
      开多2:buy(1,10%,limitr,CLOSE);      
   end
   myholding:=holding;
end
//多头平仓
if holding>0 then begin
   if 平多条件 then begin
    平多:sell(1,holding,limitr,CLOSE);
    end
end
//建立空头模块
if holding=0 then BEGIN
    if  投>资 and 开空条件1 THEN begin  //当条件成立后记录times=1
       times=1;
        
    //过滤条件
     if 第一根bar then recentlyc=close; //上次条件成立后到现在的天数等于1,也就是昨天若是条件成立,对今天的bar进行条件判断  ,并今天收盘价赋值给recentlyc
        if recentlyc<资 then  i=1;  //比较今天收盘价和参考线的大小,若是成立则标记i=1;
     if i=1 and 第二根bar then recentlyc=close;  //若是times=1条件成立后到现在的天数等于2,对今天的bar进行条件判断  ,并今天收盘价赋值给recentlyc
        if recentlyc<资 then  i=2;
     if i=2 and 第三根bar then recentlyc=close;
        if recentlyc<资 then  i=3;     //一次类推判断条件成立后三天的收盘的,只要是任意一天不成立则不进行开仓动作
         if i=3 then begin  
      开空:BUYshort(1,10%,limitr,CLOSE);
      end
      end
      if 开空条件2.1 and 开空条件2.2 then begin
      开空3:buyshort(1,intpart(myholding/2),limitr,CLOSE);
   end
end

if holding<0 then begin
     myholding:=0;
   if 开空条件2 then begin
      开空2:buyshort(1,10%,limitr,CLOSE);      
   end
   myholding:=holding;
end
//空头平仓
if holding<0 then begin
   if 平空条件 then begin
    平空:sellshort(1,holding,limitr,CLOSE);
    end
end


持仓:holding,noaxis,LINETHICK0;
资金:ASSET,noaxis,LINETHICK2,COLORCYAN;
收益:asset/1000000,NOAXIS,LINETHICK0;

老师您好,我中间添加了一段过滤条件的代码后发现坐标收到了影响,请教下需要在哪里添加noaxis。
老师中间那段代码哪里逻辑出错了吗?加载的时候没有显示应有的效果。麻烦老师了
老师我从新编辑下  


 回到顶部
总数 27 1 2 3 下一页