以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  标识符长度  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=147960)

--  作者:derek099
--  发布时间:2017/2/20 12:14:26
--  标识符长度
 程序编译显示“标识符长度不能大于20字符” 是哪里出错了? 

--  作者:jinzhe
--  发布时间:2017/2/20 13:16:14
--  
代码贴一下
--  作者:derek099
--  发布时间:2017/2/20 13:25:13
--  
Input:ExtDepth(5,5,25,1),ExtDeviation(5,3,10,1),ExtBackStep(3,3,10,1);
variable:Zigzag[270]=0,NUM=0,whatlookfor:=0,LastPrice1:=0,LastPrice2:=0,LastSet1:=0,LastSet2:=0;
variable:Zigzaghigh[270]=0;
variable:Zigzaglow[270]=0;
WARNING_DISABLE:4;
NN:=barslast(day<>ref(day,1))+1;
If NN=1 Then BEGIN
   For i=1 to 270 do Zigzag[i]:=0; 
      Zigzaghigh[i]:=0;
      Zigzaglow[i]:=0;
      whatlookfor:=0;
      LastPrice1:=Open;
      LastPrice2:=0;
      LastSet1:=1;
      LastSet2:=0;
      NUM:=1;
      Zigzag[1]:=Open;
      Zigzaghigh[1]:=open;
      Zigzaglow[1]:=open;
      
END            
   REFCLOSE:=REF(CLOSE,1);
   LASTHIGH:=HHV(HIGH,NN-LastSet1);
   LASTLOW:=LLV(LOW,NN-LastSet1);
   LASTHIGHSET:=NN-HHVBARS(HIGH,NN-LastSet1);
   LASTLOWSET:=NN-LLVBARS(LOW,NN-LastSet1);  
   
If Islastbar<>1 AND whatlookfor=0 Then Begin //确定了起点,寻找第一个拐点
   If LastPrice1<>0 AND LastPrice2=0 Then BEGIN
      IF REFCLOSE>LastPrice1 AND (NN-LastSet1)>=ExtDepth AND (REFCLOSE-LastPrice1)>=ExtDeviation Then BEGIN  //先出现高点  
         LastPrice2:=REFCLOSE;
         LastSet2:=NN;
         whatlookfor:=-1;
         GOTO ENDEXIT@;
      END
      IF REFCLOSE<LastPrice1 AND (NN-LastSet1)>=ExtDepth AND (LastPrice1-REFCLOSE)>=ExtDeviation Then BEGIN  //先出现低点
         LastPrice2:=REFCLOSE;
         LastSet2:=NN;
         whatlookfor:=1;
         GOTO ENDEXIT@;
      END
   END  
END
If Islastbar<>1 AND whatlookfor=1 Then Begin //最后是向下拐点,寻找高点
   If LastPrice1<>0 AND LastPrice2<>0 Then BEGIN
      If REFCLOSE<LastPrice2 Then BEGIN 
         LastPrice2:=REFCLOSE;
         LastSet2:=NN; //最后一个比他小的数
      END
      IF REFCLOSE>LastPrice2 AND (NN-LastSet2)>=ExtDepth AND (REFCLOSE-LastPrice2)>=ExtDeviation Then BEGIN  // 找到高点
         NUM:=NUM+1; 
         whatlookfor:=-1;
         Zigzag[LASTLOWSET]:=LASTLOW;
         Zigzaglow[LASTLOWSET]:=LASTLOW;
         //Zigzaglow[LASTLOWSET]:=LASTLOW;
         LastPrice1:=LastPrice2;
         LastSet1:=LastSet2;
         LastPrice2:=REFCLOSE;
         LastSet2:=NN; 
      END
   END 
END
If Islastbar<>1 AND whatlookfor=-1 Then Begin //最后是向上拐点,寻找低点
   If LastPrice1<>0 AND LastPrice2<>0 Then BEGIN
      If REFCLOSE>LastPrice2 Then BEGIN
         LastPrice2:=REFCLOSE;
         LastSet2:=NN;
      END
      IF REFCLOSE<LastPrice2 AND (NN-LastSet2)>=ExtDepth AND (LastPrice2-REFCLOSE)>=ExtDeviation Then BEGIN  // 找到低点
         NUM:=NUM+1;
         whatlookfor:=1;          
         Zigzag[LASTHIGHSET]:=LASTHIGH;
         //Zigzaghigh[LASTHIGHSET]:=LASTHIGH;
         Zigzaghigh[LASTHIGHSET]:=LASTHIGH;
         LastPrice1:=LastPrice2;
         LastSet1:=LastSet2;
         LastPrice2:=REFCLOSE;
         LastSet2:=NN;
      END
   END
END
ENDEXIT@ ;
POLYLINE(Zigzag[NN]<>0,Zigzag[NN],COLORRED,1,VTSOLID);
//POLYLINE(Zigzaghigh[NN]<>0,Zigzag[NN],COLORRED,1,VTSOLID);

--  作者:jinzhe
--  发布时间:2017/2/20 13:30:08
--  

 Zigzaglow[LASTLOWSET]

就是这样的不能超过20个字,方括号也算