#property copyright "Copyright © 2009, Group Three LLC" #property link "forexprofitpro.com" extern string _TITLE_ = "Gomega_GBPJPY_v2.12"; extern int Account = 0; extern double Lots = 0.1; extern bool MarketOrderPlatform = FALSE; extern bool SaveScreenShot = FALSE; extern bool AutoMoneyManage = TRUE; extern double PercentofBalanceRisk = 1.0; extern int Slippage = 0; extern int TakeProfit = 500; extern bool AllowBreakEven = TRUE; extern int TimeFrameMinutes = 240; extern string StartEntryTime = "04:00:00"; extern string EndEntryTime = "11:59:59"; extern bool ModifyInitialStop = TRUE; extern double PercentInitialStop = 38.0; extern bool OPEN_BUY_NOW = FALSE; extern bool OPEN_SELL_NOW = FALSE; string gs_yyyyyyy_168 = "YYYYYYY"; int gi_176; int gi_180; int gi_184; int g_count_188; int g_count_192; int g_magic_196; double gd_200; double gd_208; double gd_216; double gd_224; double gd_232; double g_icustom_240; double g_icustom_248; double g_ord_stoploss_256; double gd_264; double gd_272; double gd_280; double gd_288; double gd_296; double gd_304; double gd_312; double g_icustom_320; double g_icustom_328; double g_icustom_336; double g_icustom_344; double g_icustom_352; double gd_360; double gd_368; double gd_376; double gd_384; double gd_392; double gd_400; double gd_408; double g_price_416 = 0.0; double gd_424; double gd_432; double g_ticket_440; double g_ticket_448; bool gi_456; bool gi_460; bool gi_464; int g_datetime_468; int g_datetime_472; string g_comment_476; double gd_484; int g_slippage_492; bool gi_496 = TRUE; int init() { int li_0 = 200; gd_484 = Point; if (Point == 0.00001 || Point == 0.001) gd_484 = 10.0 * Point; string ls_4 = StringSubstr(Symbol(), 3, 3); if (Point == 0.000001 || (Point == 0.0001 && ls_4 == "JPY")) gd_484 = 100.0 * Point; g_slippage_492 = Slippage * gd_484 / Point; gd_312 = 10000; gd_208 = Bid - li_0 * gd_484; gd_216 = Ask + li_0 * gd_484; g_magic_196 = 20090427; gi_176 = StrToTime(StartEntryTime) - StrToTime("00:00:00"); gi_180 = StrToTime(EndEntryTime) - StrToTime("00:00:00"); g_datetime_472 = 0; int li_12 = 20; int li_16 = 65; int li_20 = 120; int li_24 = 105; int li_28 = 45; int li_32 = 140; int li_36 = 125; if (TimeFrameMinutes == PERIOD_M1) g_comment_476 = " M1 Pound-Yen "; if (TimeFrameMinutes == PERIOD_M5) g_comment_476 = " M5 Pound-Yen "; if (TimeFrameMinutes <= 10) { li_12 = 15; li_16 = 18; li_20 = 20; li_24 = 20; li_28 = 10; li_32 = 25; li_36 = 15; } if (TimeFrameMinutes == PERIOD_M15) { li_12 = 20; li_16 = 30; li_20 = 25; li_24 = 40; li_28 = 15; li_32 = 40; li_36 = 24; g_comment_476 = " M15 Pound-Yen "; } if (TimeFrameMinutes == PERIOD_M30) { li_12 = 30; li_16 = 38; li_20 = 35; li_24 = 60; li_28 = 20; li_32 = 60; li_36 = 38; g_comment_476 = " M30 Pound-Yen "; } if (TimeFrameMinutes == PERIOD_H1) { li_12 = 33; li_16 = 45; li_20 = 45; li_24 = 75; li_28 = 30; li_32 = 100; li_36 = 62; g_comment_476 = " H1 Pound-Yen "; } if (TimeFrameMinutes == PERIOD_H4) { li_12 = 20; li_16 = 65; li_20 = 120; li_24 = 105; li_28 = 45; li_32 = 140; li_36 = 125; g_comment_476 = " H4 Pound-Yen "; } if (TimeFrameMinutes >= PERIOD_D1) { li_12 = 52; li_16 = 80; li_20 = 100; li_24 = 150; li_28 = 70; li_32 = 210; li_36 = 138; } if (TimeFrameMinutes == PERIOD_W1) g_comment_476 = " D1 Pound-Yen "; if (TimeFrameMinutes == PERIOD_MN1) g_comment_476 = " MN1 Pound-Yen "; gd_360 = li_12 * gd_484; gd_368 = li_16 * gd_484; gd_376 = li_20 * gd_484; gd_384 = li_24 * gd_484; gd_392 = li_28 * gd_484; gd_400 = li_32 * gd_484; gd_408 = li_36 * gd_484; if (TimeFrameMinutes != Period()) { Alert("Restart EA w/ chart period matching TimeFrameMinutes parameter!"); return (-1); } if (AutoMoneyManage) Alert("Num. Lots calculated using money management rules"); if (!IsExpertEnabled()) Alert("Warning: Expert Advisors are not enabled!"); if (!IsTradeAllowed()) Alert("Warning: Trading allowed is disabled!"); return (0); } int deinit() { gd_312 = 10000; g_icustom_320 = 0.1; ObjectsDeleteAll(); Comment(" "); return (0); } void IsLicenseValid() { Comment("Version ", "Gomega_GBPJPY_v2.12", "\nAcct Allowed ", AccountNumber()); } int start() { int li_0; int l_ord_total_4; IsLicenseValid(); int l_bool_8 = TimeFrameMinutes == Period(); double ld_unused_12 = 1 / l_bool_8; int li_20 = CheckTime(); gd_200 = Ask - Bid; gi_460 = BegBar(); int l_bool_24 = gi_184 != 0; CountOpenTrades(); gi_456 = l_bool_24 * (gi_184 == 0); if (gd_312 == 10000.0 || gi_456) { CalculateIndicators(); l_ord_total_4 = OrdersTotal(); for (int l_pos_28 = 0; l_pos_28 < l_ord_total_4; l_pos_28++) { OrderSelect(l_pos_28, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_196) { if (OrderType() == OP_BUY) g_ticket_440 = OrderTicket(); if (OrderType() == OP_SELL) g_ticket_448 = OrderTicket(); g_ord_stoploss_256 = OrderStopLoss(); break; } } ULHCorner(li_20); } string ls_32 = "2010.08.15"; int l_str2time_40 = StrToTime(ls_32); if (TimeCurrent() >= l_str2time_40) { Alert("La versión ha caducado!"); return (0); } if (gi_496 != FALSE) { if (AccountNumber() != 64285) { Alert("Gomega GBPJPY esta registrado para la cuenta # " + AccountNumber() + "\nSi esta no es tu cuenta registrada", "\nPor favor contacta con juancarlosavilar@gmail.com"); return (0); } } if (gi_456) { g_datetime_472 = iTime(NULL, TimeFrameMinutes, 0); TSLLCross(0, 0.0); TSLSCross(0, 0.0); if (SaveScreenShot) scrnsht(); } if (gi_460) CalculateIndicators(); CountOpenTrades(); if (gi_184 == 0) { if (gi_460 && li_20 && gd_312 == 9999.0) li_0 = Entry(0, 0); if (OPEN_BUY_NOW || OPEN_SELL_NOW) li_0 = Entry(OPEN_BUY_NOW, OPEN_SELL_NOW); } gd_312 = 9999; CountOpenTrades(); ULHCorner(li_20); if (gi_184 != 0) Exit(); return (0); } int BegBar() { int l_datetime_0 = iTime(NULL, TimeFrameMinutes, 0); if (g_datetime_468 == l_datetime_0) return (0); g_datetime_468 = l_datetime_0; return (1); } int Entry(bool ai_0, bool ai_4) { int li_8; int li_12; double l_lots_16; double ld_24; double l_icustom_32; double ld_40; double ld_48; double ld_56; int li_64; int li_68; int li_72; int li_76; int li_80; int li_84; int li_ret_88 = 0; CountOpenTrades(); if (gi_184 != 0) return (0); if (Account == AccountNumber()) { MathSrand(TimeLocal()); li_12 = MathFloor(MathRand() / 64.0); Sleep(li_12); RefreshRates(); li_8 = TakeProfit; l_icustom_32 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 2, 0); if (gi_464) l_icustom_32 = MathMin(gd_280, Bid - gd_376); ld_40 = Point * MathRound(l_icustom_32 / Point); gd_224 = gd_208; if (gi_464) gd_224 = ld_40; l_lots_16 = Lots; li_64 = g_icustom_336 != 0.0; li_68 = g_icustom_352 == 0.0; li_72 = li_64 && li_68; if (!ai_4 && ai_0 || li_72) { if (AutoMoneyManage) { ld_56 = ld_40; if (ModifyInitialStop && PercentInitialStop > 0.0 && !gi_464) ld_56 = Point * MathRound(gd_264 / Point); ld_24 = (Ask - ld_56) / Point; l_lots_16 = NumLots(ld_24); } li_ret_88 = OpnPosn(OP_BUY, l_lots_16, ld_40, li_8, ai_0); g_price_416 = Ask; ModifLong(ld_40); g_ticket_440 = li_ret_88; if (ai_0) Alert("Warning: OPEN_BUY_NOW toggle is ON!"); return (li_ret_88); } l_icustom_32 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 3, 0); if (gi_464) l_icustom_32 = MathMax(gd_288 + gd_200, Ask + gd_376); ld_48 = Point * MathRound(l_icustom_32 / Point); gd_232 = gd_216; if (gi_464) gd_232 = ld_48; li_76 = g_icustom_344 != 0.0; li_80 = g_icustom_352 == 0.0; li_84 = li_76 && li_80; if (ai_4 || li_84) { if (AutoMoneyManage) { ld_56 = ld_48; if (ModifyInitialStop && PercentInitialStop > 0.0 && !gi_464) ld_56 = Point * MathRound(gd_272 / Point); ld_24 = (ld_56 - Bid) / Point; l_lots_16 = NumLots(ld_24); } li_ret_88 = OpnPosn(OP_SELL, l_lots_16, ld_48, li_8, ai_4); g_price_416 = Bid; ModifShrt(ld_48); g_ticket_448 = li_ret_88; if (ai_4) Alert("Warning: OPEN_SELL_NOW toggle is ON!"); return (li_ret_88); } return (li_ret_88); } return (0); } int OpnPosn(int a_cmd_0, double a_lots_4, double a_price_12, int ai_20, bool ai_24) { int l_ticket_28; int li_32; double l_price_36; double l_price_44; color l_color_52; int li_56 = 0; if (!ai_24) li_56 = CheckContext(); if (a_cmd_0 == OP_BUY) { l_price_36 = Ask; l_price_44 = Ask + ai_20 * gd_484; l_color_52 = Green; } else { if (a_cmd_0 == OP_SELL) { l_price_36 = Bid; l_price_44 = Bid - ai_20 * gd_484; l_color_52 = Red; } } if (li_56 == -2) { Print("EA warning: Trade Context busy for " + li_32 + " secs ???!!!"); return (-2); } if (li_56 == -1) return (0); CountOpenTrades(); if (gi_184 == 0) { if (MarketOrderPlatform) { l_ticket_28 = OrderSend(Symbol(), a_cmd_0, a_lots_4, l_price_36, g_slippage_492, 0, 0, "myfxovereasy", g_magic_196, 0, l_color_52); OrderSelect(l_ticket_28, SELECT_BY_TICKET, MODE_TRADES); OrderModify(OrderTicket(), OrderOpenPrice(), a_price_12, l_price_44, 0, l_color_52); return (l_ticket_28); } l_ticket_28 = OrderSend(Symbol(), a_cmd_0, a_lots_4, l_price_36, g_slippage_492, a_price_12, l_price_44, g_comment_476, g_magic_196, 0, l_color_52); return (l_ticket_28); } return (0); } void CountOpenTrades() { gi_184 = 0; g_count_188 = 0; g_count_192 = 0; int l_ord_total_0 = OrdersTotal(); for (int l_pos_4 = 0; l_pos_4 < l_ord_total_0; l_pos_4++) { if (OrderSelect(l_pos_4, SELECT_BY_POS) == TRUE) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_196) { if (OrderType() == OP_BUY) g_count_188++; if (OrderType() == OP_SELL) g_count_192++; } } } gi_184 = g_count_188 + g_count_192; } int CheckTime() { bool l_bool_0 = FALSE; bool li_ret_4 = FALSE; bool l_bool_8 = FALSE; int li_12 = Seconds() + 60 * Minute() + 3600 * Hour(); int l_bool_16 = li_12 >= gi_176 && li_12 <= gi_180; if (gi_176 > gi_180) l_bool_16 = (li_12 >= gi_176 && li_12 <= 86400) || (li_12 >= 0 && li_12 <= gi_180); l_bool_0 = l_bool_16; l_bool_8 = StringGetChar(gs_yyyyyyy_168, DayOfWeek()) == 'Y'; li_ret_4 = l_bool_0 && l_bool_8; return (li_ret_4); } void ULHCorner(int ai_0) { double l_lots_4; double l_lots_12; string l_dbl2str_20; string l_dbl2str_28; CountOpenTrades(); if (g_count_188 != 0) { l_dbl2str_20 = DoubleToStr(g_ord_stoploss_256, Digits); Comment("Version ", "Gomega_GBPJPY_v2.12", "\nLONG, ticket num. ", g_ticket_440, "\nSLL at ", l_dbl2str_20, " Take Profit = ", TakeProfit); return; } if (g_count_192 != 0) { l_dbl2str_28 = DoubleToStr(g_ord_stoploss_256, Digits); Comment("Version ", "Gomega_GBPJPY_v2.12", "\nSHORT, ticket num. ", g_ticket_448, "\n", "SLS at ", l_dbl2str_28, " Take Profit = ", TakeProfit); return; } if (gi_184 == 0) { l_lots_4 = Lots; l_lots_12 = Lots; if (AutoMoneyManage) { l_lots_4 = gd_424; l_lots_12 = gd_432; } Comment("Version ", "Gomega_GBPJPY_v2.12", "\nProfit Target = ", TakeProfit, " Active? ", ai_0, "\nLots: L = ", l_lots_4, " S = ", l_lots_12); } } void CalculateIndicators() { if (ModifyInitialStop && PercentInitialStop > 0.0) CalculateISL(); double l_icustom_0 = iCustom(NULL, 0, "QuantumFilterFXPP", 0, 0); CalculateDISL(l_icustom_0); gi_464 = FALSE; if (MathAbs(Open[0] - l_icustom_0) >= gd_384) gi_464 = TRUE; CalculateSignals(); CalculateSLL(); CalculateSLS(); CalculatePSL(); } void CalculateISL() { double l_open_0 = Open[0]; double l_icustom_8 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 2, 0); double ld_16 = l_open_0 - l_icustom_8; double ld_24 = PercentInitialStop / 100.0 * ld_16; gd_264 = l_open_0 - MathMax(gd_360, ld_24); double l_icustom_32 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 3, 0); ld_16 = l_icustom_32 - (l_open_0 + gd_200); ld_24 = PercentInitialStop / 100.0 * ld_16; gd_272 = l_open_0 + gd_200 + MathMax(gd_360, ld_24); } void CalculateDISL(double ad_0) { double l_icustom_8; double l_icustom_16; double ld_24; double ld_32; gd_280 = gd_264; if (Open[0] - ad_0 >= gd_384) { gd_280 = ad_0; l_icustom_8 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 2, 0); ld_24 = l_icustom_8 - 0.62 * gd_408; if (ld_24 > ad_0) gd_280 = ld_24; } gd_288 = gd_272; if (ad_0 - Open[0] >= gd_384) { gd_288 = ad_0; l_icustom_16 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 3, 0); ld_32 = l_icustom_16 + 0.62 * gd_408; if (ld_32 < ad_0) gd_288 = ld_32; } } void CalculateSignals() { g_icustom_320 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterFXPP", 1, 0); g_icustom_328 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterFXPP", 1, 1); g_icustom_352 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterFXPP", 5, 0); g_icustom_336 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 0, 0); g_icustom_344 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 1, 0); } void CalculateSLL() { double ld_0; g_icustom_240 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 2, 0); gd_208 = Point * MathRound(g_icustom_240 / Point); if (ModifyInitialStop) gd_208 = Point * MathRound(gd_264 / Point); double ld_8 = gd_208; if (gi_464) ld_8 = Point * MathRound(gd_280 / Point); if (AutoMoneyManage) { ld_0 = (Open[0] - ld_8) / Point; gd_424 = NumLots(ld_0); } } void CalculateSLS() { double ld_0; g_icustom_248 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterSigFXPP", 3, 0); gd_216 = Point * MathRound(g_icustom_248 / Point); if (ModifyInitialStop) gd_216 = Point * MathRound(gd_272 / Point); double ld_8 = gd_216; if (gi_464) ld_8 = Point * MathRound(gd_288 / Point); if (AutoMoneyManage) { ld_0 = ((-Open[0]) + ld_8) / Point; gd_432 = NumLots(ld_0); } } void CalculatePSL() { double ld_0 = 0.0; double ld_8 = 10000.0; for (int li_16 = 1; li_16 < 4; li_16++) { ld_0 = MathMax(ld_0, Low[li_16]); ld_8 = MathMin(ld_8, High[li_16]); } gd_296 = ld_0 - 0.3 * gd_400; gd_304 = ld_8 + 0.2 * gd_400; } void TSLLCross(int ai_0, double a_price_4) { if (ObjectFind("Stop Long") != -1) ObjectDelete("Stop Long"); if (g_count_192 != 0 || ai_0 == 0) return; ObjectCreate("Stop Long", OBJ_ARROW, 0, iTime(NULL, TimeFrameMinutes, ai_0), a_price_4); ObjectSet("Stop Long", OBJPROP_COLOR, Green); ObjectSet("Stop Long", OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE); } void TSLSCross(int ai_0, double a_price_4) { if (ObjectFind("Stop Short") != -1) ObjectDelete("Stop Short"); if (g_count_188 != 0 || ai_0 == 0) return; ObjectCreate("Stop Short", OBJ_ARROW, 0, iTime(NULL, TimeFrameMinutes, ai_0), a_price_4); ObjectSet("Stop Short", OBJPROP_COLOR, Crimson); ObjectSet("Stop Short", OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE); } int Exit() { double l_ord_stoploss_0; double ld_8; double ld_16; double ld_24; double l_ord_stoploss_32; int l_ticket_40; int l_lots_44; int li_48; bool li_52; bool l_lots_56; bool li_60; bool l_ticket_64; bool li_68; bool l_bool_72; int li_76; int li_80; bool l_bool_84; int li_88; int li_92; int li_96; CountOpenTrades(); if (gi_184 == 0) return (0); double l_icustom_100 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterFXPP", 6, 1); double l_icustom_108 = iCustom(NULL, TimeFrameMinutes, "QuantumFilterFXPP", 7, 1); double ld_116 = 5.0 * gd_484; double ld_124 = ld_116 + gd_200; int l_ord_total_132 = OrdersTotal(); for (int l_pos_136 = 0; l_pos_136 < l_ord_total_132; l_pos_136++) { OrderSelect(l_pos_136, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_196) { l_ord_stoploss_0 = OrderStopLoss(); li_96 = OrderOpenTime() - Time[0]; li_88 = li_96 < 0; li_92 = li_96 + 60 * TimeFrameMinutes < 0; if (OrderType() == OP_BUY) { ld_16 = Bid - g_price_416; l_bool_72 = (-ld_16) >= gd_376 && !gi_464 && li_88; li_76 = Open[0] - Open[1] > gd_408; li_80 = Close[1] - Low[1] >= 0.75 * (High[1] - Low[1]); l_bool_84 = li_76 && li_80 && gi_460 && li_88; if (l_bool_72 || l_bool_84 || g_icustom_352 != 0.0) { OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Aqua); return (0); } l_ticket_64 = ld_16 >= gd_400 && gd_296 > l_ord_stoploss_0 && gi_460; l_lots_56 = ld_16 >= gd_368 && g_price_416 > l_ord_stoploss_0 && gi_460 && AllowBreakEven; ld_8 = Point * MathRound(l_icustom_100 / Point); l_ticket_40 = ld_8 >= gd_224; l_lots_44 = ld_8 > l_ord_stoploss_0 && li_92; li_48 = Open[0] > ld_8; li_52 = l_ticket_40 && l_lots_44 && li_48; l_ord_stoploss_32 = l_ord_stoploss_0; if (l_ticket_64 || l_lots_56 || li_52) { if (l_ticket_64) l_ord_stoploss_32 = MathMax(l_ord_stoploss_32, gd_296); if (l_lots_56) l_ord_stoploss_32 = MathMax(l_ord_stoploss_32, g_price_416); if (li_52) l_ord_stoploss_32 = MathMax(l_ord_stoploss_32, ld_8); OrderModify(OrderTicket(), OrderOpenPrice(), l_ord_stoploss_32, OrderTakeProfit(), 0, Green); ModifLong(l_ord_stoploss_32); return (0); } } if (OrderType() == OP_SELL) { ld_24 = g_price_416 - Ask; l_bool_72 = (-ld_24) >= gd_376 && !gi_464 && li_88; li_76 = Open[1] - Open[0] > gd_408; li_80 = High[1] - Close[1] >= 0.75 * (High[1] - Low[1]); l_bool_84 = li_76 && li_80 && gi_460 && li_88; if (l_bool_72 || l_bool_84 || g_icustom_352 != 0.0) { OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_492, Aqua); return (0); } li_68 = ld_24 >= gd_400 && gd_304 < l_ord_stoploss_0 && gi_460; li_60 = ld_24 >= gd_368 && g_price_416 < l_ord_stoploss_0 && gi_460 && AllowBreakEven; ld_8 = Point * MathRound((l_icustom_108 + gd_200) / Point); l_ticket_40 = l_icustom_108 <= gd_232; l_lots_44 = ld_8 < l_ord_stoploss_0 && li_92; li_48 = Open[0] < l_icustom_108; li_52 = l_ticket_40 && l_lots_44 && li_48; l_ord_stoploss_32 = l_ord_stoploss_0; if (li_68 || li_60 || li_52) { if (li_68) l_ord_stoploss_32 = MathMin(l_ord_stoploss_32, gd_304); if (li_60) l_ord_stoploss_32 = MathMin(l_ord_stoploss_32, g_price_416); if (li_52) l_ord_stoploss_32 = MathMin(l_ord_stoploss_32, ld_8); OrderModify(OrderTicket(), OrderOpenPrice(), l_ord_stoploss_32, OrderTakeProfit(), 0, Red); ModifShrt(l_ord_stoploss_32); return (0); } } } } return (0); } double ModifLong(double ad_0) { g_ord_stoploss_256 = ad_0; ULHCorner(1); TSLLCross(1, ad_0); return (0); } double ModifShrt(double ad_0) { g_ord_stoploss_256 = ad_0; ULHCorner(1); TSLSCross(1, ad_0); return (0); } double NumLots(double ad_0) { double ld_8; double l_tickvalue_16 = MarketInfo(Symbol(), MODE_TICKVALUE); double ld_24 = AccountEquity(); double ld_32 = ad_0 * l_tickvalue_16; if (ld_32 != 0.0) ld_8 = ld_24 / 100.0 * PercentofBalanceRisk / ld_32; double l_lotstep_40 = MarketInfo(Symbol(), MODE_LOTSTEP); double l_minlot_48 = MarketInfo(Symbol(), MODE_MINLOT); double ld_ret_56 = l_lotstep_40 * MathRound(ld_8 / l_lotstep_40); if (ld_ret_56 <= l_minlot_48) ld_ret_56 = l_minlot_48; double l_maxlot_64 = MarketInfo(Symbol(), MODE_MAXLOT); if (ld_ret_56 >= l_maxlot_64) ld_ret_56 = l_maxlot_64; return (ld_ret_56); } int CheckContext() { int li_0 = GetTickCount(); int li_4 = 10; if (IsTradeAllowed()) return (0); while (true) { if (!IsTradeAllowed()) { if (IsStopped()) return (-1); if (GetTickCount() - li_0 > 1000 * li_4) return (-2); Sleep(100); } if (!(IsTradeAllowed())) continue; break; } RefreshRates(); return (0); } void scrnsht() { int l_error_0; int li_4 = Minute() + 100 * Hour() + 10000 * Day() + 1000000 * Month() + 100000000 * (Year() - 2000); string ls_8 = "SS_" + Symbol() + "_" + li_4 + ".gif"; if (!WindowScreenShot(ls_8, 640, 480)) { l_error_0 = GetLastError(); Print("EA warning: Error printing screenshot ", ls_8, ", # ", l_error_0); return; } Print("EA message: screen shot file: " + ls_8); }