--  
        
      1.跨周期引用指标线,三个周期开平信号合成一起模板,改成序列计算提示似乎使用逐k线,有问题吗? 
      2 引用其它模块开平仓信号,用stkindi(\'\',\'line.开仓条件\',0,3)引用没信号,只能引用指标线吗?(如下:zline:stkindi(\'\',\'line.line1\',0,3);)
此主题相关图片如下:qq截图20161121142504.png

 input:cang1(10,0,10,1),cang2(10,0,10,1),cang3(10,0,10,1);
variable:cc1=0,cc2=0,cc3=0;
zh1:\'614251\';
pz1:\'nioo\';
a:=ref(close,1);
line:=ma(a,30);
if not(islastbar) or workmode<>1 then begin
      exit;
      goto continueline@  ;
   end
if islastbar then begin
   if cc1>0 and c<line then begin
    //pc:=min(max(holding,0),cang1);
    pc:=min(tbuyholdingex( zh1,pz1 ,0 ),cang1);
    kc:=cang1-pc;
    //if pc>0 then sell(1,pc,limitr,open-mindiff);
    if pc>0 then tsell(1,pc,mkt,0,zh1,pz1);
    //if kc>0 then buyshort(1,kc,limitr,open+mindiff);
    if kc>0 then tbuyshort(1,kc,mkt,0,zh1,pz1);
    cc1:=0;
   end
  if cc1<0 and c>line  then begin
   // pc:=min(abs(min(holding,0)),cang1);
    pc:=min(abs(tsellholdingex( zh1,pz1 ,0 )),cang1);
    kc:=cang1-pc;
    //if pc>0 then sellshort(1,pc,limitr,open+mindiff);
    if pc>0 then tsellshort(1,pc,mkt,0,zh1,pz1);
   //if kc>0 then buy(1,kc,limitr,open+mindiff);
   if kc>0 then tbuy(1,kc,mkt,0,zh1,pz1);
   cc1:=0;
  end
  if cc1=0 and c>line  then begin
    //pc:=min(abs(min(holding,0)),cang1);
    pc:=min(abs(tsellholdingex( zh1,pz1 ,0 )),cang1);
    kc:=cang1-pc;
    //if pc>0 then sellshort(1,pc,limitr,open+mindiff);
    if pc>0 then tsellshort(1,pc,mkt,0,zh1,pz1);
    //if kc>0 then buy(1,kc,limitr,open+mindiff);
    if kc>0 then tbuy(1,kc,mkt,0,zh1,pz1);
    cc1:=1;
   end
  if cc1=0 and c<line then begin
     //pc:=min(max(holding,0),cang1);
     pc:=min(tbuyholdingex( zh1,pz1 ,0 ),cang1);
     kc:=cang1-pc;
   // if pc>0 then sell(1,pc,limitr,open-mindiff);
     if pc>0 then tsell(1,pc,mkt,0,zh1,pz1);
    //if kc>0 then buyshort(1,kc,limitr,open-mindiff);
    if kc>0 then tbuyshort(1,kc,mkt,0,zh1,pz1);
     cc1:=-1;
    end
   zline:stkindi(\'\',\'line.line1\',0,3);
  if cc2>0 and c<zline then begin
    // pc:=min(max(holding,0),cang1);
    pc:=min(tbuyholdingex( zh1,pz1 ,0 ),cang2);
    kc:=cang2-pc;
    //if pc>0 then sell(1,pc,limitr,open-mindiff);
    if pc>0 then tsell(1,pc,mkt,0,zh1,pz1);
    //if kc>0 then buyshort(1,kc,limitr,open+mindiff);
    if kc>0 then tbuyshort(1,kc,mkt,0,zh1,pz1);
    cc2:=0;
   end
  if cc2<0 and c>zline  then begin
    //pc:=min(abs(min(holding,0)),cang1);
    pc:=min(abs(tsellholdingex( zh1,pz1 ,0 )),cang2);
    kc:=cang2-pc;
    //if pc>0 then sellshort(1,pc,limitr,open+mindiff);
    if pc>0 then tsellshort(1,pc,mkt,0,zh1,pz1);
   //if kc>0 then buy(1,kc,limitr,open+mindiff);
   if kc>0 then tbuy(1,kc,mkt,0,zh1,pz1);
   cc2:=0;
  end
  if cc2=0 and c>zline  then begin
    //pc:=min(abs(min(holding,0)),cang1);
    pc:=min(abs(tsellholdingex( zh1,pz1 ,0 )),cang2);
    kc:=cang2-pc;
    //if pc>0 then sellshort(1,pc,limitr,open+mindiff);
    if pc>0 then tsellshort(1,pc,mkt,0,zh1,pz1);
    //if kc>0 then buy(1,kc,limitr,open+mindiff);
    if kc>0 then tbuy(1,kc,mkt,0,zh1,pz1);
    cc2:=1;
   end
  if cc2=0 and c<line then begin
     //pc:=min(max(holding,0),cang1);
     pc:=min(tbuyholdingex( zh1,pz1 ,0 ),cang2);
     kc:=cang2-pc;
     //if pc>0 then sell(1,pc,limitr,open-mindiff);
     if pc>0 then tsell(1,pc,mkt,0,zh1,pz1);
     //if kc>0 then buyshort(1,kc,limitr,open-mindiff);
     if kc>0 then tbuyshort(1,kc,mkt,0,zh1,pz1);
     cc2:=-1;
    end
  
    zline1:stkindi(\'\',\'line.line1\',0,5);
    if cc3>0 and c<zline1 then begin
       //pc:=min(max(holding,0),cang3);
       pc:=min(tbuyholdingex( zh1,pz1 ,0 ),cang3);
       kc:=cang3-pc;
       //if pc>0 then sell(1,pc,limitr,open-mindiff);
       if pc>0 then tsell(1,pc,mkt,0,zh1,pz1);
       //if kc>0 then buy(1,kc,limitr,open-mindiff);
       if kc>0 then tbuy(1,kc,mkt,0,zh1,pz1);
       cc3:=0;
      end
     if cc3<0 and c>zline1 then begin
        //pc:=min(abs(min(holding,0)),cang3);
        pc:=min(abs(tsellholdingex( zh1,pz1 ,0 )),cang3);
        kc:=cang3-pc;
        //if pc>0 then sellshort(1,pc,limitr,open+mindiff);
        if pc>0 then tsellshort(1,pc,mkt,0,zh1,pz1);
        //if kc>0 then buy(1,kc,limitr,open+mindiff);
        if kc>0 then tbuy(1,kc,mkt,0,zh1,pz1);
        cc3:=0;
       end
     if cc3=0 and c>zline1 then begin
        //pc:=min(abs(min(holding,0)),cang3);
        pc:=min(abs(tsellholdingex( zh1,pz1 ,0 )),cang3);
        kc:=cang3-pc;
        //if pc>0 then sellshort(1,pc,limitr,open+mindiff);
        if pc>0 then tsellshort(1,pc,mkt,0,zh1,pz1);
        //if kc>0 then buy(1,kc,limitr,open+mindiff);
        if kc>0 then tbuy(1,kc,mkt,0,zh1,pz1);
        cc3:=1;
       end
     if cc3=0 and c<zline1 then begin
       // pc:=min(max(holding,0),cang3);
        pc:=min(abs(tsellholdingex( zh1,pz1 ,0 )),cang3);
        kc:=cang3-pc;
        //if pc>0 then sell(1,pc,limitr,open-mindiff);
        if pc>0 then tsell(1,pc,mkt,0,zh1,pz1);
        //if kc>0 then buyshort(1,kc,limitr,open-mindiff);
        if kc>0 then tbuyshort(1,kc,mkt,0,zh1,pz1);
       cc3:=-1;
      end
end
     continueline@