月 周 日 K线同图-按日历计算的真正的月 周 日 K线同图 + 周框图

[复制链接]
查看111 | 回复0 | 2022-7-13 07:29:23 | 显示全部楼层 |阅读模式
{月 周 日 K线同图-按日历计算的真正的月 周 日 K线同图}
DRAWGBK(1,COLORRGB(20,20,110),COLORRGB(0,0,50),1);
TBS:=POW(10,ABS(LOG(MINDIFF)));
//月线
BY:=MONTH;YB:=BY-REF(BY,1)<>0 OR BARPOS=1;
w:BARSLAST(YB),LINETHICK;
dg:=w=0 or ISLASTBAR;
wx:=0*C;
for P=datacount-1 downto lbound(dg) do
if dg[P] then
wx[P]:=0;
else
wx[P]:=wx[P+1]+1;
r:=BACKSET(ISLASTBAR,w+1)-ISLASTBAR;
wx:=refx(wx,1)+r,LINETHICK;
oo:=ref(o,w);
hh:=hhv(h,w+1);
LL:=LLv(L,w+1);
月开:ROUND(OO*TBS)/TBS,LINETHICK;
月高:ROUND(refx(hh,wx)*TBS)/TBS,LINETHICK;
月低:ROUND(refx(LL,wx)*TBS)/TBS,LINETHICK;
月收:ROUND(refx(c,wx)*TBS)/TBS,LINETHICK;
f:=月收>月开 or (月收=月开 and 月收>ref(月收,W));
j:=cross(w,wx);
STICKLINE(w>=0 and f AND NOT(BY<>REF(BY,1) OR BY<>REFX(BY,1)),月低,月高,20,0),COLORMAGENTA;
STICKLINE(w>=0 and not(f) AND NOT(BY<>REF(BY,1) OR BY<>REFX(BY,1)),月低,月高,20,0)COLORFFDD00;{}
P:=BARPOS;
DRAWTEXT(w>0 and j,月高*1.01,'月'),COLOR00CCFF,ALIGN1;
DRAWNUMBER(w>0 and j,月高*1.01,BY,0),COLOR00CCFF,ALIGN2;
//
{周月K线}
//周线
BZ:=WEEKDAY;ZB:=DATEDIFF(REF(DATE,1),DATE)<>BZ-REF(BZ,1) OR BARPOS=1;
ZW:=BARSLAST(ZB),LINETHICK;
Zdg:=ZW=0 or ISLASTBAR;
Zwx:=0*c;
for P=datacount-1 downto lbound(Zdg) do
if Zdg[P] then
Zwx[P]:=0;
else
Zwx[P]:=Zwx[P+1]+1;
Zr:=BACKSET(ISLASTBAR,Zw+1)-ISLASTBAR;
Zwx:=refx(Zwx,1)+Zr,LINETHICK;
zq:=BARSLAST(ref(Zwx,1)=0 or BARPOS=1)+1;
Zo:=ref(o,Zw);
Zh:=hhv(h,Zw+1);
ZL:=LLv(L,Zw+1);
周开:ROUND(ZO*TBS)/TBS,LINETHICK;
周高:ROUND(refx(Zh,Zwx)*TBS)/TBS,,COLORFF,LINETHICK;
周低:ROUND(refx(ZL,Zwx)*TBS)/TBS,COLORFF00,LINETHICK;
周收:ROUND(refx(c,Zwx)*TBS)/TBS,,COLORFF00FF,LINETHICK;
Zf:=周收>周开 or (周收=周开 and 周收>ref(周收,Zw+1));
Zj:=cross(Zw,Zwx);
yt:=if(zq=1 and refx(zq,2)=1,13,if(refx(zq,1)=1 or zq=1,7,14));
//影线
STICKLINE(Zw>0 and Zf and Zj,周低,周高,1,0)COLORAAAAEE;
STICKLINE(周开<周收,周开,周收,YT,0),COLORAAAAEE;
STICKLINE(Zw>0 and not(Zf) and Zj,周低,周高,1,0)COLOREEAAAA;
STICKLINE(周开>周收,周开,周收,YT,0),COLOREEAAAA;
//日线
TJ:=CLOSE>OPEN or CLOSE=OPEN and CLOSE>REF(CLOSE,1);
STICKLINE(TJ,LOW,HIGH,1,0),ColorE9;
STICKLINE(TJ,LOW,CLOSE,8,0),Color80;
STICKLINE(TJ,LOW,CLOSE,6,0),ColorA5;
STICKLINE(TJ,LOW,CLOSE,4,0),ColorC0;
STICKLINE(TJ,LOW,CLOSE,2,0),ColorE6;
STICKLINE(NOT(TJ),HIGH,LOW,1,0),ColorAA00;
STICKLINE(NOT(TJ),CLOSE,OPEN,8,0),Color5000;
STICKLINE(NOT(TJ),CLOSE,OPEN,6,0),Color6600;
STICKLINE(NOT(TJ),CLOSE,OPEN,4,0),Color8000;
STICKLINE(NOT(TJ),CLOSE,OPEN,2,0),ColorA000;



