主力资金净流副图指标,本指标用来计算主力资金净流入
{计算主力资金净流入}{LARGEINTRDVOL逐笔买入大单成交量}{LARGEOUTTRDVOL}大单买入金额 := AMOUNT * (BUYVOL / VOL);大单卖出金额 := AMOUNT * (SELLVOL / VOL);{中单买入金额 := AMOUNT * ((TRANSACTVOL(0,2) - BUYVOL) / VOL);}{中单卖出金额 := AMOUNT * ((TRANSACTVOL(0,3) - SELLVOL) / VOL);}{主力资金净流入:(大单买入金额 + 中单买入金额 - 大单卖出金额 - 中单卖出金额)/10000,NODRAW;}主力资金净流入:=(LARGEINTRDVOL-LARGEOUTTRDVOL)*C;
{计算成交量放大倍数}成交量放大倍数:VOL / MA(VOL,5),NODRAW;
{MACD指标}DIF := EMA(CLOSE,12) - EMA(CLOSE,26);DEA := EMA(DIF,9);MACD := (DIF - DEA) * 2;
{OBV指标}VA := IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0));OBV := SUM(VA,0);
{均线多头排列判断}MA5 := MA(CLOSE,5);MA10 := MA(CLOSE,10);MA20 := MA(CLOSE,20);多头排列 := MA5>MA10 AND MA10>MA20 AND MA5>REF(MA5,1) AND MA10>REF(MA10,1) AND MA20>REF(MA20,1);
{ SAR指标}SARVALUE := SAR(4,2,20);SARCOLOR := IF(CLOSE>SARVALUE,1,0);
{绘制主力资金净流入柱状图}STICKLINE(主力资金净流入>0,0,主力资金净流入,3,0),COLORRED;STICKLINE(主力资金净流入<0,0,主力资金净流入,3,0),COLORGREEN;
{标注主力资金净流入数值}DRAWTEXT_FIX(ISLASTBAR,0,0,0,STRCAT('主力资金净流入:',CON2STR(主力资金净流入,2)));DRAWTEXT_FIX(ISLASTBAR,0,0.05,0,STRCAT('成交量放大倍数:',CON2STR(成交量放大倍数,2)));
{绘制MACD柱状线}STICKLINE(MACD>0,0,MACD,3,0),COLORYELLOW;STICKLINE(MACD<0,0,MACD,3,0),COLORCYAN;
{绘制OBV线}OBV线:OBV,COLORWHITE,NODRAW;
{绘制均线}MA5线:MA5,COLORYELLOW;MA10线:MA10,COLORMAGENTA;MA20线:MA20,COLORGREEN;
{绘制SAR点}DRAWICON(SARCOLOR=1,H*1.01,1);DRAWICON(SARCOLOR=0,L*0.99,2);
{标注提前介入信号}DRAWTEXT(主力资金净流入 > MA(主力资金净流入,5)*2 AND 成交量放大倍数 > 1.5 AND CROSS(DIF,DEA) AND OBV>REF(OBV,1) AND 多头排列 AND SARCOLOR=1 AND MACD>0, L*0.98,'提前介入'),COLORYELLOW;