N:=10;
M:=1.5;
TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR1,N);
MEDIAN:= (HIGH + LOW) / 2;
UP:= MEDIAN+ATR * M;
DN:= MEDIAN-ATR * M;
TR2:=IF(C>REF(UP,1),1,IF(C<REF(DN,1),-1,TR1));
FLAG:=TR2<0 AND REF(TR2,1)>0;
FLAGH:=TR2>0 AND REF(TR2,1)<0;
DN1:=IF(TR2>0 AND DN<REF(DN,1),REF(DN,1),DN);
UP1:=IF(TR2<0 AND UP>REF(UP,1),REF(UP,1),UP);
UP2:=IF(FLAG,MEDIAN + ATR * M,UP1);
DN2:=IF(FLAGH,MEDIAN - ATR * M,DN1);
LSX1:IF(C>REF(UP2,1),DN2,DRAWNULL),LINETHICK2,COLORLIBLUE;
LSX2:IF(C<REF(DN2,1),UP2,DRAWNULL),COLORMAGENTA,LINETHICK2;
上述公式在通达信上测试通过,但没有线输出,不知道怎么回事,请高手指点,本人菜鸟一个,谢谢!
===========
将最后两句改成:
STICKLINE(C<REF(UP2,1),0,1,5,0),COLOR0000FF;
STICKLINE(C>REF(UP2,1),0,1,5,0),COLOR00FF00;
红灯停,绿灯行。
上一篇:通达信狄马克的黄金分割公式 下一篇:通达信筹码趋势副图公式