#property copyright "Copyright © 2009, Thomas Liles." #property link "http://www.trendchaser.org" #import "http51.dll" string httpGET(string a0, int& a1[]); #import string gs_76 = "trendchaser.org/updates/trendchasers_super_ea.html"; string gs_84 = "trendchaser.org/updates/"; double gd_92 = 2.2; string gs_100 = "0123456789ABCDEF"; int g_magic_108 = 321984321; extern double risk = 0.1; extern int risk_pips = 30; extern bool draw_indies = TRUE; int g_timeframe_128; int g_timeframe_132; int g_str2int_136; int g_str2int_140; int g_str2int_144; double gd_148 = 0.0; double gd_156 = 0.0; double g_isar_164; double g_isar_172; double g_ima_180; double g_ima_188; double g_iclose_196; string gs_204; int gi_212; int gi_216; int g_timeframe_224; int g_period_228; int gi_232; int g_timeframe_236; int g_period_240; int gi_244; int gi_248; int gi_252; int g_count_256; int g_count_260; double gd_264 = 60.0; double gd_272; double gd_280; double gd_288; double gd_296; double gd_304; double gd_312; double g_global_var_320; bool gi_328; bool gi_332; bool gi_336; bool gi_340; bool gi_344; bool gi_348; bool gi_352; bool gi_356; double gd_360 = 0.0; double gd_368; double g_global_var_376; double gd_384; double g_lots_392; double gd_400; double gd_408; string gs_416; string URLEncode(string as_0) { string ls_24; int li_32; int l_str_len_8 = StringLen(as_0); string l_str_concat_12 = ""; for (int li_20 = 0; li_20 < l_str_len_8; li_20++) { ls_24 = StringSubstr(as_0, li_20, 1); li_32 = StringGetChar(ls_24, 0); if ((li_32 > '/' && li_32 < ':') || (li_32 > '@' && li_32 < '[') || (li_32 > '`' && li_32 < '{')) l_str_concat_12 = StringConcatenate(l_str_concat_12, ls_24); else { if (li_32 == ' ') l_str_concat_12 = StringConcatenate(l_str_concat_12, "+"); else l_str_concat_12 = StringConcatenate(l_str_concat_12, "%", hex(li_32)); } } return (l_str_concat_12); } string ArrayEncode(string asa_0[][]) { string ls_12; string ls_20; string l_str_concat_4 = ""; int li_28 = ArrayRange(asa_0, 0); for (int l_index_32 = 0; l_index_32 < li_28; l_index_32++) { ls_12 = URLEncode(asa_0[l_index_32][0]); ls_20 = URLEncode(asa_0[l_index_32][1]); l_str_concat_4 = StringConcatenate(l_str_concat_4, ls_12, "=", ls_20); if (l_index_32 + 1 < li_28) l_str_concat_4 = StringConcatenate(l_str_concat_4, "&"); } return (l_str_concat_4); } void addParam(string as_0, string as_8, string &asa_16[][]) { int li_20 = ArrayRange(asa_16, 0); if (ArrayResize(asa_16, li_20 + 1) > -1) { asa_16[li_20][0] = as_0; asa_16[li_20][1] = as_8; } } string hex(int ai_0) { string l_str_concat_4 = ""; int li_12 = ai_0 % 16; int li_16 = (ai_0 - li_12) / 16; if (li_16 > 15) l_str_concat_4 = StringConcatenate(hex(li_16), StringSubstr(gs_100, li_12, 1)); else l_str_concat_4 = StringConcatenate(StringSubstr(gs_100, li_16, 1), StringSubstr(gs_100, li_12, 1)); return (l_str_concat_4); } int init() { gs_84 = gs_84 + WindowExpertName(); get_settings(); if (!GlobalVariableCheck(WindowExpertName() + " current_bar " + Symbol() + " " + IsTesting() + "")) GlobalVariableSet(WindowExpertName() + " current_bar " + Symbol() + " " + IsTesting() + "", iBarShift(NULL, PERIOD_D1, 1)); if (!GlobalVariableCheck(WindowExpertName() + " grid " + Symbol() + " " + IsTesting() + "")) GlobalVariableSet(WindowExpertName() + " grid " + Symbol() + " " + IsTesting() + "", 0.0001); if (IsTesting()) gi_212 = 3; if (Point == 0.0001) gd_280 = 0.0001; if (Point == 0.00001) gd_280 = 0.0001; if (Point == 0.01) gd_280 = 0.01; if (Point == 0.001) gd_280 = 0.01; if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.001) gi_248 = 3; if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.01) gi_248 = 2; if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.1) gi_248 = 1; if (MarketInfo(Symbol(), MODE_LOTSTEP) == 1.0) gi_248 = 0; if (Period() == PERIOD_M5) draw2(); return (0); } int deinit() { GlobalVariableDel(WindowExpertName() + " current_bar " + Symbol() + " " + 1 + ""); GlobalVariableDel(WindowExpertName() + " security " + Symbol() + " " + 1 + ""); GlobalVariableDel(WindowExpertName() + " goal " + Symbol() + " " + 1 + ""); GlobalVariableDel(WindowExpertName() + " lots " + Symbol() + " " + 1 + ""); GlobalVariableDel(WindowExpertName() + " grid " + Symbol() + " " + 1 + ""); return (0); } int start() { ObjectDelete("update"); ObjectDelete("update2"); HideTestIndicators(TRUE); if (!IsTesting()) secure(); if (!IsTesting()) msgs(); if (gd_148 == 0.0) get_settings(); run_indies(); if (draw_indies) draw(); orders(); check_exit(); lots(); if (!gi_336 && !gi_340 && !gi_344) trade(); HideTestIndicators(FALSE); objects(); updates(); if (ObjectFind("failed") != -1 && gi_212 == 3) { ObjectDelete("failed2"); ObjectDelete("failed"); ObjectDelete("failed3"); } if (gi_212 != 3 && !IsDemo() && !IsTesting()) { if (ObjectFind("failed") == -1) ObjectCreate("failed", OBJ_LABEL, 0, 0, 0); ObjectSet("failed", OBJPROP_BACK, FALSE); ObjectSet("failed", OBJPROP_CORNER, 0); ObjectSet("failed", OBJPROP_XDISTANCE, 50); ObjectSet("failed", OBJPROP_YDISTANCE, 160); ObjectSetText("failed", "to use this ea on a live account", 14, "Times New Roman", Red); ObjectCreate("failed2", OBJ_LABEL, 0, 0, 0); ObjectSet("failed2", OBJPROP_BACK, FALSE); ObjectSet("failed2", OBJPROP_CORNER, 0); ObjectSet("failed2", OBJPROP_XDISTANCE, 50); ObjectSet("failed2", OBJPROP_YDISTANCE, 190); ObjectSetText("failed2", "purchase some days at", 14, "Times New Roman", Red); ObjectCreate("failed3", OBJ_LABEL, 0, 0, 0); ObjectSet("failed3", OBJPROP_BACK, FALSE); ObjectSet("failed3", OBJPROP_CORNER, 0); ObjectSet("failed3", OBJPROP_XDISTANCE, 50); ObjectSet("failed3", OBJPROP_YDISTANCE, 220); ObjectSetText("failed3", "trendchaser.org/purchase.html", 14, "Times New Roman", Red); } if (!GlobalVariableCheck(WindowExpertName() + " goal " + IsTesting())) GlobalVariableSet(WindowExpertName() + " goal " + IsTesting(), AccountBalance()); double l_global_var_0 = GlobalVariableGet(WindowExpertName() + " goal " + IsTesting()); if (ObjectFind("score") == -1) { ObjectCreate("score", OBJ_LABEL, 0, 0, 0); ObjectSet("score", OBJPROP_BACK, FALSE); ObjectSet("score", OBJPROP_CORNER, 1); ObjectSet("score", OBJPROP_XDISTANCE, 7); ObjectSet("score", OBJPROP_YDISTANCE, 68); } if (ObjectFind("score") != -1 && ObjectGet("score", OBJPROP_XDISTANCE) != 7.0) { ObjectSet("score", OBJPROP_XDISTANCE, 7); ObjectSet("score", OBJPROP_YDISTANCE, 68); GlobalVariableSet(WindowExpertName() + " goal " + IsTesting(), AccountBalance()); } ObjectSetText("score", "score = " + DoubleToStr(100.0 * ((AccountEquity() - l_global_var_0) / l_global_var_0), 2) + "", 14, "Times New Roman", Yellow); return (0); } void run_indies() { gs_416 = "none"; gi_332 = FALSE; g_iclose_196 = iClose(NULL, 0, 0); g_isar_164 = iSAR(NULL, g_timeframe_128, gd_148, 0.2, 0); g_isar_172 = iSAR(NULL, g_timeframe_132, gd_156, 0.2, 0); g_ima_180 = iMA(NULL, g_timeframe_224, g_period_228, gi_232, MODE_SMA, PRICE_OPEN, 0); g_ima_188 = iMA(NULL, g_timeframe_236, g_period_240, gi_244, MODE_SMA, PRICE_OPEN, 0); if (g_ima_180 > g_ima_188 && g_ima_180 - g_ima_188 >= g_str2int_144 * gd_280) gi_332 = TRUE; if (g_ima_180 < g_ima_188 && g_ima_188 - g_ima_180 >= g_str2int_144 * gd_280) gi_332 = TRUE; if (g_iclose_196 > g_isar_164) gi_356 = TRUE; if (g_iclose_196 < g_isar_164) gi_352 = TRUE; if (!gi_332) gi_336 = TRUE; if (gi_332) { if (g_iclose_196 > g_isar_164 && g_iclose_196 > g_isar_172 && g_ima_180 > g_ima_188) gs_416 = "buy"; if (g_iclose_196 < g_isar_164 && g_iclose_196 < g_isar_172 && g_ima_180 < g_ima_188) gs_416 = "sell"; } } void trade() { int li_0 = g_count_256 + g_count_260; if (g_iclose_196 > GlobalVariableGet(WindowExpertName() + " grid " + Symbol() + " " + IsTesting() + "") + g_str2int_140 * gd_280 || g_iclose_196 < GlobalVariableGet(WindowExpertName() + " grid " + Symbol() + " " + IsTesting() + "") - g_str2int_140 * gd_280) { if (li_0 < g_str2int_136 && gi_352 && gi_332 && gs_416 == "buy" && g_count_260 == 0) { OrderSend(Symbol(), OP_BUY, g_lots_392, Ask, 3, 0, 0, WindowExpertName(), g_magic_108, 0, Blue); orders(); } if (li_0 < g_str2int_136 && gi_356 && gi_332 && gs_416 == "sell" && g_count_256 == 0) { OrderSend(Symbol(), OP_SELL, g_lots_392, Bid, 3, 0, 0, WindowExpertName(), g_magic_108, 0, Red); orders(); } } if (g_count_256 + g_count_260 > li_0) { GlobalVariableSet(WindowExpertName() + " lots " + Symbol() + " " + IsTesting() + "", GlobalVariableGet(WindowExpertName() + " lots " + Symbol() + " " + IsTesting() + "") + gd_312); GlobalVariableSet(WindowExpertName() + " grid " + Symbol() + " " + IsTesting() + "", g_iclose_196); gi_352 = FALSE; gi_356 = FALSE; } } void lots() { gd_312 = AccountFreeMargin() / MarketInfo(Symbol(), MODE_MARGINREQUIRED) / AccountLeverage() * risk / risk_pips; gd_312 = 100.0 * gd_312; if (gd_312 < MarketInfo(Symbol(), MODE_MINLOT)) gd_312 = MarketInfo(Symbol(), MODE_MINLOT); if (gd_312 > MarketInfo(Symbol(), MODE_MAXLOT)) gd_312 = MarketInfo(Symbol(), MODE_MAXLOT); gd_312 = NormalizeDouble(gd_312, gi_248); if (!GlobalVariableCheck(WindowExpertName() + " lots " + Symbol() + " " + IsTesting() + "")) GlobalVariableSet(WindowExpertName() + " lots " + Symbol() + " " + IsTesting() + "", gd_312); g_global_var_320 = GlobalVariableGet(WindowExpertName() + " lots " + Symbol() + " " + IsTesting() + ""); if (gd_312 >= g_global_var_320) { g_lots_392 = gd_312; return; } g_lots_392 = g_global_var_320; } void check_exit() { if (!GlobalVariableCheck(WindowExpertName() + " goal " + Symbol() + " " + IsTesting() + "")) GlobalVariableSet(WindowExpertName() + " goal " + Symbol() + " " + IsTesting() + "", AccountBalance()); g_global_var_376 = GlobalVariableGet(WindowExpertName() + " goal " + Symbol() + " " + IsTesting() + ""); if (100.0 * ((gd_400 - g_global_var_376) / g_global_var_376) >= risk) { gi_336 = TRUE; gi_348 = TRUE; } if (gd_288 > gd_296) { ObjectDelete("target2"); gd_304 = gd_288 - gd_296; gd_368 = g_global_var_376 - gd_400; gd_384 = gd_368 + g_global_var_376 / 100.0 * risk; if (gi_248 == 1) gd_368 = gd_368 / gd_304 / 10.0; if (gi_248 == 1) gd_384 = gd_384 / gd_304 / 10.0; if (gi_248 == 2) gd_368 /= gd_304; if (gi_248 == 2) gd_384 /= gd_304; } if (gd_288 < gd_296) { ObjectDelete("target1"); gd_304 = gd_296 - gd_288; gd_368 = g_global_var_376 - AccountEquity(); gd_384 = gd_368 + g_global_var_376 / 100.0 * risk; if (gi_248 == 1) gd_368 = gd_368 / gd_304 / 10.0; if (gi_248 == 1) gd_384 = gd_384 / gd_304 / 10.0; if (gi_248 == 2) gd_368 /= gd_304; if (gi_248 == 2) gd_384 /= gd_304; } if (gd_288 > gd_296 && ObjectFind("target1") == -1) { ObjectCreate("target1", OBJ_ARROW, 0, 0, 0); ObjectSet("target1", OBJPROP_ARROWCODE, 4); ObjectSet("target1", OBJPROP_COLOR, Yellow); } ObjectSet("target1", OBJPROP_PRICE1, Ask + gd_384 * gd_280); ObjectSet("target1", OBJPROP_TIME1, iTime(NULL, 0, 0)); if (gd_288 < gd_296 && ObjectFind("target2") == -1) { ObjectCreate("target2", OBJ_ARROW, 0, 0, 0); ObjectSet("target2", OBJPROP_ARROWCODE, 4); ObjectSet("target2", OBJPROP_COLOR, Yellow); } ObjectSet("target2", OBJPROP_PRICE1, Bid - gd_384 * gd_280); ObjectSet("target2", OBJPROP_TIME1, iTime(NULL, 0, 0)); if (gd_288 == 0.0 || gd_288 == gd_296) ObjectDelete("target1"); if (gd_296 == 0.0 || gd_288 == gd_296) ObjectDelete("target2"); if (gi_336) { close_all(); orders(); } if (g_count_256 == 0 && g_count_260 == 0 && gi_336) { gi_336 = FALSE; orders(); } if (gi_340) { close_longs(); orders(); } if (g_count_256 == 0 && gi_340) { gi_340 = FALSE; orders(); } if (gi_344) { close_shorts(); orders(); } if (g_count_260 == 0 && gi_344) { gi_344 = FALSE; orders(); } if (gi_348 && g_count_256 == 0 && g_count_260 == 0) { GlobalVariableSet(WindowExpertName() + " grid " + Symbol() + " " + IsTesting() + "", 0.0001); GlobalVariableSet(WindowExpertName() + " lots " + Symbol() + " " + IsTesting() + "", gd_312); gi_348 = FALSE; GlobalVariableSet(WindowExpertName() + " goal " + Symbol() + " " + IsTesting() + "", AccountBalance()); } } void draw() { if (gi_252 != iBarShift(NULL, 0, 0)) { ObjectCreate(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJ_TREND, 0, 0, 0); ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_PRICE1, g_isar_164); ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_PRICE2, g_isar_164); ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_TIME1, iTime(NULL, 0, 0)); ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_TIME2, iTime(NULL, 0, 0)); ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_COLOR, Gray); if (g_ima_180 > g_ima_188 && g_ima_180 - g_ima_188 >= g_str2int_144 * gd_280 && g_iclose_196 > g_isar_164) ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_COLOR, Blue); if (g_ima_180 > g_ima_188 && g_ima_188 - g_ima_180 >= g_str2int_144 * gd_280 && g_iclose_196 < g_isar_164) ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_COLOR, Red); ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_RAY, FALSE); ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_WIDTH, 5); ObjectSet(IsTesting() + " sar1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_BACK, TRUE); ObjectCreate(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJ_TREND, 0, 0, 0); ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_PRICE1, g_isar_172); ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_PRICE2, g_isar_172); ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_TIME1, iTime(NULL, 0, 0)); ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_TIME2, iTime(NULL, 0, 0)); ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_COLOR, Gray); if (g_ima_180 > g_ima_188 && g_ima_180 - g_ima_188 >= g_str2int_144 * gd_280 && g_iclose_196 > g_isar_172) ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_COLOR, Blue); if (g_ima_180 > g_ima_188 && g_ima_188 - g_ima_180 >= g_str2int_144 * gd_280 && g_iclose_196 < g_isar_172) ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_COLOR, Red); ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_RAY, FALSE); ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_WIDTH, 5); ObjectSet(IsTesting() + " sar2 " + iBarShift(NULL, 0, 0) + "", OBJPROP_BACK, TRUE); ObjectCreate(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJ_TREND, 0, 0, 0); ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_PRICE1, g_ima_180); ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_PRICE2, g_ima_188); ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_TIME1, iTime(NULL, 0, 0)); ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_TIME2, iTime(NULL, 0, 0)); ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_COLOR, Gray); if (g_ima_180 > g_ima_188 && g_ima_180 - g_ima_188 >= g_str2int_144 * gd_280) ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_COLOR, DodgerBlue); if (g_ima_180 < g_ima_188 && g_ima_188 - g_ima_180 >= g_str2int_144 * gd_280) ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_COLOR, Orange); ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_RAY, FALSE); ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_WIDTH, 0); ObjectSet(IsTesting() + " ma1 " + iBarShift(NULL, 0, 0) + "", OBJPROP_BACK, TRUE); } } void draw2() { double l_iclose_0; double l_isar_8; double l_isar_16; double l_ima_24; double l_ima_32; for (int li_40 = 1; li_40 <= Bars; li_40++) { l_iclose_0 = iClose(NULL, 0, li_40); l_isar_8 = iSAR(NULL, g_timeframe_128, gd_148, 0.2, li_40); l_isar_16 = iSAR(NULL, g_timeframe_132, gd_156, 0.2, li_40); l_ima_24 = iMA(NULL, g_timeframe_224, g_period_228, gi_232, MODE_SMA, PRICE_OPEN, li_40); l_ima_32 = iMA(NULL, g_timeframe_236, g_period_240, gi_244, MODE_SMA, PRICE_OPEN, li_40); ObjectCreate(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJ_TREND, 0, 0, 0); ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_PRICE1, l_isar_8); ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_PRICE2, l_isar_8); ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_TIME1, iTime(NULL, 0, li_40)); ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_TIME2, iTime(NULL, 0, li_40)); ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_COLOR, Gray); if (l_ima_24 > l_ima_32 && g_iclose_196 > l_isar_8 && l_ima_24 - l_ima_32 >= g_str2int_144 * gd_280) ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_COLOR, Blue); if (l_ima_24 < l_ima_32 && g_iclose_196 < l_isar_8 && l_ima_32 - l_ima_24 >= g_str2int_144 * gd_280) ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_COLOR, Red); ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_RAY, FALSE); ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_WIDTH, 5); ObjectSet(IsTesting() + " sar1 " + iTime(NULL, 0, li_40) + "", OBJPROP_BACK, TRUE); ObjectCreate(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJ_TREND, 0, 0, 0); ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_PRICE1, l_isar_16); ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_PRICE2, l_isar_16); ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_TIME1, iTime(NULL, 0, li_40)); ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_TIME2, iTime(NULL, 0, li_40)); ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_COLOR, Gray); if (l_ima_24 > l_ima_32 && l_iclose_0 > l_isar_16 && l_ima_24 - l_ima_32 >= g_str2int_144 * gd_280) ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_COLOR, Blue); if (l_ima_24 < l_ima_32 && l_iclose_0 < l_isar_16 && l_ima_32 - l_ima_24 >= g_str2int_144 * gd_280) ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_COLOR, Red); ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_RAY, FALSE); ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_WIDTH, 5); ObjectSet(IsTesting() + " sar2 " + iTime(NULL, 0, li_40) + "", OBJPROP_BACK, TRUE); ObjectCreate(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJ_TREND, 0, 0, 0); ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_PRICE1, l_ima_24); ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_PRICE2, l_ima_32); ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_TIME1, iTime(NULL, 0, li_40)); ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_TIME2, iTime(NULL, 0, li_40)); ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_COLOR, Gray); if (l_ima_24 > l_ima_32 && l_ima_24 - l_ima_32 >= g_str2int_144 * gd_280) ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_COLOR, DodgerBlue); if (l_ima_24 < l_ima_32 && l_ima_32 - l_ima_24 >= g_str2int_144 * gd_280) ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_COLOR, Orange); ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_RAY, FALSE); ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_WIDTH, 0); ObjectSet(IsTesting() + " ma1 " + iTime(NULL, 0, li_40) + "", OBJPROP_BACK, TRUE); } } void get_settings() { string lsa_4[][2]; int lia_8[1]; ArrayResize(lsa_4, 0); addParam("Bid", Bid, lsa_4); addParam("Ask", Ask, lsa_4); string ls_12 = ArrayEncode(lsa_4); string ls_20 = httpGET("http://trendchaser.org/updates/trendchasers_super_ea/settings.cvs?" + ls_12, lia_8); int l_file_0 = FileOpen("settings.cvs", FILE_CSV|FILE_WRITE, ';'); if (l_file_0 > 0) { FileWrite(l_file_0, ls_20); FileClose(l_file_0); l_file_0 = 0; } int l_file_28 = FileOpen("settings.cvs", FILE_CSV|FILE_WRITE|FILE_READ, ';'); if (l_file_28 > 0 && FileSize(l_file_28) > 2) { gs_204 = FileReadString(l_file_28); FileReadString(l_file_28); FileReadString(l_file_28); gd_148 = StrToDouble(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); g_timeframe_128 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); gd_156 = StrToDouble(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); g_timeframe_132 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); g_str2int_136 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); g_str2int_140 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); g_str2int_144 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); g_timeframe_224 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); g_period_228 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); gi_232 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); g_timeframe_236 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); g_period_240 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); FileReadString(l_file_28); gi_244 = StrToInteger(FileReadString(l_file_28)); FileReadString(l_file_28); } FileClose(l_file_28); FileDelete("settings.cvs"); } void msgs() { string ls_unused_0; string ls_unused_8; int l_file_16; string lsa_20[][2]; int lia_24[1]; string ls_28; string ls_36; int l_str2int_44; int l_str2int_48; int l_str2int_52; string l_text_56; string ls_64; int l_str2int_72; int l_str2int_76; int l_str2int_80; string l_text_84; string ls_92; int l_str2int_100; int l_str2int_104; int l_str2int_108; string l_text_112; string ls_120; int l_str2int_128; int l_str2int_132; int l_str2int_136; string l_text_140; string ls_148; int l_str2int_156; int l_str2int_160; int l_str2int_164; string l_text_168; gd_272 = 60.0 * gd_264; if (TimeCurrent() < gd_360) gi_328 = FALSE; if (TimeCurrent() > gd_360) gi_328 = TRUE; if (gi_328) { ArrayResize(lsa_20, 0); addParam("Bid", Bid, lsa_20); addParam("Ask", Ask, lsa_20); ls_28 = ArrayEncode(lsa_20); ls_36 = httpGET("http://trendchaser.org/updates/trendchasers_super_ea/msgs.cvs?" + ls_28, lia_24); l_file_16 = FileOpen("msgs.cvs", FILE_CSV|FILE_WRITE, ';'); if (l_file_16 > 0) { FileWrite(l_file_16, ls_36); FileClose(l_file_16); } l_file_16 = FileOpen("msgs.cvs", FILE_CSV|FILE_WRITE|FILE_READ, ';'); if (l_file_16 > 0) { l_str2int_44 = StrToInteger(FileReadString(l_file_16)); l_str2int_48 = StrToInteger(FileReadString(l_file_16)); l_str2int_52 = StrToInteger(FileReadString(l_file_16)); l_text_56 = FileReadString(l_file_16); ls_64 = FileReadString(l_file_16); l_str2int_72 = StrToInteger(FileReadString(l_file_16)); l_str2int_76 = StrToInteger(FileReadString(l_file_16)); l_str2int_80 = StrToInteger(FileReadString(l_file_16)); l_text_84 = FileReadString(l_file_16); ls_92 = FileReadString(l_file_16); l_str2int_100 = StrToInteger(FileReadString(l_file_16)); l_str2int_104 = StrToInteger(FileReadString(l_file_16)); l_str2int_108 = StrToInteger(FileReadString(l_file_16)); l_text_112 = FileReadString(l_file_16); ls_120 = FileReadString(l_file_16); l_str2int_128 = StrToInteger(FileReadString(l_file_16)); l_str2int_132 = StrToInteger(FileReadString(l_file_16)); l_str2int_136 = StrToInteger(FileReadString(l_file_16)); l_text_140 = FileReadString(l_file_16); ls_148 = FileReadString(l_file_16); l_str2int_156 = StrToInteger(FileReadString(l_file_16)); l_str2int_160 = StrToInteger(FileReadString(l_file_16)); l_str2int_164 = StrToInteger(FileReadString(l_file_16)); l_text_168 = FileReadString(l_file_16); if (ObjectFind("code") == -1) ObjectCreate("code", OBJ_LABEL, 0, 0, 0); ObjectSet("code", OBJPROP_BACK, FALSE); ObjectSet("code", OBJPROP_CORNER, l_str2int_44); ObjectSet("code", OBJPROP_XDISTANCE, l_str2int_48); ObjectSet("code", OBJPROP_YDISTANCE, l_str2int_52); ObjectSetText("code", l_text_56, 14, "Times New Roman", White); if (ObjectFind("code2") == -1) ObjectCreate("code2", OBJ_LABEL, 0, 0, 0); ObjectSet("code2", OBJPROP_BACK, FALSE); ObjectSet("code2", OBJPROP_CORNER, l_str2int_72); ObjectSet("code2", OBJPROP_XDISTANCE, l_str2int_76); ObjectSet("code2", OBJPROP_YDISTANCE, l_str2int_80); ObjectSetText("code2", l_text_84, 14, "Times New Roman", White); if (ObjectFind("code3") == -1) ObjectCreate("code3", OBJ_LABEL, 0, 0, 0); ObjectSet("code3", OBJPROP_BACK, FALSE); ObjectSet("code3", OBJPROP_CORNER, l_str2int_100); ObjectSet("code3", OBJPROP_XDISTANCE, l_str2int_104); ObjectSet("code3", OBJPROP_YDISTANCE, l_str2int_108); ObjectSetText("code3", l_text_112, 14, "Times New Roman", White); if (ObjectFind("code4") == -1) ObjectCreate("code4", OBJ_LABEL, 0, 0, 0); ObjectSet("code4", OBJPROP_BACK, FALSE); ObjectSet("code4", OBJPROP_CORNER, l_str2int_128); ObjectSet("code4", OBJPROP_XDISTANCE, l_str2int_132); ObjectSet("code4", OBJPROP_YDISTANCE, l_str2int_136); ObjectSetText("code4", l_text_140, 14, "Times New Roman", White); if (ObjectFind("code5") == -1) ObjectCreate("code5", OBJ_LABEL, 0, 0, 0); ObjectSet("code5", OBJPROP_BACK, FALSE); ObjectSet("code5", OBJPROP_CORNER, l_str2int_156); ObjectSet("code5", OBJPROP_XDISTANCE, l_str2int_160); ObjectSet("code5", OBJPROP_YDISTANCE, l_str2int_164); ObjectSetText("code5", l_text_168, 14, "Times New Roman", White); FileClose(l_file_16); FileDelete("msgs.cvs"); gd_360 = TimeCurrent() + gd_272; } } } void secure() { if (gi_212 == 3 && GlobalVariableGet(WindowExpertName() + " current_bar " + Symbol() + " " + IsTesting() + "") != iBarShift(NULL, PERIOD_D1, 0)) { security(); GlobalVariableSet(WindowExpertName() + " current_bar " + Symbol() + " " + IsTesting() + "", iBarShift(NULL, PERIOD_D1, 0)); gd_360 = TimeCurrent() + gd_272; } if (gi_212 != 3) security(); } void security() { string ls_0; string ls_8; string lsa_20[][2]; int lia_24[1]; int l_str2int_44; if (!GlobalVariableCheck(WindowExpertName() + " security " + Symbol() + " " + IsTesting() + "")) GlobalVariableSet(WindowExpertName() + " security " + Symbol() + " " + IsTesting() + "", DayOfYear() - 1); ArrayResize(lsa_20, 0); addParam("Bid", Bid, lsa_20); addParam("Ask", Ask, lsa_20); string ls_28 = ArrayEncode(lsa_20); string ls_36 = httpGET("http://trendchaser.org/updates/accounts.cvs?" + ls_28, lia_24); int l_file_16 = FileOpen("accounts.cvs", FILE_CSV|FILE_WRITE, ';'); if (l_file_16 > 0) { FileWrite(l_file_16, ls_36); FileClose(l_file_16); } l_file_16 = FileOpen("accounts.cvs", FILE_CSV|FILE_WRITE|FILE_READ, ';'); if (l_file_16 > 0) { l_str2int_44 = StrToInteger(FileReadString(l_file_16)); ls_0 = FileReadString(l_file_16); ls_0 = FileReadString(l_file_16); ls_8 = FileReadString(l_file_16); gi_212 = 0; for (int l_count_48 = 0; l_count_48 <= l_str2int_44; l_count_48++) { if (AccountName() == ls_0 || AccountNumber() == StrToInteger(ls_0)) gi_212 = 2; if (gi_212 == 2 && DayOfYear() <= StrToInteger(ls_8)) { gi_212 = 3; gi_216 = StrToInteger(ls_8) - DayOfYear(); } ls_0 = FileReadString(l_file_16); ls_0 = FileReadString(l_file_16); ls_8 = FileReadString(l_file_16); } } GlobalVariableSet(WindowExpertName() + " security " + Symbol() + " " + IsTesting() + "", DayOfYear()); if (IsDemo() || IsTesting()) gi_212 = 3; if (gi_212 != 3) GlobalVariableSet(WindowExpertName() + " security " + Symbol() + " " + IsTesting() + "", DayOfYear() - 1); FileClose(l_file_16); FileDelete("accounts.cvs"); } void close_all() { int l_ord_total_0 = OrdersTotal(); for (int l_pos_4 = l_ord_total_0 - 1; l_pos_4 >= 0; l_pos_4--) { OrderSelect(l_pos_4, SELECT_BY_POS); if (OrderType() == OP_SELL && OrderMagicNumber() == g_magic_108) OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 0, Red); if (OrderType() == OP_BUY && OrderMagicNumber() == g_magic_108) OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 0, Blue); } } void close_longs() { int l_ord_total_0 = OrdersTotal(); for (int l_pos_4 = l_ord_total_0 - 1; l_pos_4 >= 0; l_pos_4--) { OrderSelect(l_pos_4, SELECT_BY_POS); if (OrderType() == OP_BUY && OrderMagicNumber() == g_magic_108) OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 0, Blue); } } void close_shorts() { int l_ord_total_0 = OrdersTotal(); for (int l_pos_4 = l_ord_total_0 - 1; l_pos_4 >= 0; l_pos_4--) { OrderSelect(l_pos_4, SELECT_BY_POS); if (OrderType() == OP_SELL && OrderMagicNumber() == g_magic_108) OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 0, Red); } } void orders() { g_count_256 = 0; g_count_260 = 0; gd_288 = 0; gd_296 = 0; gd_408 = 0; if (OrdersTotal() == 0) gd_400 = AccountBalance(); int l_ord_total_0 = OrdersTotal(); for (int l_pos_4 = l_ord_total_0 - 1; l_pos_4 >= 0; l_pos_4--) { OrderSelect(l_pos_4, SELECT_BY_POS); if (OrderType() == OP_BUY && OrderMagicNumber() == g_magic_108) { gd_408 += OrderProfit(); g_count_256++; gd_288 += OrderLots(); } if (OrderType() == OP_SELL && OrderMagicNumber() == g_magic_108) { gd_408 += OrderProfit(); g_count_260++; gd_296 += OrderLots(); } } gd_400 = AccountBalance() + gd_408; } void objects() { if (ObjectFind("time") == -1) { ObjectCreate("time", OBJ_LABEL, 0, 0, 0); ObjectSet("time", OBJPROP_BACK, FALSE); } ObjectSet("time", OBJPROP_CORNER, 0); ObjectSet("time", OBJPROP_XDISTANCE, 5); ObjectSet("time", OBJPROP_YDISTANCE, 13); ObjectSetText("time", "" + TimeToStr(TimeCurrent(), TIME_MINUTES|TIME_SECONDS) + " new bar in " + TimeToStr(Time[0] + 60 * Period() - TimeCurrent(), TIME_SECONDS) + "", 12, "Times New Roman", Yellow); if (ObjectFind("status") == -1) ObjectCreate("status", OBJ_LABEL, 0, 0, 0); ObjectSet("status", OBJPROP_BACK, FALSE); ObjectSet("status", OBJPROP_CORNER, 0); ObjectSet("status", OBJPROP_XDISTANCE, 6); ObjectSet("status", OBJPROP_YDISTANCE, 40); if (gi_212 != 3) ObjectSetText("status", "subscription expired", 12, "Times New Roman", Red); if (gi_212 == 3) ObjectSetText("status", "days remaining = " + gi_216 + "", 12, "Times New Roman", Green); if (IsTesting()) ObjectSetText("status", "days remaining = unlimited", 12, "Times New Roman", Green); if (IsDemo()) ObjectSetText("status", "days remaining = unlimited", 12, "Times New Roman", Green); if (ObjectFind("pcnt") == -1) ObjectCreate("pcnt", OBJ_LABEL, 0, 0, 0); ObjectSet("pcnt", OBJPROP_BACK, FALSE); ObjectSet("pcnt", OBJPROP_CORNER, 1); ObjectSet("pcnt", OBJPROP_XDISTANCE, 6); ObjectSet("pcnt", OBJPROP_YDISTANCE, 40); ObjectSetText("pcnt", "" + DoubleToStr(100.0 * ((AccountEquity() - g_global_var_376) / g_global_var_376), 2) + "", 12, "Times New Roman", Red); double ld_0 = 3.0 * (MarketInfo(Symbol(), MODE_MINLOT) * MarketInfo(Symbol(), MODE_MARGINREQUIRED) * AccountLeverage()); if (ObjectFind("capitol") == -1) { ObjectCreate("capitol", OBJ_LABEL, 0, 0, 0); ObjectSet("capitol", OBJPROP_COLOR, Red); ObjectSet("capitol", OBJPROP_CORNER, 0); ObjectSet("capitol", OBJPROP_XDISTANCE, 0); ObjectSet("capitol", OBJPROP_YDISTANCE, 27); } ObjectSetText("capitol", "recommended starting balance= $" + DoubleToStr(ld_0, 0) + "", 10, "Times New Roman", Gray); } void updates() { string ls_unused_0; string ls_unused_8; string lsa_20[][2]; int lia_24[1]; double l_str2dbl_44; ArrayResize(lsa_20, 0); addParam("Bid", Bid, lsa_20); addParam("Ask", Ask, lsa_20); string ls_28 = ArrayEncode(lsa_20); string ls_36 = httpGET("http://" + gs_84 + "/version.cvs?" + ls_28, lia_24); int l_file_16 = FileOpen("version.cvs", FILE_CSV|FILE_WRITE, ';'); if (l_file_16 > 0) { FileWrite(l_file_16, ls_36); FileClose(l_file_16); } l_file_16 = FileOpen("version.cvs", FILE_CSV|FILE_WRITE|FILE_READ, ';'); if (l_file_16 > 0) l_str2dbl_44 = StrToDouble(FileReadString(l_file_16)); if (gd_92 != l_str2dbl_44 && l_str2dbl_44 > 0.0) { ObjectCreate("update", OBJ_LABEL, 0, 0, 0); ObjectSet("update", OBJPROP_BACK, FALSE); ObjectSet("update", OBJPROP_CORNER, 0); ObjectSet("update", OBJPROP_XDISTANCE, 271); ObjectSet("update", OBJPROP_YDISTANCE, 16); ObjectSetText("update", "your version= " + DoubleToStr(gd_92, 2) + " new version= " + DoubleToStr(l_str2dbl_44, 2) + "", 8, "Times New Roman", Red); ObjectCreate("update2", OBJ_LABEL, 0, 0, 0); ObjectSet("update2", OBJPROP_BACK, FALSE); ObjectSet("update2", OBJPROP_CORNER, 0); ObjectSet("update2", OBJPROP_XDISTANCE, 271); ObjectSet("update2", OBJPROP_YDISTANCE, 26); ObjectSetText("update2", "" + gs_76 + "", 8, "Times New Roman", Red); } if (gd_92 == l_str2dbl_44) { ObjectDelete("update"); ObjectDelete("update2"); } FileClose(l_file_16); FileDelete("version.cvs"); }