网友求助:

参数设置.3..2..在PDI从下往上穿过MDI,且同时ADX.ADXR在PDI之上,
在达到以上条件下,(ADX从下往上穿过ADXR)作一预警买入公式,谢谢老师

 

解答如下:

N:=3;M:=2;
TR := SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),N);
HD := HIGH-REF(HIGH,1);
LD := REF(LOW,1)-LOW;
DMP:= SUM(IF(HD>0 AND HD>LD,HD,0),N);
DMM:= SUM(IF(LD>0 AND LD>HD,LD,0),N);
PDI:=DMP*100/TR;
MDI:=DMM*100/TR;
ADX:=MA(ABS(MDI-PDI)/(MDI+PDI)*100,M);
ADXR:=(ADX+REF(ADX,M))/2;
CROSS(PDI,MDI) AND ADX>PDI AND ADXR>PDI AND CROSS(ADX,ADXR);