WW:=FLOOR((DATETOD1970(date)-3)/7);
WSt:=barpos=1 or WW<>ref(ww,1);
mm:=month;
mst:=barpos=1 or mm<>ref(mm,1);
if kg=1 then begin
WW:=mod(barpos,n)=1;
WSt:=barpos=1 or WW;
MM:=mod(barpos,m)=1;
MSt:=barpos=1 or MM;
end;
{月K线}
Med:=refx(MSt,1) or barpos=datacount;
Msp:=BARSLAST(MSt)+1;
MO:ref(O,BARSLAST(MSt)) LINETHICK0 colorWHITE;
MH:HHV(H,Msp) LINETHICK0 colorWHITE;
MH:=SETVAL(Med,MH,-BARSLAST(MSt),MH);
ML:LLV(L,Msp) LINETHICK0 colorWHITE;
ML:=SETVAL(Med,ML,-BARSLAST(MSt),ML);
MC:SETVAL(Med,C,-BARSLAST(MSt),C) LINETHICK0 colorWHITE;
MV:=SETVAL(Med,0,-FLOOR(BARSLAST(MSt)/2),1);
MV:=SETVAL(Med,MV,-FLOOR(BARSLAST(MSt)/2)+1,0);
PKM:=Msp>1;
PKMV:=PKM and MV;
PKLV:=MSt and Not(Med);
PKRV:=PKM and Med;
Zf:=MC>MO or (MC=MO and MC>ref(MC,Msp));
PARTLINE(PKM AND ZF,MO),COLORMAGENTA;
PARTLINE(PKM AND NOT(ZF),MO),colorffdd00;
PARTLINE(PKM AND ZF,MC),COLORMAGENTA;
PARTLINE(PKM AND NOT(ZF),MC),colorffdd00;
STICKLINE(PKMV AND ZF,MH,MAX(MC,MO),0,0),COLORMAGENTA;
STICKLINE(PKMV AND ZF,ML,MIN(MC,MO),0,0),COLORMAGENTA;
STICKLINE(PKMV AND NOT(ZF),MH,MAX(MC,MO),0,0),colorffdd00;
STICKLINE(PKMV AND NOT(ZF),ML,MIN(MC,MO),0,0),colorffdd00;
STICKLINE(PKLV AND ZF,MC,MO,0,0),COLORMAGENTA;
STICKLINE(PKRV AND ZF,MC,MO,0,0),COLORMAGENTA;
STICKLINE(PKLV AND NOT(ZF),MC,MO,0,0),colorffdd00;
STICKLINE(PKRV AND NOT(ZF),MC,MO,0,0),colorffdd00;
DRAWTEXT(PKMV and mc<ref(mc,msp),MH*1.01,'月'),COLORgreen,ALIGN1;
DRAWNUMBER(PKMV and mc<ref(mc,msp),MH*1.01,MM,0),COLORgreen,ALIGN2;
DRAWTEXT(PKMV and mc>=ref(mc,msp),MH*1.01,'月'),COLORred,ALIGN1;
DRAWNUMBER(PKMV and mc>=ref(mc,msp),MH*1.01,MM,0),COLORred,ALIGN2;
{周K线}
Wed:=refx(WSt,1) or barpos=datacount;
Wsp:=BARSLAST(WSt)+1;
WO:ref(O,BARSLAST(WSt)) LINETHICK0 colorYELLOW;
WH:HHV(H,Wsp) LINETHICK0 colorYELLOW;
WH:=SETVAL(Wed,WH,-BARSLAST(WSt),WH);
WL:LLV(L,Wsp) LINETHICK0 colorYELLOW;
WL:=SETVAL(Wed,WL,-BARSLAST(WSt),WL);
WC:SETVAL(Wed,C,-BARSLAST(WSt),C) LINETHICK0 colorYELLOW;
WV:=SETVAL(Wed,0,-FLOOR(BARSLAST(WSt)/2),1);
WV:=SETVAL(Wed,WV,-FLOOR(BARSLAST(WSt)/2)+1,0);
PKW:=Wsp>1;
PKMV:=PKW and WV;
PKLV:=WSt and Not(Wed);
PKRV:=PKW and Wed;
f:=WC>WO or (WC=WO and WC>ref(WC,Wsp));
PARTLINE(PKW AND F,WO),COLORAAAAEE;
PARTLINE(PKW AND NOT(F),WO) colorEEAAAA;
PARTLINE(PKW AND F,WC),COLORAAAAEE;
PARTLINE(PKW AND NOT(F),WC),colorEEAAAA;
STICKLINE(PKMV AND F,WH,MAX(WC,WO),0,0),COLORAAAAEE;
STICKLINE(PKMV AND F,WL,MIN(WC,WO),0,0),COLORAAAAEE;
STICKLINE(PKMV AND NOT(F),WH,MAX(WC,WO),0,0),colorEEAAAA;
STICKLINE(PKMV AND NOT(F),WL,MIN(WC,WO),0,0),colorEEAAAA;
STICKLINE(PKLV AND F,WC,WO,0,0),COLORAAAAEE;
STICKLINE(PKRV AND F,WC,WO,0,0),COLORAAAAEE;
STICKLINE(PKLV AND NOT(F),WC,WO,0,0),colorEEAAAA;
STICKLINE(PKRV AND NOT(F),WC,WO,0,0),colorEEAAAA;
{日K线}
if SYSPARAM(1)<SYSPARAM(3) then
kline(o,h,l,c,0);
|