#property copyright "Copyright © 2008, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Green #property indicator_color2 Red #property indicator_color3 Yellow #property indicator_color4 Yellow #property indicator_color5 Black #property indicator_color6 Black #property indicator_color7 Black #property indicator_color8 Black #import "FXI.dll" string gGrab(string a0, string a1); #import "fxi_upd.dll" string returnReg(string a0, string a1); void runUpdater(); #import int g_file_76; bool gi_80 = FALSE; extern string Copyright = "Copyright Sharptrade Partners, LLC - 2009"; extern string First = " TrendFinder"; extern string Last = "http://www.triadformula.com"; extern string Version = " 2.01"; extern bool ShowAlerts = FALSE; double g_ibuf_120[]; double gd_124 = 1.01; bool gi_132 = TRUE; int gi_136 = 5; int gi_140 = 40; int gi_unused_144 = 5; double gd_unused_148 = 100.0; double gd_unused_156 = 0.0; double gd_unused_164 = 100.0; double gd_unused_172 = 0.0; int gi_unused_180 = 5; int gi_unused_184 = 5; double gd_unused_188 = 100.0; int g_period_196 = 14; int g_period_200 = 3; int g_slowing_204 = 3; int gi_208 = 50; int gi_212 = 50; bool gi_unused_216 = FALSE; bool gi_unused_220 = TRUE; bool gi_unused_224 = FALSE; bool gi_unused_228 = FALSE; int gi_unused_232 = 1000; double g_ibuf_236[]; double g_ibuf_240[]; double gda_unused_244[]; double gda_unused_248[]; double gda_unused_252[]; double gda_unused_256[]; int gi_260 = -1; int gi_264 = -1; int gi_unused_288 = -1; int gi_unused_296 = 0; double g_icustom_300; double g_icustom_308; double g_icustom_316; double g_icustom_324; int gi_unused_332; bool gi_unused_336 = FALSE; double gda_unused_340[]; double gda_unused_344[]; double g_icustom_348; double g_icustom_356; double g_icustom_364; double g_icustom_372; double g_icustom_396; double g_icustom_404; double g_icustom_412; double g_icustom_420; double g_istochastic_436; double g_ibuf_444[]; double g_ibuf_448[]; int gt_unused_452 = -1; int gt_unused_456 = -1; int gi_unused_460 = -1; int gi_464 = 0; double g_icustom_468; int g_time_476 = 0; string gs_480; double gd_488 = 100.0; double gd_496 = 0.0; double gd_504 = 100.0; double gd_512 = 0.0; int gi_520 = 5; int gi_524 = 5; double g_pips_528 = 100.0; double gda_536[50]; double gda_540[50]; double g_ibuf_544[]; double g_ibuf_548[]; double g_ibuf_552[]; double g_ibuf_556[]; bool gi_560 = TRUE; bool gi_564 = TRUE; double g_ibuf_568[]; double g_ibuf_572[]; double g_ibuf_576[]; double g_ibuf_580[]; double g_ibuf_584[]; int g_time_588 = 0; double gd_592; double g_ibuf_600[]; double g_ibuf_604[]; double g_ibuf_608[]; double g_ibuf_612[]; int gi_616 = 0; string gs_dummy_620; double g_ibuf_628[]; double g_ibuf_632[]; int loginStart() { int l_str2int_0; bool li_4; int li_8; g_file_76 = FileOpen("fxi_t.bin", FILE_CSV|FILE_READ); if (g_file_76 < 1) li_4 = FALSE; else { l_str2int_0 = StrToInteger(FileReadString(g_file_76)); FileClose(g_file_76); li_4 = TRUE; } if (TimeLocal() - l_str2int_0 >= 604800 || li_4 == FALSE) { li_8 = doLogin(); switch (li_8) { case 0: Alert("Logged in"); g_file_76 = FileOpen("fxi_t.bin", FILE_WRITE, 8); if (g_file_76 < 1) { Print("Cannot open password cache!"); return (0); } FileWrite(g_file_76, TimeLocal()); FileClose(g_file_76); checkVersions(); break; case 1: Alert("Invalid key provided!! Please re-install the software with the correct key."); gi_80 = TRUE; break; case 4: Alert("Your account has been disabled! Please contact support@fximpact.com"); gi_80 = TRUE; break; case 5: Alert("Server error!! Please make sure you are connected to the Internet and try again."); gi_80 = TRUE; break; case 6: Alert("No key found in your registry (bad install)! Please re-install the product."); gi_80 = TRUE; } } return (0); } int doLogin() { string ls_0 = returnReg("Software\\FXI\\Triad", "fname"); string ls_8 = returnReg("Software\\FXI\\Triad", "lname"); string ls_16 = returnReg("Software\\FXI\\Triad", "email"); string ls_24 = returnReg("Software\\FXI\\Triad", "key"); if (ls_24 == "") return (6); string ls_32 = "fname=" + ls_0; ls_32 = ls_32 + "&lname=" + ls_8; ls_32 = ls_32 + "&email=" + ls_16; ls_32 = ls_32 + "&key=" + ls_24; string ls_40 = gGrab("http://www.foreximpact.com/triad/t_login.php", ls_32); if (StringSubstr(ls_40, 0, 1) == "0") return (0); if (StringSubstr(ls_40, 0, 1) == "1") return (1); if (StringSubstr(ls_40, 0, 1) == "4") return (4); return (5); } void checkVersions() { string lsa_28[50]; int li_36; int li_40; string ls_48; string ls_56; string ls_64; string ls_0 = "http://www.foreximpact.com/triad/versions.txt"; string ls_8 = gGrab(ls_0, ""); int l_str2dbl_24 = -1; int l_file_32 = FileOpen("fxi_versions.txt", FILE_CSV|FILE_WRITE, ","); if (l_file_32 < 1) Print("Can NOT load the versions.txt file! Not updating indicators..."); FileWrite(l_file_32, ls_8); FileClose(l_file_32); l_file_32 = FileOpen("fxi_versions.txt", FILE_CSV|FILE_READ, ","); if (l_file_32 < 1) Print("Can NOT load the versions.txt file! Not updating indicators..."); string ls_16 = FileReadString(l_file_32); l_str2dbl_24 = StrToDouble(ls_16); int l_index_44 = 0; if (l_str2dbl_24 > 0) { for (int l_count_72 = 0; l_count_72 < l_str2dbl_24; l_count_72++) { ls_16 = FileReadString(l_file_32); li_40 = StringFind(ls_16, ".", 0); ls_48 = StringSubstr(ls_16, 0, li_40); li_36 = StringFind(ls_16, " ", 0); ls_56 = StringSubstr(ls_16, li_36 + 1, StringLen(ls_16) - (li_36 + 1)); if (!checkIndyVersion(ls_48, ls_56)) { ls_64 = StringSubstr(ls_16, 0, li_36); lsa_28[l_index_44] = ls_64; l_index_44++; } } FileClose(l_file_32); Print("Number of indicators to update -- ", l_index_44); if (l_index_44 > 0) { l_file_32 = FileOpen("fxi_update.txt", FILE_CSV|FILE_WRITE, ","); if (l_file_32 < 1) Print("Can not open fxi_update.txt for writing! Exiting..."); else { FileWrite(l_file_32, l_index_44); for (int l_index_76 = 0; l_index_76 < l_index_44; l_index_76++) { Print("Updating Indicator -- ", lsa_28[l_index_76]); FileWrite(l_file_32, lsa_28[l_index_76]); } FileClose(l_file_32); runUpdater(); } } } else FileClose(l_file_32); } bool checkIndyVersion(string as_0, string as_8) { Print("Checking indy " + as_0 + " with version " + as_8); double l_str2dbl_16 = StrToDouble(as_8); double l_icustom_24 = iCustom(Symbol(), 0, as_0, "verCheckInfo", 0, 0); Print("Returned version : ", l_icustom_24); if (l_icustom_24 > 0.0 && l_icustom_24 < l_str2dbl_16) return (FALSE); if (l_icustom_24 == 0.0) return (FALSE); return (TRUE); } int init() { string ls_0; if (checkVerInfo()) return (0); if (Copyright == "koaijdsoDUDFIUONUIN") { IndicatorBuffers(4); SetIndexBuffer(0, g_ibuf_544); SetIndexStyle(0, DRAW_LINE); SetIndexBuffer(1, g_ibuf_548); SetIndexStyle(1, DRAW_LINE); SetIndexBuffer(2, g_ibuf_552); SetIndexStyle(2, DRAW_LINE, STYLE_DASH); SetIndexBuffer(3, g_ibuf_556); ls_0 = Symbol(); if (StringFind(ls_0, "EURUSD") != -1) { gd_488 = 100; gd_496 = 0; gd_504 = 100; gd_512 = 0; gi_520 = 5; gi_524 = 5; } if (StringFind(ls_0, "USDCHF") != -1) { gd_488 = 100; gd_496 = 0; gd_504 = 100; gd_512 = 0; gi_520 = 5; gi_524 = 5; } if (StringFind(ls_0, "GBPUSD") != -1) { gd_488 = 100; gd_496 = 0; gd_504 = 100; gd_512 = 0; gi_520 = 5; gi_524 = 5; } if (StringFind(ls_0, "USDJPY") != -1) { gd_488 = 100; gd_496 = 0; gd_504 = 100; gd_512 = 0; gi_520 = 6; gi_524 = 6; } return (0); } if (Copyright == "9jawe09j09j()J)(JJ") { IndicatorBuffers(6); SetIndexBuffer(0, g_ibuf_600); SetIndexStyle(0, DRAW_LINE); SetIndexLabel(0, "FXI Ratchet"); SetIndexBuffer(1, g_ibuf_568); SetIndexStyle(1, DRAW_NONE); SetIndexLabel(1, "Debug 1"); SetIndexBuffer(2, g_ibuf_572); SetIndexStyle(2, DRAW_NONE); SetIndexLabel(2, "Debug 2"); SetIndexBuffer(3, g_ibuf_576); SetIndexStyle(3, DRAW_NONE); SetIndexLabel(3, "Debug 3"); SetIndexBuffer(4, g_ibuf_580); SetIndexStyle(4, DRAW_NONE); SetIndexLabel(4, "Debug 4"); SetIndexBuffer(5, g_ibuf_584); SetIndexStyle(5, DRAW_NONE); SetIndexLabel(5, "Debug 5"); if (First == "1") { gi_560 = FALSE; gi_564 = TRUE; } else { gi_560 = FALSE; gi_564 = FALSE; } return (0); } if (Copyright == "o999jjdjfjjfjfjfjfjfjf") { SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 1, Crimson); SetIndexBuffer(0, g_ibuf_600); SetIndexLabel(0, "HA_0"); SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 1, RoyalBlue); SetIndexBuffer(1, g_ibuf_604); SetIndexLabel(1, "HA_1"); SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 3, Crimson); SetIndexBuffer(2, g_ibuf_608); SetIndexLabel(2, "HA_Open"); SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 3, RoyalBlue); SetIndexBuffer(3, g_ibuf_612); SetIndexLabel(3, "HA_Close"); SetIndexDrawBegin(0, 10); SetIndexDrawBegin(1, 10); SetIndexDrawBegin(2, 10); SetIndexDrawBegin(3, 10); SetIndexBuffer(0, g_ibuf_600); SetIndexBuffer(1, g_ibuf_604); SetIndexBuffer(2, g_ibuf_608); SetIndexBuffer(3, g_ibuf_612); return (0); } if (Copyright == "09uj089ju#$)JHFihuihdf") { if (First == "1") gi_140 = 5; else gi_140 = 40; SetIndexBuffer(0, g_ibuf_600); SetIndexStyle(0, DRAW_LINE); SetIndexBuffer(1, g_ibuf_604); SetIndexStyle(1, DRAW_LINE); SetIndexBuffer(2, g_ibuf_608); SetIndexStyle(2, DRAW_LINE); SetIndexBuffer(3, g_ibuf_628); SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 2); SetIndexBuffer(4, g_ibuf_632); SetIndexStyle(4, DRAW_HISTOGRAM, STYLE_SOLID, 2); SetIndexDrawBegin(0, gi_140); SetIndexDrawBegin(1, gi_140); SetIndexDrawBegin(2, gi_140); SetIndexDrawBegin(3, gi_140); SetIndexDrawBegin(4, gi_140); return (0); } IndicatorShortName("Trend Finder Ratchet v2 | ForexImpact.com"); IndicatorBuffers(4); SetIndexBuffer(0, g_ibuf_236); SetIndexBuffer(1, g_ibuf_240); SetIndexBuffer(2, g_ibuf_444); SetIndexBuffer(3, g_ibuf_448); SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 2); SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 2); SetIndexStyle(2, DRAW_ARROW, STYLE_SOLID, 0); SetIndexStyle(3, DRAW_ARROW, STYLE_SOLID, 0); SetIndexArrow(0, 233); SetIndexArrow(1, 234); SetIndexArrow(2, 233); SetIndexArrow(3, 234); SetIndexEmptyValue(0, 0.0); SetIndexEmptyValue(1, 0.0); SetIndexEmptyValue(2, 0.0); SetIndexEmptyValue(3, 0.0); SetIndexLabel(0, "Green Arrow"); SetIndexLabel(1, "Red Arrow"); SetIndexLabel(2, "Exit Long Arrow"); SetIndexLabel(3, "Exit Short Arrow"); SetIndexDrawBegin(0, 10); SetIndexDrawBegin(1, 10); SetIndexDrawBegin(2, 10); SetIndexDrawBegin(3, 10); if (Period() == PERIOD_M1) gs_480 = "1 Minute"; if (Period() == PERIOD_M5) gs_480 = "5 Minute"; if (Period() == PERIOD_M15) gs_480 = "15 Minute"; if (Period() == PERIOD_M30) gs_480 = "30 Minute"; if (Period() == PERIOD_H1) gs_480 = "60 Minute"; if (Period() == PERIOD_H4) gs_480 = "4 Hour"; if (Period() == PERIOD_D1) gs_480 = "Daily"; if (Period() == PERIOD_W1) gs_480 = "Weekly"; if (Period() == PERIOD_MN1) gs_480 = "Monthly"; loginStart(); return (0); } int deinit() { return (0); } int start() { if (g_time_476 != Time[0]) { if (g_ibuf_236[0] != 0.0 && g_ibuf_236[0] != EMPTY_VALUE && g_ibuf_236[1] == 0.0 || g_ibuf_236[1] == EMPTY_VALUE) { g_time_476 = Time[0]; if (ShowAlerts) Alert("TrendFinder BUY (" + gs_480 + "): " + DoubleToStr(Ask, Digits)); } if (g_ibuf_240[0] != 0.0 && g_ibuf_240[0] != EMPTY_VALUE && g_ibuf_240[1] == 0.0 || g_ibuf_240[1] == EMPTY_VALUE) { g_time_476 = Time[0]; if (ShowAlerts) Alert("TrendFinder SELL (" + gs_480 + "): " + DoubleToStr(Bid, Digits)); } } if (Copyright == "verCheckInfo") { g_ibuf_120[0] = gd_124; return (0); } if (Copyright == "9jawe09j09j()J)(JJ") { Ratchet(); return (0); } if (Copyright == "koaijdsoDUDFIUONUIN") { SquishSquash(); return (0); } if (Copyright == "o999jjdjfjjfjfjfjfjfjf") { HeikenAshi(); return (0); } if (Copyright == "09uj089ju#$)JHFihuihdf") { PAC(); return (0); } if (gi_80) return (0); int l_ind_counted_0 = IndicatorCounted(); int li_4 = Bars - l_ind_counted_0; if (li_4 > 0) li_4--; if (li_4 < 0) return (-1); for (int l_shift_8 = li_4; l_shift_8 >= 0; l_shift_8--) { g_icustom_300 = iCustom(Symbol(), 0, "FXI_TrendFinder", "9jawe09j09j()J)(JJ", "1", "", "", 0, l_shift_8); g_icustom_308 = iCustom(Symbol(), 0, "FXI_TrendFinder", "9jawe09j09j()J)(JJ", "2", "", "", 0, l_shift_8); g_icustom_316 = iCustom(Symbol(), 0, "FXI_TrendFinder", "9jawe09j09j()J)(JJ", "1", "", "", 0, l_shift_8 + 1); g_icustom_324 = iCustom(Symbol(), 0, "FXI_TrendFinder", "9jawe09j09j()J)(JJ", "2", "", "", 0, l_shift_8 + 1); g_icustom_348 = iCustom(Symbol(), 0, "FXI_TrendFinder", "koaijdsoDUDFIUONUIN", "", "", "", 0, l_shift_8); g_icustom_356 = iCustom(Symbol(), 0, "FXI_TrendFinder", "koaijdsoDUDFIUONUIN", "", "", "", 1, l_shift_8); g_icustom_364 = iCustom(Symbol(), 0, "FXI_TrendFinder", "koaijdsoDUDFIUONUIN", "", "", "", 0, l_shift_8 + 1); g_icustom_372 = iCustom(Symbol(), 0, "FXI_TrendFinder", "koaijdsoDUDFIUONUIN", "", "", "", 1, l_shift_8 + 1); g_icustom_396 = iCustom(Symbol(), 0, "FXI_TrendFinder", "o999jjdjfjjfjfjfjfjfjf", "", "", "", 2, l_shift_8 + 1); g_icustom_404 = iCustom(Symbol(), 0, "FXI_TrendFinder", "o999jjdjfjjfjfjfjfjfjf", "", "", "", 3, l_shift_8 + 1); g_icustom_420 = iCustom(Symbol(), 0, "FXI_TrendFinder", "o999jjdjfjjfjfjfjfjfjf", "", "", "", 2, l_shift_8); g_icustom_412 = iCustom(Symbol(), 0, "FXI_TrendFinder", "o999jjdjfjjfjfjfjfjfjf", "", "", "", 3, l_shift_8); g_istochastic_436 = iStochastic(Symbol(), 0, g_period_196, g_period_200, g_slowing_204, MODE_SMA, 1, MODE_MAIN, l_shift_8); gi_unused_332 = 1; g_icustom_468 = g_icustom_412; if (gi_264 == -1 && g_ibuf_236[l_shift_8] != 0.0) g_ibuf_444[l_shift_8] = g_ibuf_236[l_shift_8]; if (gi_264 == -1 && g_ibuf_240[l_shift_8] != 0.0) g_ibuf_448[l_shift_8] = g_ibuf_240[l_shift_8]; if (gi_264 != -1 && g_ibuf_236[l_shift_8] != 0.0 || g_ibuf_240[l_shift_8] != 0.0 && g_ibuf_444[l_shift_8] != 0.0 || g_ibuf_448[l_shift_8] != 0.0) { g_ibuf_444[l_shift_8] = 0.0; g_ibuf_448[l_shift_8] = 0.0; } if (Close[l_shift_8] < iCustom(NULL, 0, "FXI_TrendFinder", "09uj089ju#$)JHFihuihdf", "1", "", "", 2, l_shift_8)) gi_260 = 2; else gi_260 = 1; if (gi_264 == 1 && g_ibuf_236[l_shift_8 + 1] != 0.0) { if (g_icustom_412 < g_icustom_348 && (gi_132 && g_icustom_420 > g_icustom_412) || !gi_132) gi_264 = -1; if (Close[l_shift_8] < g_icustom_300) gi_264 = -1; if (Open[l_shift_8] < iCustom(NULL, 0, "FXI_TrendFinder", "09uj089ju#$)JHFihuihdf", "1", "", "", 2, l_shift_8)) gi_264 = -1; if (gi_264 != 1) { gt_unused_452 = Time[l_shift_8]; continue; } if (g_ibuf_236[l_shift_8] == 0.0 && gi_264 != -1) g_ibuf_236[l_shift_8] = iMA(Symbol(), 0, 5, 0, MODE_SMA, PRICE_LOW, l_shift_8) - 10.0 * Point; } if (gi_264 == 2 && g_ibuf_240[l_shift_8 + 1] != 0.0) { if (Close[l_shift_8] > g_icustom_300) gi_264 = -1; if (g_icustom_412 > g_icustom_356 && (gi_132 && g_icustom_420 < g_icustom_412) || !gi_132) gi_264 = -1; if (Open[l_shift_8] > iCustom(NULL, 0, "FXI_TrendFinder", "09uj089ju#$)JHFihuihdf", "1", "", "", 2, l_shift_8)) gi_264 = -1; if (gi_264 != 2) { gt_unused_452 = Time[l_shift_8]; continue; } if (g_ibuf_240[l_shift_8] == 0.0 && gi_264 != -1) g_ibuf_240[l_shift_8] = iMA(Symbol(), 0, 5, 0, MODE_SMA, PRICE_HIGH, l_shift_8) + 10.0 * Point; } if (gi_264 == -1 && gi_464 <= gi_136) { gi_264 = gi_260; if (gi_264 == 1 && Close[l_shift_8] < g_icustom_300) gi_264 = -1; if (gi_264 == 2 && Close[l_shift_8] > g_icustom_300) gi_264 = -1; if ((gi_264 == 1 && g_istochastic_436 < gi_208) || (gi_264 == 2 && g_istochastic_436 > gi_212)) gi_264 = -1; if (iCustom(NULL, 0, "FXI_TrendFinder", "09uj089ju#$)JHFihuihdf", "0", "", "", 2, l_shift_8) > g_icustom_356 && iCustom(NULL, 0, "FXI_TrendFinder", "09uj089ju#$)JHFihuihdf", "0", "", "", 2, l_shift_8) < g_icustom_348) { if (g_icustom_412 > iCustom(NULL, 0, "FXI_TrendFinder", "09uj089ju#$)JHFihuihdf", "0", "", "", 2, l_shift_8) && gi_264 == 2) gi_264 = -1; if (g_icustom_412 < iCustom(NULL, 0, "FXI_TrendFinder", "09uj089ju#$)JHFihuihdf", "0", "", "", 2, l_shift_8) && gi_264 == 1) gi_264 = -1; } else { if ((gi_264 == 1 && g_icustom_348 < iCustom(NULL, 0, "FXI_TrendFinder", "09uj089ju#$)JHFihuihdf", "0", "", "", 2, l_shift_8)) || (gi_264 == 2 && g_icustom_356 > iCustom(NULL, 0, "FXI_TrendFinder", "09uj089ju#$)JHFihuihdf", "0", "", "", 2, l_shift_8)) && gi_264 != -1) gi_264 = -1; } if ((gi_264 == 1 && iCCI(NULL, 0, 14, PRICE_CLOSE, l_shift_8) < 100.0) || (gi_264 == 2 && iCCI(NULL, 0, 14, PRICE_CLOSE, l_shift_8) > -100.0)) gi_264 = -1; if (gi_264 == 1) { if (g_icustom_468 <= g_icustom_348) gi_264 = -1; else { if (g_ibuf_236[l_shift_8] == 0.0) { g_ibuf_236[l_shift_8] = iMA(Symbol(), 0, 5, 0, MODE_SMA, PRICE_LOW, l_shift_8) - 10.0 * Point; gt_unused_456 = Time[l_shift_8]; } } } if (gi_264 == 2) { if (g_icustom_468 >= g_icustom_356) gi_264 = -1; else { if (g_ibuf_240[l_shift_8] == 0.0) { g_ibuf_240[l_shift_8] = iMA(Symbol(), 0, 5, 0, MODE_SMA, PRICE_HIGH, l_shift_8) + 10.0 * Point; gt_unused_456 = Time[l_shift_8]; } } } } } return (0); } bool checkVerInfo() { if (Copyright == "verCheckInfo") { IndicatorBuffers(1); SetIndexBuffer(0, g_ibuf_120); SetIndexStyle(0, DRAW_NONE); return (TRUE); } return (FALSE); } void slideArray(int ai_0, double ad_4, int ai_12) { for (int li_16 = ai_12 - 1; li_16 >= 0; li_16--) { if (ai_0 == 1) gda_536[li_16 + 1] = gda_536[li_16]; else gda_540[li_16 + 1] = gda_540[li_16]; } if (ai_0 == 1) gda_536[0] = ad_4; if (ai_0 == 2) gda_540[0] = ad_4; } int SquishSquash() { int l_index_68; int l_ind_counted_0 = IndicatorCounted(); double ld_52 = 0; double ld_60 = 0; if (ArrayResize(gda_536, gi_520 + 2) == -1) { Print("Cannot resize array!"); return (0); } if (ArrayResize(gda_540, gi_524 + 2) == -1) { Print("Cannot resize array!"); return (0); } if (l_ind_counted_0 < 0) return (-1); int li_76 = Bars - l_ind_counted_0; momentum(li_76); for (int li_80 = li_76; li_80 >= 0; li_80--) { for (int li_72 = li_80; li_72 < li_80 + gd_488; li_72++) ld_52 += gd_496 * ((High[li_72] - Open[li_72]) / 2.0); ld_60 = ld_52 / gd_488; ld_52 = 0; slideArray(1, ld_60, gi_520); for (li_72 = li_80; li_72 < li_80 + gd_504; li_72++) ld_52 += gd_512 * ((Open[li_72] - Low[li_72]) / 2.0); ld_60 = ld_52 / gd_504; ld_52 = 0; slideArray(2, ld_60, gi_524); if (gda_540[gi_524] == EMPTY_VALUE || gda_536[gi_520] == EMPTY_VALUE) continue; l_index_68 = 0; for (li_72 = li_80; li_72 < li_80 + gi_520; li_72++) { ld_52 += High[li_72] + gda_536[l_index_68]; l_index_68++; } if ((High[li_80 + 1] + (Low[li_80 + 1])) / 2.0 < (High[li_80] + Low[li_80]) / 2.0 && g_pips_528 * Point < g_ibuf_556[li_80]) ld_60 = ld_52 / gi_520 + g_ibuf_556[li_80]; else ld_60 = ld_52 / gi_520; ld_52 = 0; g_ibuf_544[li_80] = ld_60; l_index_68 = 0; for (li_72 = li_80; li_72 < li_80 + gi_524; li_72++) { ld_52 += Low[li_72] - gda_540[l_index_68]; l_index_68++; } if ((High[li_80 + 1] + (Low[li_80 + 1])) / 2.0 > (High[li_80] + Low[li_80]) / 2.0 && g_pips_528 * Point < g_ibuf_556[li_80]) ld_60 = ld_52 / gi_524 - g_ibuf_556[li_80]; else ld_60 = ld_52 / gi_524; ld_52 = 0; g_ibuf_548[li_80] = ld_60; g_ibuf_552[li_80] = (g_ibuf_544[li_80] + g_ibuf_548[li_80]) / 2.0; } return (0); } void momentum(int ai_0) { for (int l_index_4 = 0; l_index_4 <= ai_0; l_index_4++) g_ibuf_556[l_index_4] = MathAbs((High[l_index_4 + 1] + (Low[l_index_4 + 1])) / 2.0 - (High[l_index_4] + Low[l_index_4]) / 2.0) / 2.0; } int Ratchet() { int l_ind_counted_0 = IndicatorCounted(); int li_4 = Bars - l_ind_counted_0 - 1; if (li_4 > 0) li_4--; if (li_4 < 0) return (-1); for (int li_8 = li_4; li_8 >= 0; li_8--) { if (gi_560) gd_592 = Close[li_8]; else gd_592 = Open[li_8]; if (gi_264 == -1) { if (Open[li_8] > Close[li_8]) { gi_264 = 2; g_ibuf_568[li_8] = gi_264; g_time_588 = Time[li_8]; g_ibuf_600[li_8] = High[li_8 + 1]; } else { gi_264 = 1; g_ibuf_568[li_8] = gi_264; g_time_588 = Time[li_8]; g_ibuf_600[li_8] = Low[li_8 + 1]; } } if (gi_264 == 1 && Time[li_8] > g_time_588) { g_ibuf_568[li_8] = g_ibuf_568[li_8 + 1]; if (gi_564) { if (Open[li_8 + 1] < Close[li_8 + 1]) g_ibuf_600[li_8] = g_ibuf_600[li_8 + 1] + (Close[li_8 + 1] - (Open[li_8 + 1])); else g_ibuf_600[li_8] = g_ibuf_600[li_8 + 1]; } else g_ibuf_600[li_8] = g_ibuf_600[li_8 + 1] + MathAbs(Close[li_8 + 1] - (Open[li_8 + 1])); if (gd_592 < g_ibuf_600[li_8]) { g_time_588 = Time[li_8]; g_ibuf_600[li_8] = High[li_8 + 1]; gi_264 = 2; g_ibuf_568[li_8] = gi_264; } } if (gi_264 == 2 && Time[li_8] > g_time_588) { g_ibuf_568[li_8] = g_ibuf_568[li_8 + 1]; if (gi_564) { if (Open[li_8 + 1] > Close[li_8 + 1]) g_ibuf_600[li_8] = g_ibuf_600[li_8 + 1] - (Open[li_8 + 1] - (Close[li_8 + 1])); else g_ibuf_600[li_8] = g_ibuf_600[li_8 + 1]; } else g_ibuf_600[li_8] = g_ibuf_600[li_8 + 1] - MathAbs(Open[li_8 + 1] - (Close[li_8 + 1])); if (gd_592 > g_ibuf_600[li_8]) { gi_264 = 1; g_ibuf_568[li_8] = gi_264; g_time_588 = Time[li_8]; g_ibuf_600[li_8] = Low[li_8 + 1]; } } } return (0); } int HeikenAshi() { double ld_0; double ld_8; double ld_16; double ld_24; if (Bars <= 10) return (0); gi_616 = IndicatorCounted(); if (gi_616 < 0) return (-1); if (gi_616 > 0) gi_616--; for (int li_32 = Bars - gi_616 - 1; li_32 >= 0; li_32--) { ld_24 = NormalizeDouble((Open[li_32] + High[li_32] + Low[li_32] + Close[li_32]) / 4.0, Digits); ld_0 = NormalizeDouble((g_ibuf_608[li_32 + 1] + (g_ibuf_612[li_32 + 1])) / 2.0, Digits); ld_8 = MathMax(High[li_32], MathMax(ld_0, ld_24)); ld_16 = MathMin(Low[li_32], MathMin(ld_0, ld_24)); if (ld_0 < ld_24) { g_ibuf_600[li_32] = ld_16; g_ibuf_604[li_32] = ld_8; } else { g_ibuf_600[li_32] = ld_8; g_ibuf_604[li_32] = ld_16; } g_ibuf_608[li_32] = ld_0; g_ibuf_612[li_32] = ld_24; } return (0); } int PAC() { double ld_8; int l_ind_counted_0 = IndicatorCounted(); int li_4 = Bars - l_ind_counted_0; if (li_4 > 0) li_4--; if (li_4 < 0) return (-1); for (int li_16 = li_4; li_16 >= 0; li_16--) { g_ibuf_600[li_16] = High[iHighest(NULL, 0, MODE_HIGH, gi_140, li_16 + 1)]; g_ibuf_604[li_16] = Low[iLowest(NULL, 0, MODE_LOW, gi_140, li_16 + 1)]; ld_8 = MathAbs(g_ibuf_600[li_16] - g_ibuf_604[li_16]); g_ibuf_608[li_16] = ld_8 / 2.0 + g_ibuf_604[li_16]; if (Open[li_16] > g_ibuf_608[li_16]) { g_ibuf_628[li_16] = 1.0; g_ibuf_632[li_16] = 0.0; } else { g_ibuf_628[li_16] = 0.0; g_ibuf_632[li_16] = 1.0; } } return (0); }