资源描述:
《均线交叉报警.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、1.#propertyindicator_chart_window2.#propertyindicator_buffers43.#propertyindicator_color1Yellow4.#propertyindicator_color2White5.#propertyindicator_color3Yellow6.#propertyindicator_color4White7.8.//----inputparameters9.externint均线周期1=10;10.externint均线周期2=130;11.exter
2、nint类型1=1;//类型:0-SMA;1-EMA;2-SMMA;3-LWMA12.externint类型2=1;//类型:0-SMA;1-EMA;2-SMMA;3-LWMA13.externstring类型说明="0-SMA;1-EMA;2-SMMA;3-LWMA";14.externint文字水平=0;15.externint文字垂直=0;16.externint文字大小=14;17.externstring文字标识="1";18.externcolor文字颜色=Yellow;19.externint是否报警=1;20.e
3、xternint是否发邮件=1;21.//----buffers22.doubleMa10[];1.doubleMa130[];2.doubleUp[];3.doubleDown[];4.intTimeInMinute;5.intFlagAlert=0;6.//+------------------------------------------------------------------+7.//
4、Customindicatorinitializationfunction
5、8.//+--------------------
6、----------------------------------------------+9.intinit()10.{11.//----indicators12.IndicatorBuffers(4);13.SetIndexStyle(0,DRAW_LINE);14.SetIndexStyle(1,DRAW_LINE); 15.SetIndexStyle(2,DRAW_ARROW);16.SetIndexStyle(3,DRAW_ARROW); 17.SetIndexBuffer(0,Ma10);18.SetIndexBu
7、ffer(1,Ma130);19.SetIndexBuffer(2,Up);20.SetIndexBuffer(3,Down);21.SetIndexArrow(2,233);22.SetIndexArrow(3,234);1.TimeInMinute=0;2.//----3.return(0);4.}5.6.intstart()7.{ 8.inti; 9.intlimit;10.stringSignal;11.intcounted_bars=IndicatorCounted();12.//----checkforpossibl
8、eerrors13.if(counted_bars<0)return(-1);14.//----thelastcountedbarwillberecounted15.if(counted_bars>0)counted_bars--;16.limit=Bars-counted_bars; 17.for(i=limit-1;i>=0;i--)18.{19.Ma10[i]=iMA(NULL,0,均线周期1,0,类型1,PRICE_CLOSE,i);20.Ma130[i]=iMA(NULL,0,均线周期2,0,类型2,PRICE_CLO
9、SE,i);1.if((Ma10[i+1]Ma130[i])&&(Close[i]>Ma10[i])&&(Close[i]>Ma130[i]))2.{3.Signal="["+Period()+"分钟]"+TimeMonth(Time[i]+TimeInMinute)+"月"+TimeDay(Time[i]+TimeInMinute)+"日"+TimeHour(Time[i]+TimeInMinute)+"点"+TimeMinute(Time[i]+TimeInMinute)+"分"
10、+Symbol()+"在价格"+DoubleToStr(Close[i],4)+"发生"+均线周期1+"均线上穿"+均线周期2+"均线"; 4.writetext(文字标识,Signal,20+文字水平,40+文字垂直,文字颜色,文字大小);5.Up[i]=Lo