资金流量+主买主卖差-----叠加每分钟净资金流量计算问题(副图 源码 贴图 探讨)介绍
资金流量+主买主卖差-----叠加每分钟净资金流量计算问题(副图 源码 贴图 探讨)
求高手编写一个TDX的通过分时走势里每分钟净资金流量的叠加,算出当日资金的净流出和净流入或者算出当日主买量和主卖量之差。
我感觉通过
买量:=IF(CLOSE>OPEN,AA*(HIGH-LOW),IF(CLOSE<OPEN,AA*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2)),LINETHICK0,COLORRED;
卖量:=IF(CLOSE>OPEN,0-AA*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-AA*(HIGH-LOW),0-VOL/2)),LINETHICK0,COLORCYAN;
这样子算出来的当日的主卖量和主卖量并没有那么准确。
可以通过分时走势中的每分钟资金流量的叠加来算当日的净流入金额吗?
公式1:主买主卖差
N:1 200 3
M:1 200 8
AA:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));
买量:=IF(CLOSE>OPEN,AA*(HIGH-LOW),IF(CLOSE<OPEN,AA*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2)),LINETHICK0,COLORRED;
卖量:=IF(CLOSE>OPEN,0-AA*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-AA*(HIGH-LOW),0-VOL/2)),LINETHICK0,COLORCYAN;
进出量:=买量+卖量,COLOR00FFFF;
STICKLINE(进出量<0,0,进出量,1,0),COLORFF6600;
STICKLINE(进出量<0,0,进出量,1,0),COLORFF9900;
STICKLINE(进出量<0,0,进出量,1.0,0),COLORFFCC00;
STICKLINE(进出量<0,0,进出量,0.5,0),COLORGREEN;
STICKLINE(进出量>0,0,进出量,1,0),COLOR000099;
STICKLINE(进出量>0,0,进出量,1,0),COLOR0000CC;
STICKLINE(进出量>0,0,进出量,1.0,0),COLOR0000FF;
STICKLINE(进出量>0,0,进出量,0.5,0),COLORCC66FF;
万手:VOL/10000,LINETHICK0,NODRAW;
BB:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));
主动买:=IF(CLOSE>OPEN,BB*(HIGH-LOW),IF(CLOSE<OPEN,BB*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2));
主买:主动买/10000,COLORRED,NODRAW;
主动卖:=IF(CLOSE>OPEN,0-BB*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-BB*(HIGH-LOW),0-VOL/2));
主卖:-主动卖/10000,COLORGREEN,NODRAW;
主净额:(主动买+主动卖)/10000,NODRAW;
VAR1:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));
买:=IF(CLOSE>OPEN,VAR1*(HIGH-LOW),IF(CLOSE<OPEN,VAR1*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2)),COLORRED;
卖:=IF(CLOSE>OPEN,0-VAR1*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-VAR1*(HIGH-LOW),0-VOL/2)),COLOR00FF00 ;
买卖差:=(买+卖);
买卖比:ABS(买/卖);
N日内净流入:SUM (买卖差,N), LINETHICK2,COLORGREEN;
流入:IF (N日内净流入>REF(N日内净流入,1),N日内净流入,DRAWNULL),COLORMAGENTA,LINETHICK2;
M日内翻红天数:COUNT(买卖差>0,M);
连红天数:BARSLASTCOUNT(买卖差>0);
公式2:资金流量
轴:0,COLOR4B4B4B;
PJJ:=DMA((H + L + C * 2) / 4,0.9);
JJ:=REF(EMA(PJJ,3),1);
QJJ:=VOL / ((H - L) * 2 - ABS(C - O));
XVL:=IF(C > O,QJJ * (H - L),IF(C < O,QJJ * (H - O + (C - L)),VOL / 2)) + IF(C > O,0 - QJJ * (H - C + (O - L)),IF(C < O,0 - QJJ * (H - L),0 - VOL / 2));
ZLL:=VOL / CAPITAL;
HSL1:=IF(ZLL > 10,10,ZLL);
HSL:=XVL / 20 / 1.15;
攻击流量:=HSL * 0.55 + REF(HSL,1) * 0.33 + REF(HSL,2) * 0.22;
GJJ:=EMA(攻击流量,8);
LLJX:=EMA(攻击流量,3);
流量:LLJX,COLORC875B7,NODRAW;
STICKLINE(流量 > 0,流量,0,2.3,0)COLOR0000FF;
STICKLINE(流量 < 0,流量,0,2.3,0),COLORFF4242;
流量基线:GJJ,COLOR00BBBB;
STICKLINE(HSL * 0.4 >= 0,HSL * 0.4 * 1.5,0,0,1)COLORYELLOW;
STICKLINE(HSL * 0.4 < 0,HSL * 0.4 * 1.5,0,0,1)COLORGREEN;
ZJLL:=REF(LLJX,1);
QZJJ:=(((LLJX - ZJLL) / ZJLL) * 100);
流量幅%:IF(((LLJX > 0) AND (ZJLL < 0)),ABS(QZJJ),IF((((LLJX < 0) AND (ZJLL < 0)) AND (LLJX < ZJLL)),(0 - QZJJ),QZJJ))COLORWHITE,NODRAW;
力度:HSL / 1000,COLOR9B37FF,NODRAW;
周流量:SUM(LLJX,5),COLORFFBFDF,NODRAW;
BB:=REF(周流量,1);
ZQZJJ:=(周流量-BB)/BB*100;
周幅%:IF(周流量>0 AND BB<0,ABS(ZQZJJ),IF(周流量<0 AND BB<0 AND 周流量<BB,-ZQZJJ,ZQZJJ))COLORWHITE,NODRAW;
gd11060