#property copyright "InsightNext" #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_minimum 0.0 #property indicator_maximum 5.0 #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 Red #property indicator_color4 Blue #property indicator_color5 Red #property indicator_color6 Blue #property indicator_color7 Red #property indicator_color8 Blue int gi_unused_76 = 2; int gi_unused_80 = 6; int gi_unused_84 = 3; int gi_unused_88 = 2; int gi_unused_92 = 500; double gd_96 = 1.0; double g_ibuf_104[]; double g_ibuf_108[]; double g_ibuf_112[]; double g_ibuf_116[]; double g_ibuf_120[]; double g_ibuf_124[]; double g_ibuf_128[]; double g_ibuf_132[]; double g_icustom_136; double g_icustom_144; string gs_168 = ""; int gi_unused_176 = 110; int gi_180 = 2282; int g_timeframe_184; int g_timeframe_188; int g_timeframe_192; int g_timeframe_196; int init() { SetIndexStyle(0, DRAW_NONE); SetIndexBuffer(0, g_ibuf_128); SetIndexEmptyValue(0, 0.0); SetIndexStyle(1, DRAW_NONE); SetIndexBuffer(1, g_ibuf_132); SetIndexEmptyValue(1, 0.0); SetIndexStyle(2, DRAW_NONE); SetIndexBuffer(2, g_ibuf_120); SetIndexEmptyValue(2, 0.0); SetIndexStyle(3, DRAW_NONE); SetIndexBuffer(3, g_ibuf_124); SetIndexEmptyValue(3, 0.0); SetIndexStyle(4, DRAW_NONE); SetIndexBuffer(4, g_ibuf_112); SetIndexEmptyValue(4, 0.0); SetIndexStyle(5, DRAW_NONE); SetIndexBuffer(5, g_ibuf_116); SetIndexEmptyValue(5, 0.0); SetIndexStyle(6, DRAW_NONE); SetIndexBuffer(6, g_ibuf_104); SetIndexEmptyValue(6, 0.0); SetIndexStyle(7, DRAW_NONE); SetIndexBuffer(7, g_ibuf_108); SetIndexEmptyValue(7, 0.0); SetIndexLabel(0, NULL); SetIndexLabel(1, NULL); SetIndexLabel(2, NULL); SetIndexLabel(3, NULL); SetIndexLabel(4, NULL); SetIndexLabel(5, NULL); SetIndexLabel(6, NULL); SetIndexLabel(7, NULL); IndicatorDigits(0); getPeriod(); gs_168 = "TQ_02"; IndicatorShortName(gs_168); return (0); } int deinit() { return (0); } int start() { int lia_32[]; int lia_36[]; int lia_40[]; int lia_44[]; int li_64; int l_timeframe_68; int li_0 = IndicatorCounted(); if (li_0 < 0) return (-1); if (li_0 > 0) li_0--; int li_4 = Bars - li_0; double ld_unused_16 = Time[0] - Time[1]; for (int li_8 = ObjectsTotal() - 1; li_8 > -1; li_8--) if (StringFind(ObjectName(li_8), "FF_" + gi_180 + "_") >= 0) ObjectDelete(ObjectName(li_8)); double ld_unused_24 = 0.2; ArrayCopySeries(lia_44, 5, Symbol(), g_timeframe_184); ArrayCopySeries(lia_40, 5, Symbol(), g_timeframe_188); ArrayCopySeries(lia_36, 5, Symbol(), g_timeframe_192); ArrayCopySeries(lia_32, 5, Symbol(), g_timeframe_196); int l_index_48 = 0; int l_index_52 = 0; int l_index_56 = 0; int l_index_60 = 0; li_8 = 0; l_index_48 = 0; l_index_52 = 0; l_index_56 = 0; l_index_60 = 0; while (li_8 < li_4) { if (Time[li_8] < lia_44[l_index_48]) l_index_48++; if (Time[li_8] < lia_40[l_index_52]) l_index_52++; if (Time[li_8] < lia_36[l_index_56]) l_index_56++; if (Time[li_8] < lia_32[l_index_60]) l_index_60++; for (int li_12 = 1; li_12 <= 4; li_12++) { switch (li_12) { case 1: l_timeframe_68 = g_timeframe_184; li_64 = l_index_48; break; case 2: l_timeframe_68 = g_timeframe_188; li_64 = l_index_52; break; case 3: l_timeframe_68 = g_timeframe_192; li_64 = l_index_56; break; case 4: l_timeframe_68 = g_timeframe_196; li_64 = l_index_60; } g_icustom_136 = iCustom(NULL, l_timeframe_68, "TQ_03", 2, li_64); g_icustom_144 = iCustom(NULL, l_timeframe_68, "TQ_03", 3, li_64); switch (li_12) { case 1: g_ibuf_132[li_8] = EMPTY_VALUE; g_ibuf_128[li_8] = EMPTY_VALUE; if (g_icustom_136 >= g_icustom_144) g_ibuf_132[li_8] = 1; else g_ibuf_128[li_8] = 1; break; case 2: g_ibuf_124[li_8] = EMPTY_VALUE; g_ibuf_120[li_8] = EMPTY_VALUE; if (g_icustom_136 >= g_icustom_144) g_ibuf_124[li_8] = 1.0 * gd_96 + 1.0; else g_ibuf_120[li_8] = 1.0 * gd_96 + 1.0; break; case 3: g_ibuf_116[li_8] = EMPTY_VALUE; g_ibuf_112[li_8] = EMPTY_VALUE; if (g_icustom_136 >= g_icustom_144) g_ibuf_116[li_8] = 2.0 * gd_96 + 1.0; else g_ibuf_112[li_8] = 2.0 * gd_96 + 1.0; break; case 4: g_ibuf_108[li_8] = EMPTY_VALUE; g_ibuf_104[li_8] = EMPTY_VALUE; if (g_icustom_136 >= g_icustom_144) g_ibuf_108[li_8] = 3.0 * gd_96 + 1.0; else g_ibuf_104[li_8] = 3.0 * gd_96 + 1.0; } } li_8++; } return (0); } void getPeriod() { switch (Period()) { case PERIOD_M1: g_timeframe_184 = 1; g_timeframe_188 = 5; g_timeframe_192 = 15; g_timeframe_196 = 30; return; case PERIOD_M5: g_timeframe_184 = 5; g_timeframe_188 = 15; g_timeframe_192 = 30; g_timeframe_196 = 60; return; case PERIOD_M15: g_timeframe_184 = 15; g_timeframe_188 = 30; g_timeframe_192 = 60; g_timeframe_196 = 240; return; case PERIOD_M30: g_timeframe_184 = 30; g_timeframe_188 = 60; g_timeframe_192 = 240; g_timeframe_196 = 1440; return; case PERIOD_H1: g_timeframe_184 = 60; g_timeframe_188 = 240; g_timeframe_192 = 1440; g_timeframe_196 = 10080; return; case PERIOD_H4: g_timeframe_184 = 240; g_timeframe_188 = 1440; g_timeframe_192 = 10080; g_timeframe_196 = 43200; return; case PERIOD_D1: g_timeframe_184 = 1440; g_timeframe_188 = 10080; g_timeframe_192 = 43200; g_timeframe_196 = 43200; return; case PERIOD_W1: g_timeframe_184 = 10080; g_timeframe_188 = 43200; g_timeframe_192 = 43200; g_timeframe_196 = 43200; return; case PERIOD_MN1: g_timeframe_184 = 43200; g_timeframe_188 = 43200; g_timeframe_192 = 43200; g_timeframe_196 = 43200; return; } }