N:=10;
VAR1:=vol/((HIGH-LOW)*2-Abs(CLOSE-OPEN));
主买:=IF(CLOSE>OPEN,VAR1*(HIGH-LOW),IF(CLOSE<OPEN,VAR1*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2));
主卖:=IF(CLOSE>OPEN,VAR1*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,VAR1*(HIGH-LOW),VOL/2));
净入:=主买-主卖;
周期:=FILTER(h,N-1);
周期数:BArslAST(周期)+1,LINETHICK0;
买差n天:ABS(SUM(主买,周期数)),Color0000FF,LINETHICK0;
卖差n天:ABS(SUM(主卖,周期数)),Color00FF00,LINETHICK0;
净入n天:(SUM(净入,周期数)),ColorB233FF,LINETHICK0;
STICKLINE(买差n天,O,买差n天,6,0),Color0000FF;
STICKLINE(卖差n天,O,卖差n天,6,0),Color00FF00;
STICKLINE(净入n天>0,O,净入n天,6,0),ColorB233FF;
STICKLINE(净入n天<0,O,净入n天,6,0),Color00FFFF;