Time: 2018-12-27 | Download file:zigzag_luck~.mq4
#property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 SlateGray #property indicator_color2 Red #property indicator_color3 Blue extern int barn = 300; extern int Length = 12; extern string Website = "www.fxautorobot.com"; extern string icq = "413-535-697"; extern string poshta = "fxautorobot@mail.ru"; double G_ibuf_108[]; double G_ibuf_112[]; double G_ibuf_116[]; int init() { SetIndexEmptyValue(0, 0.0); SetIndexLabel(0, "ZigZag"); SetIndexStyle(0, DRAW_SECTION); SetIndexBuffer(0, G_ibuf_108); SetIndexEmptyValue(1, EMPTY_VALUE); SetIndexLabel(1, "Sell"); SetIndexStyle(1, DRAW_ARROW); SetIndexBuffer(1, G_ibuf_116); SetIndexEmptyValue(2, EMPTY_VALUE); SetIndexLabel(2, "Buy"); SetIndexStyle(2, DRAW_ARROW); SetIndexBuffer(2, G_ibuf_112); return (0); } int deinit() { return (0); } int start() { int str2int_32; double low_36; double high_44; double Lda_84[10000][3]; string Ls_unused_88; int ind_counted_0 = IndicatorCounted(); int Li_12 = 0; int Li_8 = 0; int index_16 = 0; double high_52 = High[barn]; double low_60 = Low[barn]; int Li_24 = barn; int Li_28 = barn; for (int Li_4 = barn; Li_4 >= 0; Li_4--) { low_36 = 10000000; high_44 = -100000000; for (int index_20 = Li_4 + Length; index_20 >= Li_4 + 1; index_20--) { if (Low[index_20] < low_36) low_36 = Low[index_20]; if (High[index_20] > high_44) high_44 = High[index_20]; } if (Low[Li_4] < low_36 && High[Li_4] > high_44) { Li_8 = 2; if (Li_12 == 1) Li_24 = Li_4 + 1; if (Li_12 == -1) Li_28 = Li_4 + 1; } else { if (Low[Li_4] < low_36) Li_8 = -1; if (High[Li_4] > high_44) Li_8 = 1; } if (Li_8 != Li_12 && Li_12 != 0) { if (Li_8 == 2) { Li_8 = -Li_12; high_52 = High[Li_4]; low_60 = Low[Li_4]; } index_16++; if (Li_8 == 1) { Lda_84[index_16][1] = Li_28; Lda_84[index_16][2] = low_60; } if (Li_8 == -1) { Lda_84[index_16][1] = Li_24; Lda_84[index_16][2] = high_52; } high_52 = High[Li_4]; low_60 = Low[Li_4]; } if (Li_8 == 1) { if (High[Li_4] >= high_52) { high_52 = High[Li_4]; Li_24 = Li_4; } } if (Li_8 == -1) { if (Low[Li_4] <= low_60) { low_60 = Low[Li_4]; Li_28 = Li_4; } } Li_12 = Li_8; } for (index_20 = 1; index_20 <= index_16; index_20++) { str2int_32 = StrToInteger(DoubleToStr(Lda_84[index_20][1], 0)); G_ibuf_108[str2int_32] = Lda_84[index_20][2]; } double Ld_96 = -1; double Ld_104 = -1; for (index_20 = 0; index_20 < Bars; index_20++) { if (Ld_96 < 0.0 && G_ibuf_108[index_20] > 0.0) Ld_96 = G_ibuf_108[index_20]; if (Ld_104 < 0.0 && G_ibuf_108[index_20] > 0.0) Ld_104 = G_ibuf_108[index_20]; if (Ld_104 > 0.0 && Ld_96 > 0.0) break; } int Li_112 = 0; if (Ld_96 > Ld_104) Li_112 = -1; else Li_112 = 1; for (index_20 = 0; index_20 < Bars; index_20++) { G_ibuf_116[index_20] = 0.0; G_ibuf_112[index_20] = 0.0; if (G_ibuf_108[index_20] > 0.0) { if (Li_112 == 1) { G_ibuf_112[index_20] = G_ibuf_108[index_20]; Li_112 = -1; continue; } G_ibuf_116[index_20] = G_ibuf_108[index_20]; Li_112 = 1; } } return (0); }