//-------------------------------------------------------------------- // FTL_TrendLine_Alerm.mq4 // // Copyright(C)2009, ForexTradingLaboratory // http://www.ftlabo.com/index.php // ono@ftlabo.com // Rev.000 //-------------------------------------------------------------------- #property copyright "Copyright(C)2009, ForexTradingLaboratory" #property link "http://www.ftlabo.com/index.php" #property indicator_chart_window #include #include #define MY_OPENPOS 6 #define MY_LIMITPOS 7 #define MY_STOPPOS 8 #define MY_PENDPOS 9 #define MY_BUYPOS 10 #define MY_SELLPOS 11 #define MY_ALLPOS 12 extern string Copyright = "Copyright(C)2009, ForexTradingLaboratory"; extern string URL = "http://www.ftlabo.com/index.php"; extern string EMail = "ono@ftlabo.com"; extern string explanation1 = "※初期位置の設定は最新のクローズ値からのPointの差です"; extern string explanation2 = "※初期値の+,-で発注の基準が変わります"; extern string explanation3 = "※初期値+:チャートがラインの上にくると動作"; extern string explanation4 = "※初期値-:チャートがラインの下にくると動作"; extern string explanation5 = "Line1の初期位置"; extern int Line1InitialPoint = 100; extern string explanation6 = "Line2の初期位置"; extern int Line2InitialPoint = -100; extern string explanation7 = "トレンドラインの長さ[ローソク足の期間]"; extern int Length = 60; extern string explanation8 = "鳴らす音のファイルの場所"; extern string AlertSound = "alert.wav"; // 注文時の矢印の色 color ArrowColor[6] = {Blue, Red, Blue, Red, Blue, Red}; //---------------------------------------------------------------------------// // トレンドラインの表示 // //---------------------------------------------------------------------------// int init() { ObjectCreate("Line1",OBJ_TREND,0,Time[Length],Close[0]+Line1InitialPoint*Point,Time[0],Close[0]+Line1InitialPoint*Point); ObjectSet("Line1",OBJPROP_COLOR,Red); ObjectSet("Line1",OBJPROP_WIDTH,1); ObjectCreate("Line2",OBJ_TREND,0,Time[Length],Close[0]+Line2InitialPoint*Point,Time[0],Close[0]+Line2InitialPoint*Point); ObjectSet("Line2",OBJPROP_COLOR,Blue); ObjectSet("Line2",OBJPROP_WIDTH,1); Print(ObjectGetValueByShift("Line1",0)); Print(ObjectGetValueByShift("Line2",0)); return(0); } //---------------------------------------------------------------------------// // トレンドラインの削除 // //---------------------------------------------------------------------------// int deinit() { ObjectDelete("Line1"); ObjectDelete("Line2"); return(0); } //---------------------------------------------------------------------------// // チャートがトレンドラインラインを超えたら警告 // //---------------------------------------------------------------------------// int start() { //Line1 if((Line1InitialPoint>0 && Close[0]>ObjectGetValueByShift("Line1",0)) || (Line1InitialPoint<0 && Close[0]0 && Close[0]>ObjectGetValueByShift("Line2",0)) || (Line2InitialPoint<0 && Close[0]