INPUT:KT1(10,1,999),KT2(30,1,999);
a:MA(CLOSE,KT1)COLORAA00FF;
b:MA(CLOSE,KT2)COLORFF00AA;
K:=BARSLAST( CROSS(a,b) OR CROSS(B,A) OR ISLASTBAR OR BARPOS=1);
HK:=IF(NOT( ISLASTBAR),REF(HHV(H,K+1),1),IF(H>REF(HHV(H,K+1),1),H,REF(HHV(H,K+1),1)));
LK:=IF(NOT( ISLASTBAR),REF(LLV(L,K+1),1),IF(L<REF(LLV(L,K+1),1),L,REF(LLV(L,K+1),1)));
H叉:=IF(K=0,HK,0);
L叉:=IF(K=0,LK,0);
HH:=HK*0;
LL:=LK*0;
for NP=lbound(H叉) to ubound(H叉) do begin
if H叉[NP]>=0 then begin
for ZP=NP+1 to ubound(H叉) do begin
if H叉[ZP]>0 then begin
for S=NP to ZP-1 do begin
HH[S]:=H叉[ZP];
LL[S]:=L叉[ZP];
X0:=IF(HH>0,HH,HK);
Y0:=IF(LL>0,LL,LK);
end;
break;
end;
end;
end;
end;
X:=IF(DATACOUNT>1,IF(BARPOS=1,REFX(X0,1),X0),H);
Y:=IF(DATACOUNT>1,IF(BARPOS=1,REFX(Y0,1),Y0),H);
PARTLINE((Y=REF(Y,1) AND X=REF(X,1)) OR BARPOS=1,X),COLOR00FFFF;
PARTLINE((Y=REF(Y,1) AND X=REF(X,1)) OR BARPOS=1,Y),COLOR00FFFF;
STICKLINE(K=0,X,Y,0,0),COLOR00FFFF;
STICKLINE(REFX(K=0 AND NOT( ISLASTBAR),1),X,Y,0,0),COLOR00FFFF;
BS:=SUMBARS(K=0 AND NOT( ISLASTBAR),1);
BX:=REF(X,BS);
BY:=REF(Y,BS);
PARTLINE(Y=REF(Y,1) AND X>BX AND Y>BY,X),COLOR0066FF;
PARTLINE(Y=REF(Y,1) AND X>BX AND Y>BY,Y),COLOR00966FF;
STICKLINE(K=0 AND X>BX AND Y>BY,X,Y,0,0),COLOR0066FF;
STICKLINE(REFX(K=0 AND NOT( ISLASTBAR),1) AND X>BX AND Y>BY,X,Y,0,0),COLOR0066FF;
PARTLINE(Y=REF(Y,1) AND X>BX AND Y<BY,X),COLORFFFFFF;
PARTLINE(Y=REF(Y,1) AND X>BX AND Y<BY,Y),COLORFFFFFF;
STICKLINE(K=0 AND X>BX AND Y<BY,X,Y,0,0),COLORFFFFFF;
STICKLINE(REFX(K=0 AND NOT( ISLASTBAR),1) AND X>BX AND Y<BY,X,Y,0,0),COLORFFFFFF;
PARTLINE(Y=REF(Y,1) AND X<BX Y<BY,X),COLORFFAA33;
PARTLINE(Y=REF(Y,1) AND X<BX AND Y<BY,Y),COLORFFAA33;
STICKLINE(K=0 AND X<BX AND Y<BY,X,Y,0,0),COLORFFAA33;
STICKLINE(REFX(K=0 AND NOT( ISLASTBAR),1) AND X<BX AND Y<BY,X,Y,0,0),COLORFFAA33; |