查看完整版本: 清扬这个公式怎么改成5 15 60分钟的?

myky 2007-8-12 11:06

清扬这个公式怎么改成5 15 60分钟的?

[code]
///////////////禁止在日以上周期使用///////
if datatype>6 then
begin
  drawtext(barpos=datacount,low,'本公式仅适用于\n日及日以下周期'),align2;
  exit;
end;

////////////////定位分界点/////////////////
tj:=day<>ref(day,1) or barpos=1;//起始分界点;
if datatype=6 then
  tj:=(weekday-ref(weekday,1)<>datediff(ref(date,1),date)) or barpos=1;
if datacount>1 then for i=1 to datacount-1 do tj1[i]:=tj[i+1];
tj1[datacount]:=1;

//////////处理引用的上一档(日、周)开、高、低及收盘价/////
fc:=c;fh:=h;fl:=l;fo:=o;
for i=1 to datacount do begin
  if tj[i] then begin
    hh:=fh[i]; ll:=fl[i]; oo:=fo[i];
  end
  else begin
    fo[i]:=oo;
    hh:=max(hh,fh[i]);
    ll:=min(ll,fl[i]);
  end;
  if i>1 then begin
    if tj1[i] then begin
      for j=i downto 1 do begin
        fc[j]:=fc[i]; fh[j]:=hh; fl[j]:=ll;
        if tj[j] then break;
      end;
    end;
  end;
end;

//////////处理引用的上二档(周、月)开、高、低及收盘价/////
ytj:=(weekday-ref(weekday,1)<>datediff(ref(date,1),date)) or barpos=1;
if datatype=6 then
  ytj:=month<>ref(month,1) or barpos=1;
if datacount>1 then for i=1 to datacount-1 do ytj1[i]:=ytj[i+1];
ytj1[datacount]:=1;
yfc:=c;yfh:=h;yfl:=l;yfo:=o;
for i=1 to datacount do begin
  if ytj[i] then begin
    hh:=yfh[i]; ll:=yfl[i]; oo:=yfo[i];
  end
  else begin
    yfo[i]:=oo;
    hh:=max(hh,yfh[i]);
    ll:=min(ll,yfl[i]);
  end;
  if i>1 then begin
    if ytj1[i] then begin
      for j=i downto 1 do begin
        yfc[j]:=yfc[i]; yfh[j]:=hh; yfl[j]:=ll;
        if ytj[j] then break;
      end;
    end;
  end;
end;

////////画K线图///////////////
ytj2:=yfc>yfo or yfc=yfo and yfc>ref(yfc,1);
stickline(ytj2,yfh,yfl,10,0),Color004080;
stickline(not(ytj2),yfh,yfl,10,0),ColorE27300;

tj2:=fc>fo or fc=fo and fc>ref(fc,1);
stickline(tj2,fh,fl,10,0),Color7F6780;
stickline(tj2,fc,fo,10,0),ColorDB3FCA;
stickline(not(tj2),fh,fl,10,0),Color808040;
stickline(not(tj2),fc,fo,10,0),Color3F9700;

tj3:=c>o or c=o and c>ref(c,1);
stickline(tj3,h,l,0.1,0),colorred;
stickline(tj3,o,c,7,0),colorred;
stickline(not(tj3),h,l,0.1,0),colorcyan;
stickline(not(tj3),c,o,7,0),colorcyan;

//////画均线///////
a:=(3*c+l+o+h)/6;

b:(20*a+19*ref(a,1)+18*ref(a,2)+17*ref(a,3)+16*ref(a,4)+15*ref(a,5)+14*ref(a,6)
+13*ref(a,7)+12*ref(a,8)+11*ref(a,9)+10*ref(a,10)+9*ref(a,11)+8*ref(a,12)
+7*ref(a,13)+6*ref(a,14)+5*ref(a,15)+4*ref(a,16)+3*ref(a,17)+2*ref(a,18)+
ref(a,20))/210;
d:ma(b,10);
[/code]

hx817 2007-8-14 22:48

这个公式思路建立在日线周期上,换其他周期思路就不对了

pengyou 2007-8-15 16:20

禁止在日以上周期使用

5 15 60分钟  通用呀
页: [1]
查看完整版本: 清扬这个公式怎么改成5 15 60分钟的?