總版主前指導的公式
INPUT:NP(34,1,1000),M(34,1,1000);
IsHighValue := ref(H,1)>ref(hhv(H,NP),2) and H<ref(H,1);
IsHighValue :=refx(IsHighValue,1);
IsLowValue := ref(L,1)<ref(LLV(L,M),2) and L>ref(L,1);
IsLowValue :=refx(IsLowValue ,1);
CK:=IsHighValue-IsLowValue;
BLK:=ref(CK,barslast(CK<>0));
BlkSW:=BLK<>ref(BLK,1) or barpos=0;
HH:=H;
LL:=L;
MaxHP:=0;
MinLP:=0;
PP:=C*0;
for i=lbound(BLK) to datacount do begin if BlkSW[i] or i=datacount then begin if MaxHP>0 then PP[MaxHP]:=1;
if MinLP>0 then PP[MinLP]:=-1;
MaxHP:=0;
MinLP:=0;
end;
if BLK[i]=1 and CK[i]=1 then begin if MaxHP=0 then MaxHP:=i;
if HH[i]>HH[MaxHP] then MaxHP:=i;
end
else
if BLK[i]=-1 and CK[i]=-1 then begin if MinLP=0 then MinLP:=i;
if LL[i]<LL[MinLP] then MinLP:=i;
end;
end;
DrawNumber(PP=1, High+15, High, 0),COLORMAGENTA;
DrawNumber(PP=-1, Low-15, Low, 0),COLORYELLOW;
|