X1:=MIN(COUNT(TRADEOUTNUM>0,0),21);
X2:=MIN(COUNT(TRADEOUTNUM>0,0)/3,21);
T1:=LARGEINTRDVOL/V;
T2:=EMA(T1,X2);
FYJD:=IF(V>0,T1-T2,0),NODRAW;
Z1:=EMA(FYJD,X1)*X1;
Z2:=MA(Z1,7);
AYJD:=Z1-Z2;
JE:=L2_AMO(0,0)+L2_AMO(1,0)-L2_AMO(0,1)-L2_AMO(1,1);{当日主力净流入}
LJ:=SUM(JE,5)/10000;{5日主力累计净流入}
资金研究度:FYJD,NODRAW;
平均研究度:AYJD,NODRAW;
连续飘红:BARSLASTCOUNT(FYJD>0),NODRAW;
N日飘红:COUNT(FYJD>0,N),COLORRED,NODRAW;
NOTEXT1:IF(AYJD>=0,AYJD,DRAWNULL),COLORRED;{平均研究度画自适应红绿色线}
NOTEXT21:IF(AYJD<0,AYJD,DRAWNULL),COLORGREEN;{平均研究度画自适应红绿色线}
{资金研究度画柱状图}
STICKLINE(FYJD>=0,FYJD,0,2.6,0),COLORRED;
STICKLINE(FYJD<0,FYJD,0,2.6,0),COLORGREEN;
{AI研究定义分类}
M1:=AYJD>0 AND COUNT(FYJD>0,6)>3 AND BARSLASTCOUNT(FYJD>0)>=3;
M2:=AYJD>0 AND COUNT(FYJD>0,6)>3 AND BARSLASTCOUNT(FYJD>0)<3;
M3:=AYJD>0 AND COUNT(FYJD>0,6)=3 AND COUNT(FYJD>0,4)>=2;
M4:=AYJD>0 AND COUNT(FYJD>0,6)>=1 AND COUNT(FYJD>0,6)<3 AND COUNT(FYJD>0,3)>=2;
M5:=AYJD>0 AND COUNT(FYJD>0,6)>=1 AND COUNT(FYJD>0,6)<3 AND COUNT(FYJD>0,3)<2 AND BARSLASTCOUNT(FYJD<0)<=2;
M6:=AYJD>0 AND COUNT(FYJD>0,6)<=2 AND BARSLASTCOUNT(FYJD<0)>2;
L1:=AYJD<=0 AND COUNT(FYJD>0,6)<=3 AND BARSLASTCOUNT(FYJD<0)>=3;
L2:=AYJD<=0 AND COUNT(FYJD>0,6)<=3 AND BARSLASTCOUNT(FYJD<0)=2;
L3:=AYJD<=0 AND COUNT(FYJD>0,6)>3 AND BARSLASTCOUNT(FYJD<0)<2;
L4:=AYJD<=0 AND COUNT(FYJD>0,6)<=3 AND BARSLASTCOUNT(FYJD<0)<2;
{输出AI研究}
DRAWTEXT_FIX(ISLASTBAR AND M1,0,0,0,'近期大资金非常活跃;主力资金5日累计净流入:');
DRAWTEXT_FIX(ISLASTBAR AND M2,0,0,0,'近期大资金总体相对活跃;主力资金5日累计净流入:');
DRAWTEXT_FIX(ISLASTBAR AND M3,0,0,0,'近期大资金总体偏多,虽不活跃,但有异动,宜关注大资金的持续性;主力资金5日累计净流入:');
DRAWTEXT_FIX(ISLASTBAR AND M4,0,0,0,'近期大资金总体由空转多,近两日出现异动,关注其持续性;主力资金5日累计净流入:');
DRAWTEXT_FIX(ISLASTBAR AND M5,0,0,0,'近期大资金虽有异动,但持续性不强,总体偏空;主力资金5日累计净流入:');
DRAWTEXT_FIX(ISLASTBAR AND M6,0,0,0,'近期大资金持续偏空态势,多方不活跃;主力资金5日累计净流入:');
DRAWTEXT_FIX(ISLASTBAR AND L1,0,0,0,'近期大资金关注度较低,明显弱势;主力资金5日累计净流入:');
DRAWTEXT_FIX(ISLASTBAR AND L2,0,0,0,'近期大资金总体偏空,虽有异动,但不太活跃;主力资金5日累计净流入:');
DRAWTEXT_FIX(ISLASTBAR AND L3,0,0,0,'总体看前几日大资金有关注,但近日持续性逐步降低,股价面临方向选择;主力资金5日累计净流入:');
DRAWTEXT_FIX(ISLASTBAR AND L4,0,0,0,'近期大资金总体偏空,异动不明显,偏弱势;主力资金5日累计净流入:');
{AI研究集合}
ZH1:=M1 OR M2 OR M3 OR M4 OR M5 OR M6;
ZH2:=L1 OR L2 OR L3 OR L4;
{5日累计净流入输出位置}
SZ1:=IF(M1,0.220,IF(M2,0.242,IF(M3,0.439,IF(M4,0.397,IF(M5,0.345,IF(M6,0.303,DRAWNULL))))));
SZ2:=IF(L1,0.283,IF(L2,0.335,IF(L3,0.460,IF(L4,0.324,DRAWNULL))));
DRAWNUMBER_FIX(ISLASTBAR AND ZH1,SZ1,0,0,LJ);
DRAWNUMBER_FIX(ISLASTBAR AND ZH2,SZ2,0,0,LJ);
{LJ>0}
A1:=LJ>0 AND LJ<=0.9999;
A2:=LJ>0.9999 AND LJ<=9.9999;
A3:=LJ>9.9999 AND LJ<=99.9999;
A4:=LJ>99.9999 AND LJ<=999.9999;
A5:=LJ>999.9999 AND LJ<=9999.9999;
A6:=LJ>9999.9999 AND LJ<=99999.9999;
A7:=LJ>99999.9999;
{LJ<0}
P1:=LJ<0 AND LJ>=-0.9999;
P2:=LJ<-0.9999 AND LJ>=-9.9999;
P3:=LJ<-9.9999 AND LJ>=-99.9999;
P4:=LJ<-99.9999 AND LJ>=-999.9999;
P5:=LJ<-999.9999 AND LJ>=-9999.9999;
P6:=LJ<-9999.9999 AND LJ>=-99999.9999;
P7:=LJ<-99999.9999;
{单位'万元'的输出位置};
{AYJD>0}
ZM1:=IF(M1 AND A1,0.242,IF(M1 AND A2,0.248,IF(M1 AND A3,0.254,IF(M1 AND A4,0.260,IF(M1 AND A5,0.266,IF(M1 AND A6,0.272,IF(M1 AND A7,0.278,DRAWNULL)))))));
FM1:=IF(M1 AND P1,0.246,IF(M1 AND P2,0.252,IF(M1 AND P3,0.258,IF(M1 AND P4,0.264,IF(M1 AND P5,0.270,IF(M1 AND P6,0.272,IF(M1 AND P7,0.278,DRAWNULL)))))));
ZM2:=IF(M2 AND A1,0.264,IF(M2 AND A2,0.270,IF(M2 AND A3,0.276,IF(M2 AND A4,0.282,IF(M2 AND A5,0.288,IF(M2 AND A6,0.294,IF(M2 AND A7,0.230,DRAWNULL)))))));
FM2:=IF(M2 AND P1,0.268,IF(M2 AND P2,0.274,IF(M2 AND P3,0.280,IF(M2 AND P4,0.286,IF(M2 AND P5,0.292,IF(M2 AND P6,0.298,IF(M2 AND P7,0.234,DRAWNULL)))))));
ZM3:=IF(M3 AND A1,0.461,IF(M3 AND A2,0.467,IF(M3 AND A3,0.473,IF(M3 AND A4,0.479,IF(M3 AND A5,0.485,IF(M3 AND A6,0.491,IF(M3 AND A7,0.497,DRAWNULL)))))));
FM3:=IF(M3 AND P1,0.465,IF(M3 AND P2,0.471,IF(M3 AND P3,0.477,IF(M3 AND P4,0.483,IF(M3 AND P5,0.489,IF(M3 AND P6,0.495,IF(M3 AND P7,0.501,DRAWNULL)))))));
ZM4:=IF(M4 AND A1,0.419,IF(M4 AND A2,0.425,IF(M4 AND A3,0.431,IF(M4 AND A4,0.437,IF(M4 AND A5,0.443,IF(M4 AND A6,0.449,IF(M4 AND A7,0.455,DRAWNULL)))))));
FM4:=IF(M4 AND P1,0.423,IF(M4 AND P2,0.429,IF(M4 AND P3,0.435,IF(M4 AND P4,0.441,IF(M4 AND P5,0.447,IF(M4 AND P6,0.453,IF(M4 AND P7,0.459,DRAWNULL)))))));
ZM5:=IF(M5 AND A1,0.367,IF(M5 AND A2,0.373,IF(M5 AND A3,0.379,IF(M5 AND A4,0.385,IF(M5 AND A5,0.391,IF(M5 AND A6,0.397,IF(M5 AND A7,0.403,DRAWNULL)))))));
FM5:=IF(M5 AND P1,0.371,IF(M5 AND P2,0.377,IF(M5 AND P3,0.383,IF(M5 AND P4,0.389,IF(M5 AND P5,0.395,IF(M5 AND P6,0.401,IF(M5 AND P7,0.407,DRAWNULL)))))));
ZM6:=IF(M6 AND A1,0.325,IF(M6 AND A2,0.331,IF(M6 AND A3,0.337,IF(M6 AND A4,0.343,IF(M6 AND A5,0.349,IF(M6 AND A6,0.355,IF(M6 AND A7,0.361,DRAWNULL)))))));
FM6:=IF(M6 AND P1,0.329,IF(M6 AND P2,0.335,IF(M6 AND P3,0.341,IF(M6 AND P4,0.347,IF(M6 AND P5,0.353,IF(M6 AND P6,0.359,IF(M6 AND P7,0.365,DRAWNULL)))))));
{AYJD<0}
ZL1:=IF(L1 AND A1,0.305,IF(L1 AND A2,0.311,IF(L1 AND A3,0.317,IF(L1 AND A4,0.323,IF(L1 AND A5,0.329,IF(L1 AND A6,0.335,IF(L1 AND A7,0.341,DRAWNULL)))))));
FL1:=IF(L1 AND P1,0.309,IF(L1 AND P2,0.315,IF(L1 AND P3,0.321,IF(L1 AND P4,0.327,IF(L1 AND P5,0.333,IF(L1 AND P6,0.339,IF(L1 AND P7,0.345,DRAWNULL)))))));
ZL2:=IF(L2 AND A1,0.356,IF(L2 AND A2,0.362,IF(L2 AND A3,0.368,IF(L2 AND A4,0.374,IF(L2 AND A5,0.380,IF(L2 AND A6,0.386,IF(L2 AND A7,0.392,DRAWNULL)))))));
FL2:=IF(L2 AND P1,0.360,IF(L2 AND P2,0.366,IF(L2 AND P3,0.372,IF(L2 AND P4,0.378,IF(L2 AND P5,0.384,IF(L2 AND P6,0.390,IF(L2 AND P7,0.396,DRAWNULL)))))));
ZL3:=IF(L3 AND A1,0.481,IF(L3 AND A2,0.487,IF(L3 AND A3,0.493,IF(L3 AND A4,0.499,IF(L3 AND A5,0.505,IF(L3 AND A6,0.511,IF(L3 AND A7,0.517,DRAWNULL)))))));
FL3:=IF(L3 AND P1,0.485,IF(L3 AND P2,0.491,IF(L3 AND P3,0.497,IF(L3 AND P4,0.503,IF(L3 AND P5,0.509,IF(L3 AND P6,0.515,IF(L3 AND P7,0.521,DRAWNULL)))))));
ZL4:=IF(L4 AND A1,0.346,IF(L4 AND A2,0.352,IF(L4 AND A3,0.358,IF(L4 AND A4,0.364,IF(L4 AND A5,0.370,IF(L4 AND A6,0.376,IF(L4 AND A7,0.382,DRAWNULL)))))));
FL4:=IF(L4 AND P1,0.350,IF(L4 AND P2,0.356,IF(L4 AND P3,0.362,IF(L4 AND P4,0.368,IF(L4 AND P5,0.374,IF(L4 AND P6,0.380,IF(L4 AND P7,0.386,DRAWNULL)))))));
{聚合}
JK1:=IF(M1 AND LJ>0,ZM1,IF(M2 AND LJ>0,ZM2,IF(M3 AND LJ>0,ZM3,IF(M4 AND LJ>0,ZM4,IF(M5 AND LJ>0,ZM5,IF(M6 AND LJ>0,ZM6,DRAWNULL))))));
JK2:=IF(M1 AND LJ<0,FM1,IF(M2 AND LJ<0,FM2,IF(M3 AND LJ<0,FM3,IF(M4 AND LJ<0,FM4,IF(M5 AND LJ<0,FM5,IF(M6 AND LJ<0,FM6,DRAWNULL))))));
CK1:=IF(L1 AND LJ>0,ZL1,IF(L2 AND LJ>0,ZL2,IF(L3 AND LJ>0,ZL3,IF(L4 AND LJ>0,ZL4,DRAWNULL))));
CK2:=IF(L1 AND LJ<0,FL1,IF(L2 AND LJ<0,FL2,IF(L3 AND LJ<0,FL3,IF(L4 AND LJ<0,FL4,DRAWNULL))));
{输出单位'万元'}
DRAWTEXT_FIX(ISLASTBAR AND LJ>0 AND M1,JK1,0,0,'万元,主力控盘强 。');
DRAWTEXT_FIX(ISLASTBAR AND LJ<0 AND M1,JK2,0,0,'万元,主力控盘强 。');
DRAWTEXT_FIX(ISLASTBAR AND ZH1 AND LJ>0 AND M1=0,JK1,0,0,'万元,主力控盘弱 。');
DRAWTEXT_FIX(ISLASTBAR AND ZH1 AND LJ<0 AND M1=0,JK2,0,0,'万元,主力控盘弱 。');
DRAWTEXT_FIX(ISLASTBAR AND ZH2 AND LJ>0,CK1,0,0,'万元,主力控盘弱 。');
DRAWTEXT_FIX(ISLASTBAR AND ZH2 AND LJ<0,CK2,0,0,'万元,主力控盘弱 。');