周框图引用公式:
{先建引用公式 名称: 引用4价}
C1:C;
O1:O;
H1:H;
L1:L;



{周框图-听雪寻股}
WC:="引用4价.C1#WEEK",LINETHICK0;
Wo:="引用4价.o1#WEEK",;
WH:="引用4价.h1#WEEK",LINETHICK0;
WL:="引用4价.l1#WEEK",LINETHICK0;
●周开:WO,LINETHICK0,COLOR00AAFF;
●周收:WC,LINETHICK0,COLORFF00FF;
●周高:WH,LINETHICK0,COLORRED;
●周低:WL,LINETHICK0,COLOR00FFFF;
BZ:=WEEKDAY;ZB:=DATEDIFF(REF(DATE,1),DATE)<>BZ-REF(BZ,1) OR BARPOS=1;
ZC:=WEEKDAY<REF(WEEKDAY,1)or zb;ZM:=REFX(zc,1) ;
TT:=BARSCOUNT(C)=1;
{周影线}
{STICKLINE(WC>=WO AND WEEKDAY=3 OR (REF(WEEKDAY,1)<3 AND WEEKDAY=4),WL,WH,0.1,0),LINEDOT,,COLOR9999DD;
STICKLINE(WC<WO AND WEEKDAY=3 OR (REF(WEEKDAY,1)<3 AND WEEKDAY=4),WL,WH,0.1,0),LINEDOT,,COLORDDAA88;}
STICKLINE(WC>=WO AND (ZC OR TT OR ZM OR ISLASTBAR) ,WL,WH,0.1,0),LINEDOT,COLOR9999DD;
STICKLINE(WC<WO AND (ZC OR TT OR ZM OR ISLASTBAR),WL,WH,0.1,0),LINEDOT,COLORDDAA88;
DRAWLINE(WC>=WO AND (ZC OR TT ),WH,WC>=WO AND (ZM OR ISLASTBAR) ,WH,0),LINEDOT,COLOR9999DD;
DRAWLINE(WC<WO AND (ZC OR TT ),WH,WC<WO AND (ZM OR ISLASTBAR) ,WH,0),LINEDOT,COLORDDAA88;
DRAWLINE(WC>=WO AND (ZC OR TT ),WL,WC>=WO AND (ZM OR ISLASTBAR) ,WL,0),LINEDOT,COLOR9999DD;
DRAWLINE(WC<WO AND (ZC OR TT ),WL,WC<WO AND (ZM OR ISLASTBAR) ,WL,0),LINEDOT,COLORDDAA88; DRAWICON(h=wh,h*1.02,10);
DRAWICON(l=wl,l*0.98,12); KLINE(O,H,L,C,0);
JC:=(REF(C,3)+REF(C,5)+REF(C,7)+REF(C,8)+REF(C,13)+REF(C,21))/6;
参考价:SMA(JC,5,1), CIRCLEDOT,COLORGREEN,;
价:IF(C>=参考价,参考价,0),CIRCLEDOT,COLOR0000FF,LINETHICK0;

20128298313665863.jpg

20128298313665863.jpg



 

20128298315233581.rar

4.58 KB, 下载次数: 0

20128298315233581.rar

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则