#property indicator_separate_window #property indicator_buffers 5 #property indicator_color1 Yellow #property indicator_color2 LimeGreen #property indicator_color3 Red #property indicator_color4 Yellow #property indicator_color5 Aqua extern bool Crash = FALSE; extern int TimeFrame = 0; extern int Length = 2; extern int Method = 2; extern int Smoothing = 6; extern int Filter = 4; extern bool RealTime = TRUE; extern bool Steady = FALSE; extern bool Color = TRUE; extern bool Alerts = TRUE; extern bool EmailON = FALSE; extern bool SignalPrice = TRUE; extern color SignalPriceBUY = Yellow; extern color SignalPriceSELL = Aqua; extern int CountBars = 3000; double g_ibuf_136[]; double g_ibuf_140[]; double g_ibuf_144[]; double g_ibuf_148[]; double g_ibuf_152[]; double g_ibuf_156[]; double g_ibuf_160[]; bool gi_164 = FALSE; bool gi_168 = FALSE; int g_datetime_172 = 0; int g_datetime_176 = 0; int gi_180 = 0; int init() { string ls_4; IndicatorBuffers(8); SetIndexStyle(0, DRAW_LINE, STYLE_SOLID); SetIndexBuffer(0, g_ibuf_136); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID); SetIndexBuffer(1, g_ibuf_148); SetIndexStyle(2, DRAW_LINE, STYLE_SOLID); SetIndexBuffer(2, g_ibuf_152); SetIndexStyle(3, DRAW_ARROW); SetIndexArrow(3, 233); SetIndexBuffer(3, g_ibuf_156); SetIndexStyle(4, DRAW_ARROW); SetIndexArrow(4, 234); SetIndexBuffer(4, g_ibuf_160); SetIndexBuffer(5, g_ibuf_136); SetIndexBuffer(6, g_ibuf_144); SetIndexBuffer(7, g_ibuf_140); if (Length < 2) Length = 2; if (Method < MODE_SMA) Method = 0; if (Method > MODE_LWMA) Method = 3; if (Smoothing < 0) Smoothing = 0; if (Filter < 0) Filter = 0; if (TimeFrame < Period() && TimeFrame != 0) TimeFrame = Period(); switch (TimeFrame) { case 1: ls_4 = "M1"; break; case 5: ls_4 = "M5"; break; case 15: ls_4 = "M15"; break; case 30: ls_4 = "M30"; break; case 60: ls_4 = "H1"; break; case 240: ls_4 = "H4"; break; case 1440: ls_4 = "D1"; break; case 10080: ls_4 = "W1"; break; case 43200: ls_4 = "MN1"; break; default: ls_4 = ""; } string ls_12 = "FXENTRY100" + ls_4 + " | "; IndicatorShortName(ls_12); return (0); } int start() { int lia_52[]; int li_56; int l_index_60; string ls_64; if (Bars < 100) { IndicatorShortName("Bars less than 100"); return (0); } if (g_datetime_172 < iTime(NULL, TimeFrame, 0)) { gi_168 = FALSE; gi_164 = FALSE; g_datetime_172 = iTime(NULL, TimeFrame, 0); } if (!RealTime) { if (g_datetime_176 == iTime(NULL, TimeFrame, 0)) return (0); g_datetime_176 = iTime(NULL, TimeFrame, 0); gi_180 = TimeFrame / Period() + 1; if (gi_180 == 0) gi_180 = 1; } double ld_unused_0 = 0; double l_ima_8 = 0; double l_ima_16 = 0; double l_ima_24 = 0; double l_ima_32 = 0; double l_ima_40 = 0; if (CountBars > iBars(NULL, TimeFrame) || CountBars > Bars - Length - 1) CountBars = MathMin(Bars - Length - 1, iBars(NULL, TimeFrame) - Length - 1); if (Crash && CountBars > 0) { CountBars -= 10; IndicatorShortName("Crash: " + CountBars + " "); } if (Crash && CountBars < 0) IndicatorShortName("Crash"); int li_48 = CountBars; g_ibuf_136[li_48 + 1] = Close[li_48 + 1]; g_ibuf_140[li_48 + 1] = Close[li_48 + 1]; while (li_48 >= 0) { l_ima_8 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_HIGH, li_48); l_ima_16 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_LOW, li_48); l_ima_24 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_OPEN, li_48); l_ima_32 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_CLOSE, li_48); l_ima_40 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_CLOSE, li_48 + Smoothing); if (Steady == TRUE) { l_ima_32 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_MEDIAN, li_48); l_ima_40 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_MEDIAN, li_48 + Smoothing); } g_ibuf_136[li_48] = MathAbs(((l_ima_32 - l_ima_40) / MathMax(l_ima_8 - l_ima_16, MathMax(l_ima_8 - l_ima_40, l_ima_40 - l_ima_16)) + (l_ima_32 - l_ima_24) / (l_ima_8 - l_ima_16)) / 2.0) * ((l_ima_32 - l_ima_40 + (l_ima_32 - l_ima_24)) / 2.0); g_ibuf_136[li_48] = g_ibuf_136[li_48 + 1] + g_ibuf_136[li_48]; if (Filter > 0) if (MathAbs(g_ibuf_136[li_48] - (g_ibuf_136[li_48 + 1])) < Filter * Point) g_ibuf_136[li_48] = g_ibuf_136[li_48 + 1]; if (TimeFrame > Period()) g_ibuf_140[li_48] = g_ibuf_136[li_48]; li_48--; } if (TimeFrame > Period()) { ArrayCopySeries(lia_52, 5, Symbol(), TimeFrame); li_56 = CountBars + TimeFrame / Period(); li_48 = 0; l_index_60 = 0; while (li_48 < li_56) { if (Time[li_48] < lia_52[l_index_60]) l_index_60++; g_ibuf_136[li_48] = g_ibuf_140[l_index_60]; li_48++; } } for (li_48 = CountBars; li_48 >= 0; li_48--) { g_ibuf_144[li_48] = g_ibuf_144[li_48 + 1]; if (g_ibuf_136[li_48] - (g_ibuf_136[li_48 + 1]) > 0.0) g_ibuf_144[li_48] = 1; if (g_ibuf_136[li_48 + 1] - g_ibuf_136[li_48] > 0.0) g_ibuf_144[li_48] = -1; if (Color == TRUE) { if (g_ibuf_144[li_48] > 0.0) { g_ibuf_148[li_48] = g_ibuf_136[li_48]; if (g_ibuf_144[li_48 + 1] < 0.0) g_ibuf_148[li_48 + 1] = g_ibuf_136[li_48 + 1]; g_ibuf_152[li_48] = EMPTY_VALUE; } else { if (g_ibuf_144[li_48] < 0.0) { g_ibuf_152[li_48] = g_ibuf_136[li_48]; if (g_ibuf_144[li_48 + 1] > 0.0) g_ibuf_152[li_48 + 1] = g_ibuf_136[li_48 + 1]; g_ibuf_148[li_48] = EMPTY_VALUE; } } } if (Alerts == TRUE) { g_ibuf_156[li_48] = EMPTY_VALUE; g_ibuf_160[li_48] = EMPTY_VALUE; if (g_ibuf_144[li_48] == 1.0 && g_ibuf_144[li_48 + 1] == -1.0) g_ibuf_156[li_48] = g_ibuf_136[li_48 + 1] - (Ask - Bid); if (g_ibuf_144[li_48] == -1.0 && g_ibuf_144[li_48 + 1] == 1.0) g_ibuf_160[li_48] = g_ibuf_136[li_48 + 1] + (Ask - Bid); } } if (Alerts == TRUE) { if (g_ibuf_156[gi_180 + 0] != EMPTY_VALUE && gi_164 == FALSE) { ls_64 = "fxlive BUY: " + Symbol() + " - " + Period() + " at " + DoubleToStr(Close[0], Digits) + " - " + TimeToStr(TimeCurrent(), TIME_SECONDS); Alert(ls_64); if (EmailON) SendMail(ls_64, ls_64); if (SignalPrice == TRUE) { ObjectCreate("BUY SIGNAL: " + DoubleToStr(Time[0], 0), OBJ_ARROW, 0, Time[0], Close[0]); ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_ARROWCODE, SYMBOL_LEFTPRICE); ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_COLOR, SignalPriceBUY); } gi_168 = FALSE; gi_164 = TRUE; } if (g_ibuf_160[gi_180 + 0] != EMPTY_VALUE && gi_168 == FALSE) { ls_64 = "fxlive SELL: " + Symbol() + " - " + Period() + " at " + DoubleToStr(Close[0], Digits) + " - " + TimeToStr(TimeCurrent(), TIME_SECONDS); Alert(ls_64); if (EmailON) SendMail(ls_64, ls_64); if (SignalPrice == TRUE) { ObjectCreate("SELL SIGNAL: " + DoubleToStr(Time[0], 0), OBJ_ARROW, 0, Time[0], Close[0]); ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_ARROWCODE, SYMBOL_LEFTPRICE); ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_COLOR, SignalPriceSELL); } gi_164 = FALSE; gi_168 = TRUE; } } return (0); }