#property copyright "Copyright © 2009, Wylie" #property link "dazzle.html@live.com" #property indicator_chart_window #property indicator_buffers 6 #property indicator_color1 Aqua #property indicator_color2 Red #property indicator_color3 White #property indicator_color4 Orange #property indicator_color5 Lime #property indicator_color6 Fuchsia extern int Corner = 1; extern int TF = 0; extern bool Mode_iMAX = TRUE; extern bool Mode_hp = TRUE; extern bool Mode_hpx = TRUE; extern int BARS = 0; extern bool DSPLYiMAXPhases = TRUE; extern bool DSPLYhpPhases = TRUE; extern bool DSPLYhpxPhases = TRUE; extern color iMAXph1color = Aqua; extern color iMAXph2color = Red; extern color hpPh1color = White; extern color hpPh2color = Orange; extern color hpxPh1color = Lime; extern color hpxPh2color = Fuchsia; double gda_136[]; double gda_140[]; double g_ibuf_144[]; double g_ibuf_148[]; double g_ibuf_152[]; double g_ibuf_156[]; double g_ibuf_160[]; double g_ibuf_164[]; double gd_168; double gd_176; double gd_184; double gd_192; int gi_200; int gi_204; int gi_208; int g_index_212; int gi_220; int gi_224; int g_error_228; string gsa_232[21]; string gs_236; string gs_244; bool gi_252; bool gi_256; bool gi_260; double g_icustom_264; double g_icustom_272; double g_icustom_280; int gia_288[4]; int gia_292[9]; int gia_296[9]; int gia_unused_300[3]; int gi_304 = 15; int g_y_308 = 0; int g_x_312 = 3; int g_y_316 = 0; int gi_320 = 25; int gi_324 = 15; int gi_328 = 25; int gi_332 = 35; int gi_336; int gi_340; int gi_unused_344; int gi_348; int g_index_352; int g_index_356; int g_index_360; string gsa_364[3]; string gsa_368[5]; string gsa_372[9]; string gsa_376[9]; string gsa_380[28]; string g_text_384; string gs_dummy_392; string g_name_400; string gs_dummy_408; string gs_dummy_416; string gs_dummy_424; color g_color_432; int gi_436; int init() { gsa_232[0] = "AUDCAD"; gsa_232[1] = "AUDNZD"; gsa_232[2] = "AUDJPY"; gsa_232[3] = "AUDUSD"; gsa_232[4] = "CADJPY"; gsa_232[5] = "CHFJPY"; gsa_232[6] = "EURAUD"; gsa_232[7] = "EURCAD"; gsa_232[8] = "EURCHF"; gsa_232[9] = "EURGBP"; gsa_232[10] = "EURJPY"; gsa_232[11] = "EURUSD"; gsa_232[12] = "GBPCHF"; gsa_232[13] = "GBPJPY"; gsa_232[14] = "GBPUSD"; gsa_232[15] = "NZDUSD"; gsa_232[16] = "USDCAD"; gsa_232[17] = "USDCHF"; gsa_232[18] = "USDMXN"; gsa_232[19] = "USDJPY"; gsa_232[20] = "USDTRY"; gi_224 = 20; if (Mode_hp || Mode_hpx && !GoSym()) { Print("iMAX3mtf: HP modes not programmed to function with this Symbol."); return (0); } IndicatorBuffers(6); SetIndexBuffer(0, g_ibuf_144); SetIndexBuffer(1, g_ibuf_148); if (Mode_iMAX && DSPLYiMAXPhases) { SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1, iMAXph1color); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1, iMAXph2color); } else { SetIndexStyle(0, DRAW_NONE); SetIndexStyle(1, DRAW_NONE); } if (Mode_hp) { SetIndexBuffer(2, g_ibuf_152); SetIndexBuffer(3, g_ibuf_156); if (DSPLYhpPhases) { SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 1, hpPh1color); SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 1, hpPh2color); } else { SetIndexStyle(2, DRAW_NONE); SetIndexStyle(3, DRAW_NONE); } } if (Mode_hpx) { SetIndexBuffer(4, g_ibuf_160); SetIndexBuffer(5, g_ibuf_164); if (DSPLYhpxPhases) { SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 1, hpxPh1color); SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 1, hpxPh2color); } else { SetIndexStyle(4, DRAW_NONE); SetIndexStyle(5, DRAW_NONE); } } gs_244 = StringSubstr(Symbol(), 3, 3); gs_236 = StringSubstr(Symbol(), 0, 6); gi_220 = 0; if (gs_244 == "MXN") gi_220 = 1; if (gs_244 == "JPY") gi_220 = 2; if (Mode_hp || Mode_hpx) { switch (gi_220) { case 0: switch (Period()) { case PERIOD_M1: gd_168 = 0.0001; break; case PERIOD_M5: gd_168 = 0.00015; break; case PERIOD_M15: gd_168 = 0.0003; break; case PERIOD_M30: gd_168 = 0.0005; break; case PERIOD_H1: gd_168 = 0.00075; break; case PERIOD_H4: gd_168 = 0.0015; break; case PERIOD_D1: gd_168 = 0.003; break; case PERIOD_W1: gd_168 = 0.005; break; case PERIOD_MN1: gd_168 = 0.01; } break; case 1: switch (Period()) { case PERIOD_M1: gd_168 = 0.001; break; case PERIOD_M5: gd_168 = 0.0015; break; case PERIOD_M15: gd_168 = 0.003; break; case PERIOD_M30: gd_168 = 0.005; break; case PERIOD_H1: gd_168 = 0.0075; break; case PERIOD_H4: gd_168 = 0.015; break; case PERIOD_D1: gd_168 = 0.03; break; case PERIOD_W1: gd_168 = 0.05; break; case PERIOD_MN1: gd_168 = 0.1; } break; case 2: switch (Period()) { case PERIOD_M1: gd_168 = 0.01; break; case PERIOD_M5: gd_168 = 0.015; break; case PERIOD_M15: gd_168 = 0.03; break; case PERIOD_M30: gd_168 = 0.05; break; case PERIOD_H1: gd_168 = 0.075; break; case PERIOD_H4: gd_168 = 0.15; break; case PERIOD_D1: gd_168 = 0.3; break; case PERIOD_W1: gd_168 = 0.5; break; case PERIOD_MN1: gd_168 = 1.0; } } } gi_200 = 20; IndicatorShortName("iMAX3eai"); gia_292[0] = 43200; gia_292[1] = 10080; gia_292[2] = 1440; gia_292[3] = 240; gia_292[4] = 60; gia_292[5] = 30; gia_292[6] = 15; gia_292[7] = 5; gia_292[8] = 1; gia_296[0] = 0; gia_296[1] = 6; gia_296[2] = 7; gia_296[3] = 7; gia_296[4] = 7; gia_296[5] = 0; gia_296[6] = 0; gia_296[7] = 6; gia_296[8] = 6; gsa_376[0] = "MN1"; gsa_376[1] = "W1"; gsa_376[2] = "D1"; gsa_376[3] = "H4"; gsa_376[4] = "H1"; gsa_376[5] = "M30"; gsa_376[6] = "M15"; gsa_376[7] = "M5"; gsa_376[8] = "M1"; for (g_index_352 = 0; g_index_352 <= 8; g_index_352++) { g_y_308 += gi_304; gsa_372[g_index_352] = StringConcatenate("iMAX3mtf_", gsa_376[g_index_352]); ObjectCreate(gsa_372[g_index_352], OBJ_LABEL, 0, 0, 0); ObjectSetText(gsa_372[g_index_352], gsa_376[g_index_352], 8, "Arial Bold", Moccasin); ObjectSet(gsa_372[g_index_352], OBJPROP_CORNER, Corner); ObjectSet(gsa_372[g_index_352], OBJPROP_XDISTANCE, g_x_312 + gia_296[g_index_352]); ObjectSet(gsa_372[g_index_352], OBJPROP_YDISTANCE, g_y_308); } if (Mode_iMAX) gia_288[0] = 1; else gia_288[0] = 6; if (Mode_hp) gia_288[1] = 2; else gia_288[1] = 7; if (Mode_hpx) gia_288[2] = 4; else gia_288[2] = 8; gia_288[3] = 5; ArraySort(gia_288, WHOLE_ARRAY, 0, MODE_ASCEND); gsa_368[1] = "0"; gsa_368[2] = "hp"; gsa_368[4] = "hpx"; for (g_index_352 = 0; g_index_352 <= 9; g_index_352++) { if (gia_288[g_index_352] >= 5) break; gsa_364[g_index_352] = StringConcatenate("mode_lbl_", g_index_352); ObjectDelete(gsa_364[g_index_352]); ObjectCreate(gsa_364[g_index_352], OBJ_LABEL, 0, 0, 0); ObjectSetText(gsa_364[g_index_352], gsa_368[gia_288[g_index_352]], 8, "Arial Bold", Moccasin); ObjectSet(gsa_364[g_index_352], OBJPROP_CORNER, Corner); if (gia_288[g_index_352] == 1) gi_340 = 8; if (gia_288[g_index_352] == 2) gi_340 = 4; if (gia_288[g_index_352] == 4) gi_340 = 0; ObjectSet(gsa_364[g_index_352], OBJPROP_XDISTANCE, gi_332 + gi_328 * g_index_352 + gi_340); ObjectSet(gsa_364[g_index_352], OBJPROP_YDISTANCE, 10 * gi_304); gi_336 = g_index_352; } g_name_400 = "iMAX3mtf_titleA"; ObjectCreate(g_name_400, OBJ_LABEL, 0, 0, 0); ObjectSetText(g_name_400, "iMAX3 MTF " + Symbol(), 8, "Arial Bold", Gold); ObjectSet(g_name_400, OBJPROP_CORNER, Corner); ObjectSet(g_name_400, OBJPROP_XDISTANCE, g_x_312); ObjectSet(g_name_400, OBJPROP_YDISTANCE, 11 * gi_304 + 5); return (0); } int deinit() { for (g_index_352 = 0; g_index_352 <= 8; g_index_352++) ObjectDelete(gsa_372[g_index_352]); ObjectDelete(g_name_400); for (g_index_352 = 0; g_index_352 <= gi_336; g_index_352++) ObjectDelete(gsa_364[g_index_352]); g_index_360 = 0; for (g_index_356 = 1; g_index_356 <= 3; g_index_356++) { for (g_index_352 = 0; g_index_352 <= 8; g_index_352++) { ObjectDelete(StringConcatenate("Arrow ", g_index_360)); g_index_360++; } } return (0); } int start() { if (Bars <= gi_200) return (0); gi_208 = IndicatorCounted(); if (gi_208 < 0) return (-1); if (gi_208 > 0) gi_208--; gi_204 = Bars - gi_208 - 1; gd_176 = 0.5; ArraySetAsSeries(gda_136, FALSE); ArraySetAsSeries(gda_140, FALSE); ArrayCopySeries(gda_136, 2, gs_236, TF); g_error_228 = GetLastError(); if (g_error_228 == 4066/* HISTORY_WILL_UPDATED */) { for (g_index_212 = 0; g_index_212 < 2; g_index_212++) { Sleep(5000); ArrayCopySeries(gda_136, 2, gs_236, TF); } } ArrayCopySeries(gda_140, 1, gs_236, TF); g_error_228 = GetLastError(); if (g_error_228 == 4066/* HISTORY_WILL_UPDATED */) { for (g_index_212 = 0; g_index_212 < 2; g_index_212++) { Sleep(5000); ArrayCopySeries(gda_140, 1, gs_236, TF); } } for (g_index_212 = gi_204; g_index_212 >= 0; g_index_212--) { if (Mode_hpx) { g_ibuf_164[g_index_212] = 0.13785 * (2.0 * ((gda_136[g_index_212] + gda_140[g_index_212]) * gd_176) - (gda_136[g_index_212 + 1] + (gda_140[g_index_212 + 1])) * gd_176) + 0.0007 * (2.0 * ((gda_136[g_index_212 + 1] + (gda_140[g_index_212 + 1])) * gd_176) - (gda_136[g_index_212 + 2] + (gda_140[g_index_212 + 2])) * gd_176) + 0.13785 * (2.0 * ((gda_136[g_index_212 + 2] + (gda_140[g_index_212 + 2])) * gd_176) - (gda_136[g_index_212 + 3] + (gda_140[g_index_212 + 3])) * gd_176) + (1.2103 * (g_ibuf_160[g_index_212 + 1]) - (g_ibuf_160[g_index_212 + 2]) / 2.0); if (Close[g_index_212] > g_ibuf_164[g_index_212]) g_ibuf_160[g_index_212] = g_ibuf_164[g_index_212] + gd_168; if (Close[g_index_212] < g_ibuf_164[g_index_212]) g_ibuf_160[g_index_212] = g_ibuf_164[g_index_212] - gd_168; } if (Mode_iMAX || Mode_hp) { g_ibuf_144[g_index_212] = 0.13785 * (2.0 * ((gda_136[g_index_212] + gda_140[g_index_212]) * gd_176) - (gda_136[g_index_212 + 1] + (gda_140[g_index_212 + 1])) * gd_176) + 0.0007 * (2.0 * ((gda_136[g_index_212 + 1] + (gda_140[g_index_212 + 1])) * gd_176) - (gda_136[g_index_212 + 2] + (gda_140[g_index_212 + 2])) * gd_176) + 0.13785 * (2.0 * ((gda_136[g_index_212 + 2] + (gda_140[g_index_212 + 2])) * gd_176) - (gda_136[g_index_212 + 3] + (gda_140[g_index_212 + 3])) * gd_176) + (1.2103 * (g_ibuf_144[g_index_212 + 1]) - (g_ibuf_144[g_index_212 + 2]) / 2.0); gd_184 = g_ibuf_144[g_index_212]; g_ibuf_148[g_index_212] = g_ibuf_144[g_index_212 + 1]; } if (Mode_hp) { if (Close[g_index_212] > g_ibuf_144[g_index_212]) gd_192 = g_ibuf_144[g_index_212] + gd_168; if (Close[g_index_212] < g_ibuf_144[g_index_212]) gd_192 = g_ibuf_144[g_index_212] - gd_168; g_ibuf_152[g_index_212] = gd_192; g_ibuf_156[g_index_212] = gd_184; } } if (gia_288[0] + gia_288[1] + gia_288[2] == 0) return (0); g_index_360 = 0; for (g_index_356 = 0; g_index_356 <= gi_336; g_index_356++) { if (gia_288[g_index_356] == 1) { gi_252 = TRUE; gi_348 = 0; } else gi_252 = FALSE; if (gia_288[g_index_356] == 2) { gi_256 = TRUE; gi_348 = 2; } else gi_256 = FALSE; if (gia_288[g_index_356] == 4) { gi_260 = TRUE; gi_348 = 4; } else gi_260 = FALSE; gi_436 = -1; g_y_316 = 0; g_index_352 = 0; while (g_index_352 <= 8) { if (gia_292[g_index_352] == Period()) { if (gi_252) { g_icustom_264 = g_ibuf_144[0]; g_icustom_272 = g_ibuf_144[1]; g_icustom_280 = g_ibuf_148[0]; } if (gi_256) { g_icustom_264 = g_ibuf_152[0]; g_icustom_272 = g_ibuf_152[1]; g_icustom_280 = g_ibuf_156[0]; } if (gi_260) { g_icustom_264 = g_ibuf_160[0]; g_icustom_272 = g_ibuf_160[1]; g_icustom_280 = g_ibuf_164[0]; } } else { g_icustom_264 = iCustom(NULL, gia_292[g_index_352], "iMAX3ea", gia_292[g_index_352], gi_252, gi_256, gi_260, BARS, 0, 0, 0, gi_436, gi_436, gi_436, gi_436, gi_436, gi_436, gi_348, 0); g_icustom_272 = iCustom(NULL, gia_292[g_index_352], "iMAX3ea", gia_292[g_index_352], gi_252, gi_256, gi_260, BARS, 0, 0, 0, gi_436, gi_436, gi_436, gi_436, gi_436, gi_436, gi_348, 1); g_icustom_280 = iCustom(NULL, gia_292[g_index_352], "iMAX3ea", gia_292[g_index_352], gi_252, gi_256, gi_260, BARS, 0, 0, 0, gi_436, gi_436, gi_436, gi_436, gi_436, gi_436, gi_348 + 1, 0); } if (g_icustom_264 > g_icustom_280 && Close[0] > g_icustom_264) { g_text_384 = "é"; g_color_432 = Lime; gi_unused_344 = 1; } if (g_icustom_264 > g_icustom_280 && Close[0] < g_icustom_264) { g_text_384 = "ö"; g_color_432 = LightSeaGreen; gi_unused_344 = 2; } if (g_icustom_264 < g_icustom_280 && Close[0] < g_icustom_264) { g_text_384 = "ê"; g_color_432 = Orange; gi_unused_344 = 3; } if (g_icustom_264 < g_icustom_280 && Close[0] > g_icustom_264) { g_text_384 = "ø"; g_color_432 = Red; gi_unused_344 = 4; } if (g_icustom_264 == g_icustom_272 || g_icustom_264 == g_icustom_280) { g_text_384 = "ð"; g_color_432 = Yellow; gi_unused_344 = 5; } g_y_316 += gi_304; gsa_380[g_index_360] = StringConcatenate("Arrow ", g_index_360); ObjectDelete(gsa_380[g_index_360]); ObjectCreate(gsa_380[g_index_360], OBJ_LABEL, 0, 0, 0); ObjectSetText(gsa_380[g_index_360], g_text_384, 9, "Wingdings", g_color_432); ObjectSet(gsa_380[g_index_360], OBJPROP_CORNER, Corner); ObjectSet(gsa_380[g_index_360], OBJPROP_XDISTANCE, gi_324 + gi_320 * (g_index_356 + 1)); ObjectSet(gsa_380[g_index_360], OBJPROP_YDISTANCE, g_y_316); g_index_352++; g_index_360++; } } return (0); } bool GoSym() { bool li_ret_0 = FALSE; for (g_index_212 = 0; g_index_212 <= gi_224; g_index_212++) if (Symbol() == gsa_232[g_index_212]) li_ret_0 = TRUE; return (li_ret_0); }