同花顺主力动向公式
r0:=((IF(ISNULL(ZDMR[-1]),0,ZDMR)+IF(ISNULL(BDMR[-1]),0,BDMR))-(IF(ISNULL(ZDMC[-1]),0,ZDMC)+IF(ISNULL(BDMC[-1]),0,BDMC)))/SHGZG*100;
MA5:=MA(r0,5);
中位线:=1.75;
最小值:=LLV(LOW,10);
最大值:=HHV(HIGH,25);
波动线:=EMA((CLOSE-最小值)/(最大值-最小值)*4,4);
平均线=EMA(波动线,3);
PARTLINE(0,平均线>=REF(平均线,1),colorred,平均线<REF(平均线,1),colorgreen);
主力动能:=MA(r0,5);
主力攻击:r0-(ABS(REF(r0,1))+ABS(REF(r0,2))+ABS(REF(r0,3))+ABS(REF(r0,4))+ABS(REF(r0,5))/2)>0 AND 平均线>=REF(平均线,1) AND REF(平均线,1)<REF(平均线,2);
主力撤退:-((r0+(ABS(REF(r0,1))+ABS(REF(r0,2))+ABS(REF(r0,3))+ABS(REF(r0,4))+ABS(REF(r0,5))/2)<0) AND 平均线<=REF(平均线,1) AND REF(平均线,1)>REF(平均线,2));
DRAWTEXT(主力攻击>0,1.3*主力攻击,"主力攻击"),colorred;
DRAWTEXT(主力撤退<0,1.3*主力撤退,"主力撤退"),colorgreen;