#property copyright "Copyright © 2008 nasatajrie@yahoo.com " #property link "nasatajrie@yahoo.com" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 RoyalBlue #property indicator_color3 Red extern int Fibo = 0; extern int LPrice = 0; extern int HiPrice = 0; extern int Price = 0; extern int Length = 30; extern int Displace = 0; extern int Filter = 0; extern int Color = 1; extern int ColorBarBack = 0; extern double Deviation = 0.0; extern int SoundAlertMode = 1; double gd_124 = 4.0; double g_ibuf_132[]; double g_ibuf_136[]; double g_ibuf_140[]; double g_ibuf_144[]; double g_ibuf_148[]; bool gi_152 = FALSE; bool gi_156 = FALSE; int init() { int li_unused_0 = 0; IndicatorBuffers(5); SetIndexStyle(0, DRAW_ARROW); SetIndexBuffer(0, g_ibuf_132); SetIndexStyle(1, DRAW_ARROW); SetIndexBuffer(1, g_ibuf_136); SetIndexStyle(2, DRAW_ARROW); SetIndexBuffer(2, g_ibuf_140); SetIndexBuffer(3, g_ibuf_144); SetIndexBuffer(4, g_ibuf_148); IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS)); SetIndexArrow(0, 159); SetIndexArrow(1, 159); SetIndexArrow(2, 159); SetIndexArrow(3, 159); string ls_4 = "GreatTrader NLD(" + Length + ")"; IndicatorShortName(ls_4); SetIndexLabel(0, "NLD"); SetIndexLabel(1, "Up"); SetIndexLabel(2, "Dn"); SetIndexShift(0, Displace); SetIndexShift(1, Displace); SetIndexShift(2, Displace); SetIndexDrawBegin(0, Length * gd_124 + Length); SetIndexDrawBegin(1, Length * gd_124 + Length); SetIndexDrawBegin(2, Length * gd_124 + Length); return (0); } int start() { int li_12; double ld_16; double ld_24; double ld_32; double ld_40; double ld_48; double ld_64; string ls_100; int l_ind_counted_8 = IndicatorCounted(); double ld_72 = 3.1415926535; double ld_80 = 3.0 * ld_72; int li_88 = Length - 1; double ld_92 = Length * gd_124 + li_88; if (l_ind_counted_8 > 0) li_12 = Bars - l_ind_counted_8; if (l_ind_counted_8 < 0) return (0); if (l_ind_counted_8 == 0) li_12 = Bars - ld_92 - 1.0; if (l_ind_counted_8 < 1) { for (int l_index_0 = 1; l_index_0 < Length * gd_124 + Length; l_index_0++) { g_ibuf_132[Bars - l_index_0] = 0; g_ibuf_136[Bars - l_index_0] = 0; g_ibuf_140[Bars - l_index_0] = 0; } } for (int li_4 = li_12; li_4 >= 0; li_4--) { ld_48 = 0; ld_40 = 0; ld_32 = 0; for (l_index_0 = 0; l_index_0 <= ld_92 - 1.0; l_index_0++) { ld_64 = 1.0 / (ld_80 * ld_32 + 1.0); if (ld_32 <= 0.5) ld_64 = 1; ld_24 = MathCos(ld_72 * ld_32); ld_16 = ld_64 * ld_24; g_ibuf_144[l_index_0] = iMA(NULL, 0, 1, 0, MODE_SMA, Price, li_4 + l_index_0); ld_40 += ld_16 * g_ibuf_144[l_index_0]; ld_48 += ld_16; if (ld_32 < 1.0) ld_32 += 1.0 / (li_88 - 1); else if (ld_32 < ld_92 - 1.0) ld_32 += (2.0 * gd_124 - 1.0) / (gd_124 * Length - 1.0); } if (ld_48 > 0.0) g_ibuf_132[li_4] = (Deviation / 100.0 + 1.0) * ld_40 / ld_48; if (Filter > 0) if (MathAbs(g_ibuf_132[li_4] - (g_ibuf_132[li_4 + 1])) < Filter * Point) g_ibuf_132[li_4] = g_ibuf_132[li_4 + 1]; if (Color > 0) { g_ibuf_148[li_4] = g_ibuf_148[li_4 + 1]; if (g_ibuf_132[li_4] - (g_ibuf_132[li_4 + 1]) > Filter * Point) g_ibuf_148[li_4] = 1; if (g_ibuf_132[li_4 + 1] - g_ibuf_132[li_4] > Filter * Point) g_ibuf_148[li_4] = -1; if (g_ibuf_148[li_4] > 0.0) { g_ibuf_136[li_4] = g_ibuf_132[li_4]; if (g_ibuf_148[li_4 + ColorBarBack] < 0.0) g_ibuf_136[li_4 + ColorBarBack] = g_ibuf_132[li_4 + ColorBarBack]; g_ibuf_140[li_4] = EMPTY_VALUE; } if (g_ibuf_148[li_4] < 0.0) { g_ibuf_140[li_4] = g_ibuf_132[li_4]; if (g_ibuf_148[li_4 + ColorBarBack] > 0.0) g_ibuf_140[li_4 + ColorBarBack] = g_ibuf_132[li_4 + ColorBarBack]; g_ibuf_136[li_4] = EMPTY_VALUE; } } } if (g_ibuf_148[2] < 0.0 && g_ibuf_148[1] > 0.0 && Volume[0] > 1.0 && !gi_152) { ls_100 = " " + Symbol() + " M" + Period() + ": Up Trend Alert"; if (SoundAlertMode > 0) Alert(ls_100); gi_152 = TRUE; gi_156 = FALSE; } if (g_ibuf_148[2] > 0.0 && g_ibuf_148[1] < 0.0 && Volume[0] > 1.0 && !gi_156) { ls_100 = " " + Symbol() + " M" + Period() + ": Down Trend Alert"; if (SoundAlertMode > 0) Alert(ls_100); gi_156 = TRUE; gi_152 = FALSE; } return (0); }