#property indicator_chart_window extern int 警戒均线=20; int mark=0; int start() { if( iHigh(0,0,0) >= iMA(0,0,警戒均线,0,MODE_SMA,PRICE_CLOSE,0) && iHigh(0,0,1) < iMA(0,0,警戒均线,0,MODE_SMA,PRICE_CLOSE,1) && mark != 1 ) { Alert(Symbol(),"向上触及20均线"); mark = 1; } if( iLow(0,0,0) <= iMA(0,0,警戒均线,0,MODE_SMA,PRICE_CLOSE,0) && iLow(0,0,1) > iMA(0,0,警戒均线,0,MODE_SMA,PRICE_CLOSE,1) && mark != 2 ) { Alert(Symbol(),"向下触及20均线",警戒均线,"均线"); mark = 2; } return(0); }