分时主图显示最近五个交易日K线和成交量

[复制链接]
查看113 | 回复0 | 2021-8-21 08:50:32 | 显示全部楼层 |阅读模式

以下是分时主图显示最近五个交易日K线和成交量(无源码的请下载附件导入)

写一个在分时图上能够显示最近五个交易日K线走向和成交量缩放的分时主图。在论坛也找了一些资料,参考前辈老师稍微改动了。但成交量还是有瑕疵,所以留下M  N两个参数 群策群力看看能不能改进一下。如果您手中有这种主图。请绕道,因为可能您的比我写的要先进。我这个还待优化。
 


因为要在分时图上画5个交易日的K线和成交量 所以先麻烦您建立引用“分时K线引用”所以名字固定为
fsky
引用公式内容

V1:REF(HSL,1)*10;
V2:REF(HSL,2)*10;
V3:REF(HSL,3)*10;
V4:REF(HSL,4)*10;
ZO:REF(O,1);
ZC:REF(C,1);
ZH:REF(H,1);
ZL:REF(L,1);
JO:REF(O,2);
JC:REF(C,2);
JH:REF(H,2);
JL:REF(L,2);
JO3:REF(O,3);
JC3:REF(C,3);
JH3:REF(H,3);
JL3:REF(L,3);
JO4:REF(O,4);
JC4:REF(C,4);
JH4:REF(H,4);
JL4:REF(L,4);
JC5:REF(C,5);

建好上面的引用请退出该公式  再建下面分时主图

{分时主图}

 

 

 


N:=500;
M:=250;
N2:=150;
KP:=DYNAINFO(4);
ZX:=DYNAINFO(7);
ZS:=DYNAINFO(3);
ZG:=DYNAINFO(5);
ZD:=DYNAINFO(6);
OP:=100-(KP/ZS-1)*1000;
CL:=100-(ZX/ZS-1)*1000;
HI:=100-(ZG/ZS-1)*1000;
LO:=100-(ZD/ZS-1)*1000;
N1:=950;
Q:=IF(ZX>KP,RGB(255,0,0),IF(ZX<KP,RGB(84,255,255),IF(ZX=KP,RGB(255,255,255),DRAWNULL)));
DRAWRECTREL(N1+4,HI,N1+7,LO,Q );
DRAWRECTREL(N1,OP,N1+12,CL,Q );
ZO:="FSKY.ZO#DAY";
ZC:="FSKY.ZC#DAY";
ZH:="FSKY.ZH#DAY";
ZL:="FSKY.ZL#DAY";
JC:="FSKY.JC#DAY";
ZKP:=100-(ZO/JC-1)*1000;
ZCP:=100-(ZC/JC-1)*1000;
ZZG:=100-(ZH/JC-1)*1000;
ZZD:=100-(ZL/JC-1)*1000;
Q1:=IF(ZC>ZO,RGB(255,0,0),IF(ZC<ZO,RGB(84,255,255),IF(ZC=ZO,RGB(255,255,255),DRAWNULL)));
DRAWRECTREL(N1-10,ZZG,N1-7,ZZD,Q1);
DRAWRECTREL(N1-14,ZKP,N1-2,ZCP,Q1);
JO:="FSKY.JO#DAY";
JC3:="FSKY.JC3#DAY";
JH:="FSKY.JH#DAY";
JL:="FSKY.JL#DAY";
ZZKP:=100-(JO/JC3-1)*1000;
ZZCP:=100-(JC/JC3-1)*1000;
ZZZG:=100-(JH/JC3-1)*1000;
ZZZD:=100-(JL/JC3-1)*1000;
Q2:=IF(JC>JO,RGB(255,0,0),IF(JC<JO,RGB(84,255,255),IF(JC=JO,RGB(255,255,255),DRAWNULL)));
DRAWRECTREL(N1-21,ZZZG,N1-18,ZZZD,Q2);
DRAWRECTREL(N1-26,ZZKP,N1-14,ZZCP,Q2);
JO3:="FSKY.JO3#DAY";
JC4:="FSKY.JC4#DAY";
JH3:="FSKY.JH3#DAY";
JL3:="FSKY.JL3#DAY";
ZZKP3:=100-(JO3/JC4-1)*1000;
ZZCP3:=100-(JC3/JC4-1)*1000;
ZZZG3:=100-(JH3/JC4-1)*1000;
ZZZD3:=100-(JL3/JC4-1)*1000;
Q3:=IF(JC3>JO3,RGB(255,0,0),IF(JC3<JO3,RGB(84,255,255),IF(JC3=JO3,RGB(255,255,255),DRAWNULL)));
DRAWRECTREL(N1-34,ZZZG3,N1-30,ZZZD3,Q3);
DRAWRECTREL(N1-39,ZZKP3,N1-26,ZZCP3,Q3);
JO4:="FSKY.JO4#DAY";
JC5:="FSKY.JC5#DAY";
JH4:="FSKY.JH4#DAY";
JL4:="FSKY.JL4#DAY";
ZZKP4:=100-(JO4/JC5-1)*1000;
ZZCP4:=100-(JC4/JC5-1)*1000;
ZZZG4:=100-(JH4/JC5-1)*1000;
ZZZD4:=100-(JL4/JC5-1)*1000;
Q4:=IF(JC4>JO4,RGB(255,0,0),IF(JC4<JO4,RGB(84,255,255),IF(JC4=JO4,RGB(255,255,255),DRAWNULL)));
DRAWRECTREL(N1-47,ZZZG4,N1-44,ZZZD4,Q4);
DRAWRECTREL(N1-51,ZZKP4,N1-39,ZZCP4,Q4);
T1:=IF(ZX>KP OR (ZX=KP AND ZX>=ZS),RGB(255,0,0),RGB(84,255,255));
T2:=IF(ZC>ZO OR (ZC=ZO AND ZC>=JC),RGB(255,0,0),RGB(84,255,255));
T3:=IF(JC>JO OR (JC=JO AND JC>=JC3),RGB(255,0,0),RGB(84,255,255));
T4:=IF(JC3>JO3 OR (JC3=JO3 AND JC3>=JC4),RGB(255,0,0),RGB(84,255,255));
T5:=IF(JC4>JO4 OR (JC4=JO4 AND JC4>=JC5),RGB(255,0,0),RGB(84,255,255));
DRAWRECTREL(N1+2,N2-(HSL#DAY*10/N2-1)*M,N1+10,N,T1);
DRAWRECTREL(N1-12,N2-("FSKY.V1#DAY"/N2-1)*M,N1,N,T2);
DRAWRECTREL(N1-24,N2-("FSKY.V2#DAY"/N2-1)*M,N1-10,N,T3);
DRAWRECTREL(N1-36,N2-("FSKY.V3#DAY"/N2-1)*M,N1-22,N,T4);
DRAWRECTREL(N1-48,N2-("FSKY.V4#DAY"/N2-1)*M,N1-34,N,T5);

6400145.jpg

6400145.jpg

6477003.jpg

6477003.jpg

回复

使用道具 举报

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

本版积分规则