--  作者:AK之王 
        --  发布时间:2016/8/4 20:17:10 
        
        --  请问SAR抛物线起点的条件是什么? 
        INPUT:CYC(10,1,100,2); RUNMODE:0; //使用逐周期运行模式 
	  
	//保证variable声明的变量都尽量在公式的最前面,防止带有IF语句的分支执行影响变量的初始化 variable:Step = 2 / 100; //步长 variable:fMax = 20 / 100; //最大值 
	  
	variable:sarx=0; variable:Trend=0; variable:EP=0; variable:AF=0; 
	  
	//计算高点低点的值放到IF前面,防止前面语句直接退出导致最前CYC个周期的数据无法统计到 highprice:=ref(hhv(high,cyc),1); lowPrice:=ref(llv(low,cyc),1); 
	  
	原始SAR:SAR(10,2,20); 
	  
	if barpos <= Cyc then  exit;//不到CYC的统计周期,直接退出等待下个周期再做判断 
	if barpos = cyc+1 then begin  af:=Step;  ep:=-1;  if (high[barpos]-high[barpos-1])+(low[barpos]-low[barpos-1]) > 0 then  begin   //看跌   Trend:= -1;   sarx:=highprice;  end  else  begin   //看涨   Trend:= 1;   sarx:=lowPrice;  end  GOTO ENDANDSHOW;//跳转到末尾直接显示 End 
	//判断出这些日子数据的上涨,或者下跌 if Trend > 0 then begin  //是否为跳转标志  if ep > 0 then  begin   sarx:=lowPrice;   EP:=-1;   GOTO ENDANDSHOW;//跳转到末尾直接显示  end    //如果今日最高价大于前N的最高价,加速因子需要增加  if high > highprice then  begin   af := af+step;   if af > fmax then     af := fmax;  end    fsar := sarx + af * (highprice - sarx);  //是否跳转  if fsar > low then  begin   trend:=-1;   ep:=1;   af:=step;  end  sarx:=fsar; end else begin  if ep > 0 then  begin   sarx:=highprice;   ep:=-1;   GOTO ENDANDSHOW; //跳转到末尾直接显示  end    //看跌  if low < lowPrice then  begin   af := af + step;   if af > fmax then     af := fmax;  end    fsar := sarx + af * (lowprice-sarx);    //是否跳转  if fSar < High then  begin   Trend := 1;   EP := 1;   AF := Step;  end  sarx := fSar; end 
	//显示变量 ENDANDSHOW@; //此为语句标号,GOGO语句可以用这个标号直接跳转到这里 ShowSar:sarx; 
	  
	  
	SAR抛物线的起点是10周期最高价或最低价,请问抛物线起点的条件是什么? 
         
       |