#property copyright "Copyright © 2008, Limited Maintenance Trading" #property link "http://www.lmt-forex-forula.com" string gs_76 = ""; int gi_84 = 1; string gs_unused_88 = "D1"; int g_period_96 = 100; double gd_100 = 0.75; int gi_108 = 1; double gd_112 = 0.5; int gi_120 = 1; int gi_124 = 3; extern bool alert_enable_popup = TRUE; extern bool alert_enable_sound = TRUE; extern string alert_wav_filename = "alert.wav"; string gs_unused_144 = "lmt"; string gs_trigger_152 = "Trigger"; string gs_trend_160 = "Trend"; extern bool chart_background_black = FALSE; int gi_172 = 0; double gd_176 = 0.0; double gd_184 = 0.0; int gi_192 = 0; int get_timeframe_value(string as_0) { string ls_8 = StringTrimLeft(StringTrimRight(as_0)); if (ls_8 == "M1") return (1); if (ls_8 == "M5") return (5); if (ls_8 == "M15") return (15); if (ls_8 == "M30") return (30); if (ls_8 == "H1") return (60); if (ls_8 == "H4") return (240); if (ls_8 == "D1") return (1440); if (ls_8 == "W1") return (10080); if (ls_8 == "MN1") return (43200); return (-1); } int get_higher_timeframe(int ai_0) { string ls_4 = StringTrimLeft(StringTrimRight(gs_76)); if (ls_4 != "") return (get_timeframe_value(ls_4)); if (ai_0 == 1) return (5); if (ai_0 == 5) return (15); if (ai_0 == 15) return (30); if (ai_0 == 30) return (60); if (ai_0 == 60) return (240); if (ai_0 == 240) return (1440); if (ai_0 == 1440) return (10080); if (ai_0 == 10080) return (43200); return (-1); } int init() { return (0); } int deinit() { ObjectDelete("L.M.T.trends"); ObjectDelete("L.M.T.arrow"); ObjectDelete("L.M.T.stoploss"); ObjectDelete("L.M.T.firsttarget"); ObjectDelete("L.M.T.alert"); return (0); } int validate_display_monitor() { color l_color_8; color l_color_12; color l_color_16; int l_x_0 = 5; int l_y_4 = 15; if (chart_background_black) { l_color_8 = LightGreen; l_color_12 = Red; l_color_16 = LightBlue; } else { l_color_8 = Green; l_color_12 = Red; l_color_16 = Black; } if (ObjectFind("L.M.T.trends") == -1) { if (ObjectCreate("L.M.T.trends", OBJ_LABEL, 0, 0, 0)) { ObjectSet("L.M.T.trends", OBJPROP_XDISTANCE, l_x_0); ObjectSet("L.M.T.trends", OBJPROP_YDISTANCE, l_y_4 + 10); } } if (ObjectFind("L.M.T.arrow") == -1) { if (ObjectCreate("L.M.T.arrow", OBJ_LABEL, 0, 0, 0)) { ObjectSet("L.M.T.arrow", OBJPROP_XDISTANCE, l_x_0 + 160); ObjectSet("L.M.T.arrow", OBJPROP_YDISTANCE, l_y_4); } } string l_text_20 = "Trend Direction = "; string l_text_28 = ""; if (gi_172 == 1) { ObjectSetText("L.M.T.trends", l_text_20, 12, "Arial Black", l_color_8); l_text_28 = "é"; ObjectSet("L.M.T.arrow", OBJPROP_YDISTANCE, l_y_4 - 5); ObjectSetText("L.M.T.arrow", l_text_28, 24, "Wingdings", l_color_8); } else { if (gi_172 == 2) { ObjectSetText("L.M.T.trends", l_text_20, 12, "Arial Black", l_color_12); l_text_28 = "ê"; ObjectSet("L.M.T.arrow", OBJPROP_YDISTANCE, l_y_4); ObjectSetText("L.M.T.arrow", l_text_28, 24, "Wingdings", l_color_12); } } l_y_4 += 34; if (ObjectFind("L.M.T.stoploss") == -1) { if (ObjectCreate("L.M.T.stoploss", OBJ_LABEL, 0, 0, 0)) { ObjectSet("L.M.T.stoploss", OBJPROP_XDISTANCE, l_x_0); ObjectSet("L.M.T.stoploss", OBJPROP_YDISTANCE, l_y_4); } } string l_str_concat_36 = StringConcatenate("Stoploss = ", DoubleToStr(gd_176 / Point, 0), " pips"); ObjectSetText("L.M.T.stoploss", l_str_concat_36, 12, "Arial Black", l_color_16); l_y_4 += 24; if (ObjectFind("L.M.T.firsttarget") == -1) { if (ObjectCreate("L.M.T.firsttarget", OBJ_LABEL, 0, 0, 0)) { ObjectSet("L.M.T.firsttarget", OBJPROP_XDISTANCE, l_x_0); ObjectSet("L.M.T.firsttarget", OBJPROP_YDISTANCE, l_y_4); } } string l_str_concat_44 = StringConcatenate("First Target = ", DoubleToStr(gd_184 / Point, 0), " pips"); ObjectSetText("L.M.T.firsttarget", l_str_concat_44, 12, "Arial Black", l_color_16); l_y_4 += 24; if (ObjectFind("L.M.T.alert") == -1) { if (ObjectCreate("L.M.T.alert", OBJ_LABEL, 0, 0, 0)) { ObjectSet("L.M.T.alert", OBJPROP_XDISTANCE, l_x_0); ObjectSet("L.M.T.alert", OBJPROP_YDISTANCE, l_y_4); ObjectSet("L.M.T.alert", OBJPROP_YDISTANCE, l_y_4); } } string l_str_concat_52 = "Alert = "; if (alert_enable_popup) l_str_concat_52 = StringConcatenate(l_str_concat_52, "On"); else l_str_concat_52 = StringConcatenate(l_str_concat_52, "Off"); ObjectSetText("L.M.T.alert", l_str_concat_52, 12, "Arial Black", l_color_16); ObjectsRedraw(); return (0); } int start() { int li_60; double l_icustom_72; string ls_84; int l_timeframe_0 = Period(); int l_timeframe_4 = get_higher_timeframe(l_timeframe_0); int li_8 = gi_192; if (l_timeframe_4 == -1) { Print("[", "L.M.T", "] -", " ERROR: Trends highstoploss_atr_timeframeer timeframe is error"); return (0); } double l_icustom_12 = iCustom(Symbol(), l_timeframe_4, gs_trend_160, 0, gi_84); double l_icustom_20 = iCustom(Symbol(), l_timeframe_4, gs_trend_160, 1, gi_84); double l_icustom_28 = iCustom(Symbol(), l_timeframe_4, gs_trend_160, 2, gi_84); if (l_icustom_12 == EMPTY_VALUE) gi_172 = 2; else if (l_icustom_20 == EMPTY_VALUE) gi_172 = 1; gd_176 = iATR(Symbol(), get_timeframe_value(l_timeframe_0), g_period_96, gi_108) * gd_100; gd_184 = gd_176 * gd_112; double l_icustom_36 = iCustom(Symbol(), 0, gs_trigger_152, 0, gi_120); double l_icustom_44 = iCustom(Symbol(), 0, gs_trigger_152, 1, gi_120); double l_icustom_52 = iCustom(Symbol(), 0, gs_trigger_152, 2, gi_120); int li_64 = 0; if (l_icustom_36 == 0.0) { li_60 = 2; li_64 = 1; } else { if (l_icustom_44 == 0.0) { li_60 = 1; li_64 = 0; } } gi_192 = 1; if (gi_172 == li_60) { for (int li_68 = gi_120 + 1; li_68 <= gi_120 + gi_124; li_68++) { l_icustom_72 = iCustom(Symbol(), l_timeframe_0, gs_trigger_152, li_64, li_68); if (l_icustom_72 != 0.0) { gi_192 = 2; break; } } } else gi_192 = 2; validate_display_monitor(); bool li_80 = FALSE; if (High[0] == Low[0] && li_8 == 2 || li_8 == 0) if (gi_192 == 1) li_80 = TRUE; if (li_80) { Print("[", "L.M.T", StringConcatenate("] : Alert On ", TimeToStr(TimeCurrent()))); if (alert_enable_popup) Alert("LMT Signal on ", Symbol()); if (alert_enable_sound) { ls_84 = StringTrimLeft(StringTrimRight(alert_wav_filename)); if (ls_84 == "") ls_84 = "alert.wav"; PlaySound(ls_84); } } return (0); }