//+------------------------------------------------------------------+ //| Sample7_Ind.mq4 | //| Copyright ゥ 2006, Toyolab FX | //| http://forex.toyolab.com | //+------------------------------------------------------------------+ #property copyright "Copyright ゥ 2006, Toyolab FX" #property link "http://forex.toyolab.com" #property indicator_chart_window #property indicator_buffers 1 //---- パラメータ extern double Alert_Price=0; //---- インディケータバッファ double Buf0[]; //+------------------------------------------------------------------+ //| インディケータ初期化関数 | //+------------------------------------------------------------------+ int init() { //---- バッファのインディケータへの割り当て SetIndexBuffer(0, Buf0); //---- インディケータの種類の設定 SetIndexStyle(0, DRAW_LINE, STYLE_DOT, 1, Red); return(0); } //+------------------------------------------------------------------+ //| インディケータ処理関数 | //+------------------------------------------------------------------+ int start() { Comment("LocalTime : ", TimeToStr(LocalTime()+9*60*60,TIME_DATE|TIME_SECONDS), "\n", "AlertPrice=", Alert_Price); if(Alert_Price == 0) return(0); //アラートプライス未設定 int limit=Bars-IndicatorCounted(); for(int i=limit-1; i>=0; i--) { Buf0[i] = Alert_Price; //アラートプライスのライン } if(Close[1] < Alert_Price && Close[0] >= Alert_Price) //クロスアップ { Alert(Symbol(), " hit ", Alert_Price); //アラート表示 SendMail("Mail Alert", Symbol()+" hit "+DoubleToStr(Alert_Price,Digits)); Alert_Price = 0; // アラートのクリア } if(Close[1] > Alert_Price && Close[0] <= Alert_Price) //クロスダウン { Alert(Symbol(), " hit ", Alert_Price); //アラート表示 SendMail("Mail Alert", Symbol()+" hit "+DoubleToStr(Alert_Price,Digits)); Alert_Price = 0; //アラートのクリア } return(0); } //+------------------------------------------------------------------+