N:=5;
M:=60;
均价:=(0.618*(0.809*C+0.191*O)+0.382*(IF(H=C,C,H)+IF(L=C,C,L))/2);
LJ:=IF(CAPITAL,均价,AMOUNT/(V*100));
GZ:=(C*0.618+(WMA(LJ,3)+WMA(LJ,5))/2+WMA(LJ,8)*0.382)/2;
跟庄线:=(REF(GZ,2)+REF(GZ,1)+REF(GZ,0))/3,COLORWHITE,LINETHICK1;
GZX:=(WMA(LJ,8)*0.618+(WMA(LJ,13)+WMA(LJ,21))/2+WMA(LJ,34)*0.382)/2;
工作线:=(REF(GZX,2)+REF(GZX,1)+REF(GZX,0))/3;
价差:=IF(H=L,1/40,(MIN(LJ,GZ)-REF(MAX(LJ,GZ),1))/REF(LJ,1));
系数:=IF(H=L,1/4,(1/C+1/(H-L)*0.618+1/Abs(C-O)*0.382));
误差:=IF(H=L,1/REF(C,1)-1/O,1/C-1/O);
AI:=价差*AMOUNT;
历史AI:=HHV(REF(价差*AMOUNT,1),0);
配比:=1/历史AI*系数*2/((1/L-1/H)+SGN(LJ-REF(LJ,1))*误差)/1000;
活跃净额:AI/CAPITAL/10,NODRAW;
纠差净额:AI/历史AI*配比,NODRAW;
周净额:SUM(活跃净额,N),NODRAW;
月净额:SUM(活跃净额,22),NODRAW;
累计:(EMA(活跃净额,13)+EMA(活跃净额,26)+EMA(活跃净额,42)+EMA(活跃净额,M))/4*20,RGB(128,0,128),COLORRED;
均值:EMA(累计,10),COLORWHITE;
STICKLINE(活跃净额>0,0,活跃净额,3,0),COLORRED;
STICKLINE(活跃净额<0,0,活跃净额,3,0),COLORGREEN;