{月周日K线}
DRAWGBK(1, COLORRGB(50,50,50),COLORRGB(100,100,100),0);
input:AA(5,1,1000),BB(20,1,1000);
DRAWBKBMP(c,'光和影');
{-----------------------☆功能开关------------------------}
{月--周期K线}
if datacount<BB then exit;
y1:=mod(barpos,BB);
Y2:=if(y1=0,BB-1,y1-1);
Y3:=barslast(Y2=0);
Y4:=barslast(Y2=BB-1);
Y5:=ref(o,Y3);
Y6:=hhv(h,Y3+1)*(Y4=0);
Y7:=llv(if(L=0,100000,L),Y3+1)*(Y4=0);
Y8:=IF(Y3=0,C,0);
Y9:=IF(Y4=0,C,0);
Y10:=IF(Y4=0,Y6,0);
Y11:=IF(Y4=0,Y7,0);
for n=lbound(Y8) to ubound(Y8) do begin
if Y8[n]>0 then begin
for z=n+BB-1 to ubound(Y8) do begin
if Y9[z]>0 then begin
for s=n to z-1 do begin
YC1:=Y9[z];
YH1:=Y10[z];
YL1:=Y11[z];
end;
break;
end;
end;
end;
end;
YXQc1:=C;
YXQh1:=hhv(h,Y2[datacount]+1);
XQL1:=LLV(if(L=0,1000000,L),Y2[datacount]+1);
YXQCC:=if(barpos>datacount-Y2[datacount]-1,YXQc1[datacount],if(Y2=BB-1,C,YC1));
YXQHH:=if(barpos>datacount-Y2[datacount]-1,YXQh1[datacount],if(Y2=BB-1,ref(YH1,1),YH1));
YXQLL:=if(barpos>datacount-Y2[datacount]-1,XQL1[datacount],if(Y2=BB-1,ref(YL1,1),YL1));
{周--周期K线}
if datacount<AA then exit;
Z1:=mod(barpos,AA);
Z2:=if(Z1=0,AA-1,Z1-1);
Z3:=barslast(Z2=0);
Z4:=barslast(Z2=AA-1);
Z5:=ref(o,Z3);
Z6:=hhv(h,Z3+1)*(Z4=0);
Z7:=llv(if(L=0,100000,L),Z3+1)*(Z4=0);
Z8:=IF(Z3=0,C,0);
Z9:=IF(Z4=0,C,0);
Z11:=IF(Z4=0,Z6,0);
Z12:=IF(Z4=0,Z7,0);
for n=lbound(Z8) to ubound(Z8) do begin
if Z8[n]>0 then begin
for z=n+AA-1 to ubound(Z8) do begin
if Z9[z]>0 then begin
for s=n to z-1 do begin
ZC1:=Z9[z];
ZH1:=Z11[z];
ZL1:=Z12[z];
end;
break;
end;
end;
end;
end;
Zzc1:=C;
Zzh1:=hhv(h,Z2[datacount]+1);
ZzL1:=LLV(if(L=0,1000000,L),Z2[datacount]+1);
ZzCC:=if(barpos>datacount-Z2[datacount]-1,Zzc1[datacount],if(Z2=AA-1,C,ZC1));
ZzHH:=if(barpos>datacount-Z2[datacount]-1,Zzh1[datacount],if(Z2=AA-1,ref(ZH1,1),ZH1));
ZzLL:=if(barpos>datacount-Z2[datacount]-1,ZzL1[datacount],if(Z2=AA-1,ref(ZL1,1),ZL1));
{-----------------【图解模板】---------------------}
{月--周期K线}
FILLRGN(Y2>0 and YXQCC>=Y5,YXQHH,YXQLL),ColorA8A6FF;
FILLRGN(Y2>0 and YXQCC<Y5,YXQHH,YXQLL),ColorD8A668;
{周--周期K线}
FILLRGN(Z2>0 and ZzCC>=Z5,ZzHH,ZzLL),Color8787E9;
FILLRGN(Z2>0 and ZzCC<Z5,ZzHH,ZzLL),ColorFF8E18;
{日--K线}
STICKLINE(C>=O,C,O,7,0),COLORRED;
STICKLINE(C>=O,C,O,4,0),COLOR5070ff;
STICKLINE(C>=O,C,O,2,0),COLOR9fff;
STICKLINE(C>=O,H,L,0,0),COLORYELLOW;
STICKLINE(C<=O,C,O,7,0),COLOR8F2020;
STICKLINE(C<=O,C,O,4,0),COLORa36600;
STICKLINE(C<=O,C,O,2,0),colord9cc66;
STICKLINE(C<=O,H,L,0,0),colorffdd99;