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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 程序中交易笔数如何表达

   

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


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

主题:程序中交易笔数如何表达

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


加好友 发短信
等级:新手上路 帖子:8 积分:0 威望:0 精华:0 注册:2017/5/11 12:56:07
程序中交易笔数如何表达  发帖心情 Post By:2017/5/23 10:40:50    Post IP:58.213.51.38[只看该作者]

请问,我在程序中以“i:=0;i=i+1;"表示期货的交易笔数,为什么金之塔程序输出中的i值是300,而实际交易笔数是12000笔?怎样设置?


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


加好友 发短信
等级:超级版主 帖子:21598 积分:0 威望:0 精华:1 注册:2010/7/31 16:35:30
  发帖心情 Post By:2017/5/23 11:06:26    Post IP:180.169.30.6[只看该作者]

你的完整程序是怎么写的,光看这个i工作人员也没理解。。。

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


加好友 发短信
等级:新手上路 帖子:8 积分:0 威望:0 精华:0 注册:2017/5/11 12:56:07
  发帖心情 Post By:2017/5/23 11:36:21    Post IP:58.213.51.38[只看该作者]

variable:a=0;
...............

variable:i=0;

.............
variable:b=0;

 

i:=i+1;  //dynainfo(52);
price:=close;

 

..........

..........

if  islastbar then
  begin
  aggdownretmean:=trimmean(aggdownretvec,downperiod,0);
  aggdownretsd:=sqrt(var(aggdownretvec,downperiod));  //无偏方差
  aggupretmean:=trimmean(aggupretvec,upperiod,0);
  aggupretsd:=sqrt(var(aggupretvec,upperiod));       //无偏方差
  i值:i,colorgray,linethick0;
   end


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


加好友 发短信
等级:新手上路 帖子:8 积分:0 威望:0 精华:0 注册:2017/5/11 12:56:07
  发帖心情 Post By:2017/5/23 11:40:44    Post IP:58.213.51.38[只看该作者]

由于保密原因,程序不便在此公开,但用到i的累加计算的地方只有这里,关键是程序中如何表达并使用交易笔数。


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


加好友 发短信
等级:管理员 帖子:26632 积分:0 威望:0 精华:7 注册:2015/4/9 14:59:07
  发帖心情 Post By:2017/5/23 12:15:44    Post IP:180.169.30.6[只看该作者]

你上述的代码对问题分析没有任何意义,请表达下你关于i变量处理的思路。

[此贴子已经被作者于2017/5/23 12:16:11编辑过]


编程无捷径,技巧靠积累。
 回到顶部
帅哥哟,离线,有人找我吗?
xm61
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:8 积分:0 威望:0 精华:0 注册:2017/5/11 12:56:07
  发帖心情 Post By:2017/5/23 14:01:26    Post IP:58.213.51.38[只看该作者]

以下是我的程序,程序在“分笔成交”环境下运行,i应该是交易笔数,但交易笔数小于300时运行正确,交易笔数超过300时不正确,主要是i停留在300不变,不知哪里出了问题。

variable:upperiod = 0;      

variable:downperiod = 0;    

variable:increasenum = 0;    
variable:decreasenum = 0;   
variable:aggincidx = 0; 
variable:aggdecidx = 0;
variable:aggincidx1 = 0; 
variable:aggdecidx1 = 0;
variable:uptrend=false;     
variable:downtrend =false;  
variable:price[]=0;         
variable:indexvec[]=0;      
variable:aggupretvec[]=0;    
variable:aggdownretvec[]=0; 

variable:aggupretmean = 0;  
variable:aggupretvar = 0;   
variable:aggdownretmean = 0;
variable:aggdownretvar = 0; 
variable:i=0;
variable:a=0;
variable:b=0;

i:=i+1;  //dynainfo(52);
price:=close;
if i>=2 then
begin
   indexvec:=price[i])/price[i-1];
      curidx:=indexvec;
     if uptrend=true then
       begin
        aggincidx1:=price[i]/price[a];  
         aggincidx:=max(aggincidx1,price[b]/price[a]);
         increasenum:=0;
       end   
      if downtrend=true then
       begin
        aggdecidx1:=price[i]/price[b];
         aggdecidx:=min(aggdecidx1,price[a]/price[b]);
         decreasenum:=0;
        end   
      
      if curidx>0 and uptrend=false  then
      begin
       increasenum:=increasenum + 1;
         if increasenum=1  then    
            a:=i-1;
         
        if increasenum=2 then
        begin   
           for j=a to i-1 do
           begin
             if (price[j+1]<price[j])and (price[i]<=price[a+1]) then
              begin
               t1:=false;
               increasenum:=1;
               a:=i-1;              
               break;
              end
           else          
             t1:=true;     
          end
          end
          if t1=true then  
            begin
             
            if downtrend=true then
              aggdownretvec:=aggdecidx*100000000;     
              uptrend:=true;
              aggincidx1:=price[i]/price[a];
              upperiod:=upperiod + 1;    
              increasenum:=0;
              decreasenum:=0;
              downtrend:=false;
              s1:=false;
             end  
            end 
     
    if curidx<0 and downtrend=false then
    begin
       decreasenum:=decreasenum+1;
        if decreasenum=1 then 
            b:=i-1;  
          
        if decreasenum=2 then
        begin   
         for j=b to i-1 do
         begin
           if (price[j+1]>price[j])and (price[i]>=price[b+1]) or(increasenum>=2) then
             begin
             s1:=false;
              decreasenum:=1;
               b:=i;           
             break;
             end
        else           
            s1:=true;
       end
     end
       
         if s1=true then//判断下跌       
          begin
            if uptrend=true then
            aggupretvec:=aggincidx*100000000;                   
            downtrend:= true;  
            aggdecidx1:=price[i]/price[b];
            downperiod:=downperiod+1;         // 下跌周期数 
            uptrend:=false;
            t1:=false;
            increasenum:=0; 
            decreasenum:=0;
          end
      end
  end 
 
 if islastbar and uptrend=true then
        aggupretvec:=aggincidx*100000000;
 
 if islastbar and downtrend=true then                                 
       aggdownretvec:=aggdecidx*100000000; 

 //计算相应的均值和方差
 if  islastbar then
  begin
  aggdownretmean:=trimmean(aggdownretvec,downperiod,0);
  aggdownretsd:=sqrt(var(aggdownretvec,downperiod));  //无偏方差
  aggupretmean:=trimmean(aggupretvec,upperiod,0);
  aggupretsd:=sqrt(var(aggupretvec,upperiod));       //无偏方差
  i值:i,colorgray,linethick0;
  下跌均值:aggdownretmean,colorwhite,linethick0;
  下跌标准差:aggdownretsd,colorwhite,linethick0;
  上涨均值:aggupretmean,colorwhite,linethick0;
  上涨标准差:aggupretsd,colorwhite,linethick0;
  上涨期数:upperiod,colorwhite,linethick0;
  下跌期数:downperiod,colorwhite,linethick0;
 end

 


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


加好友 发短信
等级:管理员 帖子:26632 积分:0 威望:0 精华:7 注册:2015/4/9 14:59:07
  发帖心情 Post By:2017/5/23 14:18:31    Post IP:180.169.30.6[只看该作者]

你是怎么得到只有300的,本地测试你上述的代码得到的结果就是k线数量,你的i其实就是barpos.

 


图片点击可在新窗口打开查看此主题相关图片如下:8.png
图片点击可在新窗口打开查看


编程无捷径,技巧靠积累。
 回到顶部