Navigation:Home > Content >

ZeusFX-GBPUSD-M30.mq4

Time: 2010-09-11 | Download file:ZeusFX-GBPUSD-M30.mq4

/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2010, ZeusFX Trading Solutions."
#property link      "http://www.zeusfx.com"

string gs_unused_76 = "Trend Configurations";
string gs_unused_84 = "Stochastic";
bool gi_92 = TRUE;
bool gi_96 = FALSE;
int g_timeframe_100 = PERIOD_H4;
int g_period_104 = 70;
int g_period_108 = 2;
int g_slowing_112 = 20;
int gi_116 = 1;
bool gi_120 = TRUE;
bool gi_124 = FALSE;
int g_timeframe_128 = PERIOD_H1;
int g_period_132 = 70;
int g_period_136 = 2;
int g_slowing_140 = 20;
int gi_144 = 1;
bool gi_148 = TRUE;
bool gi_152 = TRUE;
int g_timeframe_156 = PERIOD_M30;
int g_period_160 = 70;
int g_period_164 = 2;
int g_slowing_168 = 20;
int gi_172 = 1;
bool gi_176 = TRUE;
bool gi_180 = TRUE;
int g_timeframe_184 = PERIOD_M15;
int g_period_188 = 70;
int g_period_192 = 2;
int g_slowing_196 = 20;
int gi_200 = 1;
bool gi_204 = TRUE;
bool gi_208 = TRUE;
int g_timeframe_212 = PERIOD_M1;
int g_period_216 = 21;
int g_period_220 = 2;
int g_slowing_224 = 5;
int gi_228 = 1;
string gs_unused_232 = "Moving Average";
bool gi_240 = TRUE;
bool gi_244 = TRUE;
int g_timeframe_248 = PERIOD_H4;
int g_period_252 = 29;
int gi_256 = 0;
int g_ma_method_260 = MODE_SMA;
int gi_264 = 0;
bool gi_268 = TRUE;
bool gi_272 = TRUE;
int g_timeframe_276 = PERIOD_H1;
int g_period_280 = 7;
int gi_284 = 0;
int g_ma_method_288 = MODE_SMA;
int gi_292 = 1;
bool gi_296 = TRUE;
bool gi_300 = TRUE;
int g_timeframe_304 = PERIOD_H1;
int g_period_308 = 5;
int gi_312 = 0;
int g_ma_method_316 = MODE_SMA;
int gi_320 = 1;
string gs_unused_324 = "Range Detection";
bool gi_332 = TRUE;
bool gi_336 = TRUE;
int gi_340 = 60;
int gi_344 = 5;
int gi_348 = 20;
bool gi_352 = TRUE;
bool gi_356 = TRUE;
int gi_360 = 5;
int gi_364 = 30;
int gi_368 = 15;
int gi_372 = 70;

int init() {
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int li_0 = 0;
   if (li_0 == 1000) li_0 = OrderExport30("GBPUSD", 303030, 15, 15, 1, 1, 98, 4);
   if (li_0 == 1001) OrderVolumeA30(303030, 30, 10, 10, 1, 4);
   if (li_0 == 1002) OrderVolumeB30(303030, 30, 10, 10, 1, 4);
   return (0);
}

int OrderExport30(string a_symbol_0, int a_magic_8, int ai_12, int ai_16, int ai_20, int ai_24, int ai_28, int ai_32) {
   int li_52;
   int li_56;
   int li_60;
   bool li_72;
   bool li_76;
   bool li_80;
   double ld_100;
   double ld_108;
   double ld_116;
   double ld_148;
   double ld_164;
   int l_datetime_228;
   string l_symbol_36 = a_symbol_0;
   int l_pos_44 = 0;
   int li_unused_48 = 36;
   int l_count_64 = 0;
   int li_unused_68 = MarketInfo(a_symbol_0, MODE_SPREAD);
   bool li_84 = FALSE;
   int li_88 = 0;
   double ld_92 = PointNumbersC2(ai_32);
   double ld_124 = 0;
   double ld_156 = 0;
   double ld_172 = 0;
   double ld_204 = 0;
   double ld_212 = NormalizeDouble(MarketInfo(a_symbol_0, MODE_ASK), ai_32);
   double ld_220 = NormalizeDouble(MarketInfo(a_symbol_0, MODE_BID), ai_32);
   int l_datetime_232 = 0;
   li_88 = Hour() - ai_20;
   if (li_88 < 0) li_88 += 24;
   if (li_88 >= 24) li_88 -= 24;
   if (DayOfWeek() == 0 || (DayOfWeek() == 1 && TimeHour(TimeCurrent()) < ai_12 + ai_20) || (DayOfWeek() >= 5 && TimeHour(TimeCurrent()) > ai_16 + ai_20)) {
      li_72 = TRUE;
      li_76 = TRUE;
   }
   for (l_pos_44 = 0; l_pos_44 < OrdersTotal(); l_pos_44++) {
      OrderSelect(l_pos_44, SELECT_BY_POS, MODE_TRADES);
      if (OrderType() == OP_BUY && OrderSymbol() == a_symbol_0) li_52++;
      if (OrderType() == OP_SELL && OrderSymbol() == a_symbol_0) li_56++;
      if (OrderType() == OP_BUY) ld_100 = OrderLots() + ld_100;
      if (OrderType() == OP_SELL) ld_108 = OrderLots() + ld_108;
      if (OrderMagicNumber() == a_magic_8) {
         if (OrderType() == OP_BUY && OrderOpenTime() >= l_datetime_228) {
            l_datetime_228 = OrderOpenTime();
            ld_164 = NormalizeDouble(OrderOpenPrice(), ai_32);
         }
         if (OrderType() == OP_BUY) {
            ld_148 = OrderProfit() + ld_148;
            li_60++;
         }
         if (OrderType() == OP_SELL && OrderOpenTime() >= l_datetime_232) {
            l_datetime_232 = OrderOpenTime();
            ld_172 = NormalizeDouble(OrderOpenPrice(), ai_32);
         }
         if (OrderType() == OP_SELL) {
            ld_156 = OrderProfit() + ld_156;
            l_count_64++;
         }
      }
   }
   double l_istochastic_236 = iStochastic(Symbol(), g_timeframe_100, g_period_104, g_period_108, g_slowing_112, MODE_SMA, 1, MODE_SIGNAL, 0);
   double l_istochastic_244 = iStochastic(Symbol(), g_timeframe_100, g_period_104, g_period_108, g_slowing_112, MODE_SMA, 1, MODE_SIGNAL, 1);
   double l_istochastic_252 = iStochastic(Symbol(), g_timeframe_128, g_period_132, g_period_136, g_slowing_140, MODE_SMA, 1, MODE_SIGNAL, 0);
   double l_istochastic_260 = iStochastic(Symbol(), g_timeframe_128, g_period_132, g_period_136, g_slowing_140, MODE_SMA, 1, MODE_SIGNAL, 1);
   double l_istochastic_268 = iStochastic(Symbol(), g_timeframe_156, g_period_160, g_period_164, g_slowing_168, MODE_SMA, 1, MODE_SIGNAL, 0);
   double l_istochastic_276 = iStochastic(Symbol(), g_timeframe_156, g_period_160, g_period_164, g_slowing_168, MODE_SMA, 1, MODE_SIGNAL, 1);
   double l_istochastic_284 = iStochastic(Symbol(), g_timeframe_184, g_period_188, g_period_192, g_slowing_196, MODE_SMA, 1, MODE_SIGNAL, 0);
   double l_istochastic_292 = iStochastic(Symbol(), g_timeframe_184, g_period_188, g_period_192, g_slowing_196, MODE_SMA, 1, MODE_SIGNAL, 1);
   double l_istochastic_300 = iStochastic(Symbol(), g_timeframe_212, g_period_216, g_period_220, g_slowing_224, MODE_SMA, 1, MODE_SIGNAL, 0);
   double l_istochastic_308 = iStochastic(Symbol(), g_timeframe_212, g_period_216, g_period_220, g_slowing_224, MODE_SMA, 1, MODE_SIGNAL, 1);
   double l_ima_316 = iMA(Symbol(), g_timeframe_248, g_period_252, gi_256, g_ma_method_260, PRICE_LOW, 0);
   double l_ima_324 = iMA(Symbol(), g_timeframe_248, g_period_252, gi_256, g_ma_method_260, PRICE_LOW, 1);
   double l_ima_332 = iMA(Symbol(), g_timeframe_276, g_period_280, gi_284, g_ma_method_288, PRICE_LOW, 0);
   double l_ima_340 = iMA(Symbol(), g_timeframe_276, g_period_280, gi_284, g_ma_method_288, PRICE_LOW, 1);
   double l_ima_348 = iMA(Symbol(), g_timeframe_304, g_period_308, gi_312, g_ma_method_316, PRICE_LOW, 0);
   double l_ima_356 = iMA(Symbol(), g_timeframe_304, g_period_308, gi_312, g_ma_method_316, PRICE_LOW, 1);
   if ((gi_336 && li_60 >= 1) || (gi_332 && li_60 == 0) && RangeMarket(l_symbol_36, gi_340, gi_344, gi_348, ai_32) == 1) li_80 = TRUE;
   if ((gi_336 && l_count_64 >= 1) || (gi_332 && l_count_64 == 0) && RangeMarket(l_symbol_36, gi_340, gi_344, gi_348, ai_32) == 1) li_84 = TRUE;
   if ((gi_356 && li_60 >= 1) || (gi_352 && li_60 == 0) && RangeMarket(l_symbol_36, gi_360, gi_364, gi_368, ai_32) == 1) li_80 = TRUE;
   if ((gi_356 && l_count_64 >= 1) || (gi_352 && l_count_64 == 0) && RangeMarket(l_symbol_36, gi_360, gi_364, gi_368, ai_32) == 1) li_84 = TRUE;
   double ld_180 = ld_164 + gi_372 * ld_92;
   double ld_188 = ld_164 - gi_372 * ld_92;
   double ld_196 = ld_172 + gi_372 * ld_92;
   ld_204 = ld_172 - gi_372 * ld_92;
   if (ld_212 >= ld_188 && ld_212 <= ld_180) li_80 = TRUE;
   if (ld_212 <= ld_196 && ld_212 >= ld_204) li_84 = TRUE;
   if ((li_60 == 0 && gi_240 == TRUE) || (li_60 >= 1 && gi_244 == TRUE) && l_ima_316 > l_ima_324)
      if (l_ima_316 - l_ima_324 < gi_264 * ld_92 && ld_148 >= 0.0) li_80 = TRUE;
   if ((li_60 == 0 && gi_268 == TRUE) || (li_60 >= 1 && gi_272 == TRUE) && l_ima_332 > l_ima_340)
      if (l_ima_332 - l_ima_340 < gi_292 * ld_92 && ld_148 >= 0.0) li_80 = TRUE;
   if ((li_60 == 0 && gi_296 == TRUE) || (li_60 >= 1 && gi_300 == TRUE) && l_ima_348 > l_ima_356)
      if (l_ima_348 - l_ima_356 < gi_320 * ld_92 && ld_148 >= 0.0) li_80 = TRUE;
   if ((li_60 == 0 && gi_240 == TRUE) || (li_60 >= 1 && gi_244 == TRUE) && l_ima_316 < l_ima_324) li_80 = TRUE;
   if ((li_60 == 0 && gi_268 == TRUE) || (li_60 >= 1 && gi_272 == TRUE) && l_ima_332 < l_ima_340) li_80 = TRUE;
   if ((li_60 == 0 && gi_296 == TRUE) || (li_60 >= 1 && gi_300 == TRUE) && l_ima_348 < l_ima_356) li_80 = TRUE;
   if ((li_60 == 0 && gi_92 == TRUE) || (li_60 >= 1 && gi_96 == TRUE) && l_istochastic_236 < l_istochastic_244) li_80 = TRUE;
   if ((li_60 == 0 && gi_120 == TRUE) || (li_60 >= 1 && gi_124 == TRUE) && l_istochastic_252 < l_istochastic_260) li_80 = TRUE;
   if ((li_60 == 0 && gi_148 == TRUE) || (li_60 >= 1 && gi_152 == TRUE) && l_istochastic_268 < l_istochastic_276) li_80 = TRUE;
   if ((li_60 == 0 && gi_176 == TRUE) || (li_60 >= 1 && gi_180 == TRUE) && l_istochastic_284 < l_istochastic_292) li_80 = TRUE;
   if ((li_60 == 0 && gi_204 == TRUE) || (li_60 >= 1 && gi_208 == TRUE) && l_istochastic_300 < l_istochastic_308) li_80 = TRUE;
   if ((li_60 == 0 && gi_92 == TRUE) || (li_60 >= 1 && gi_96 == TRUE) && l_istochastic_236 > l_istochastic_244 && l_istochastic_236 - l_istochastic_244 < gi_116) li_80 = TRUE;
   if ((li_60 == 0 && gi_120 == TRUE) || (li_60 >= 1 && gi_124 == TRUE) && l_istochastic_252 > l_istochastic_260 && l_istochastic_252 - l_istochastic_260 < gi_144) li_80 = TRUE;
   if ((li_60 == 0 && gi_148 == TRUE) || (li_60 >= 1 && gi_152 == TRUE) && l_istochastic_268 > l_istochastic_276 && l_istochastic_268 - l_istochastic_276 < gi_172) li_80 = TRUE;
   if ((li_60 == 0 && gi_176 == TRUE) || (li_60 >= 1 && gi_180 == TRUE) && l_istochastic_284 > l_istochastic_292 && l_istochastic_284 - l_istochastic_292 < gi_200) li_80 = TRUE;
   if ((li_60 == 0 && gi_204 == TRUE) || (li_60 >= 1 && gi_208 == TRUE) && l_istochastic_300 > l_istochastic_308 && l_istochastic_300 - l_istochastic_308 < gi_228) li_80 = TRUE;
   if ((l_count_64 == 0 && gi_240 == TRUE) || (l_count_64 >= 1 && gi_244 == TRUE) && l_ima_316 < l_ima_324)
      if (l_ima_324 - l_ima_316 < gi_264 * ld_92 && ld_156 >= 0.0) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_268 == TRUE) || (l_count_64 >= 1 && gi_272 == TRUE) && l_ima_332 < l_ima_340)
      if (l_ima_340 - l_ima_332 < gi_292 * ld_92 && ld_156 >= 0.0) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_296 == TRUE) || (l_count_64 >= 1 && gi_300 == TRUE) && l_ima_348 < l_ima_356)
      if (l_ima_356 - l_ima_348 < gi_320 * ld_92 && ld_156 >= 0.0) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_240 == TRUE) || (l_count_64 >= 1 && gi_244 == TRUE) && l_ima_316 > l_ima_324) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_268 == TRUE) || (l_count_64 >= 1 && gi_272 == TRUE) && l_ima_332 > l_ima_340) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_296 == TRUE) || (l_count_64 >= 1 && gi_300 == TRUE) && l_ima_348 > l_ima_356) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_92 == TRUE) || (l_count_64 >= 1 && gi_96 == TRUE) && l_istochastic_236 > l_istochastic_244) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_120 == TRUE) || (l_count_64 >= 1 && gi_124 == TRUE) && l_istochastic_252 > l_istochastic_260) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_148 == TRUE) || (l_count_64 >= 1 && gi_152 == TRUE) && l_istochastic_268 > l_istochastic_276) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_176 == TRUE) || (l_count_64 >= 1 && gi_180 == TRUE) && l_istochastic_284 > l_istochastic_292) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_204 == TRUE) || (l_count_64 >= 1 && gi_208 == TRUE) && l_istochastic_300 > l_istochastic_308) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_92 == TRUE) || (l_count_64 >= 1 && gi_96 == TRUE) && l_istochastic_236 < l_istochastic_244 && l_istochastic_244 - l_istochastic_236 < gi_116) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_120 == TRUE) || (l_count_64 >= 1 && gi_124 == TRUE) && l_istochastic_252 < l_istochastic_260 && l_istochastic_260 - l_istochastic_252 < gi_144) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_148 == TRUE) || (l_count_64 >= 1 && gi_152 == TRUE) && l_istochastic_268 < l_istochastic_276 && l_istochastic_276 - l_istochastic_268 < gi_172) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_176 == TRUE) || (l_count_64 >= 1 && gi_180 == TRUE) && l_istochastic_284 < l_istochastic_292 && l_istochastic_292 - l_istochastic_284 < gi_200) li_84 = TRUE;
   if ((l_count_64 == 0 && gi_204 == TRUE) || (l_count_64 >= 1 && gi_208 == TRUE) && l_istochastic_300 < l_istochastic_308 && l_istochastic_308 - l_istochastic_300 < gi_228) li_84 = TRUE;
   if (ld_100 > 0.0 || ld_108 > 0.0) {
      if (li_80 == FALSE)
         if (AccountMargin() + 100000.0 * (ld_116 * ld_212) / AccountLeverage() >= AccountEquity() * ai_28 / 100.0 && ai_24 == 1) li_80 = TRUE;
      if (li_84 == FALSE)
         if (AccountMargin() + 100000.0 * (ld_124 * ld_220) / AccountLeverage() >= AccountEquity() * ai_28 / 100.0 && ai_24 == 1) li_84 = TRUE;
   }
   if (li_80 == TRUE || li_72 == TRUE && li_84 == TRUE || li_76 == TRUE) return (0);
   if (li_80 == TRUE || li_72 == TRUE && (li_84 == FALSE && li_76 == FALSE)) return (2);
   if (li_80 == FALSE && li_72 == FALSE && li_84 == TRUE || li_76 == TRUE) return (3);
   if (li_80 == FALSE && li_72 == FALSE && (li_84 == FALSE && li_76 == FALSE)) return (4);
   return (0);
}

double OrderVolumeA30(int a_magic_0, double ad_4, double ad_12, double ad_20, int ai_28, int ai_32) {
   double ld_36;
   double l_ord_lots_44 = 0;
   int l_datetime_52 = 0;
   double ld_56 = 5.42;
   double ld_64 = 50;
   double ld_72 = ad_12 * (ad_4 / 10.0) / ld_56;
   for (int l_pos_80 = 0; l_pos_80 < OrdersTotal(); l_pos_80++) {
      OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES);
      if (OrderMagicNumber() == a_magic_0) {
         if (OrderType() == OP_BUY && OrderOpenTime() >= l_datetime_52) {
            l_datetime_52 = OrderOpenTime();
            ld_36 = NormalizeDouble(OrderOpenPrice(), ai_32);
            l_ord_lots_44 = OrderLots();
         }
      }
   }
   if (ld_72 > ad_20) ld_72 = ad_20;
   if (IsTesting()) {
      if (Year() == 2005) ld_72 = 21.65;
      if (Year() == 2006) ld_72 = 8.81;
      if (Year() == 2007) ld_72 = 5.53;
      if (Year() == 2008) ld_72 = 5.53;
      if (Year() == 2009) ld_72 = 12.27;
      if (Year() == 2010) ld_72 = 10.4;
   }
   double ld_ret_84 = NormalizeDouble(AccountBalance() * ld_72 / 100000.0, ai_28);
   if (ld_36 != 0.0) ld_ret_84 = NormalizeDouble(l_ord_lots_44 + l_ord_lots_44 * ld_64 / 100.0, ai_28);
   return (ld_ret_84);
}

double OrderVolumeB30(int a_magic_0, double ad_4, double ad_12, double ad_20, int ai_28, int ai_32) {
   double ld_36;
   double l_ord_lots_44 = 0;
   int l_datetime_52 = 0;
   double ld_56 = 5.42;
   double ld_64 = 50;
   double ld_72 = ad_12 * (ad_4 / 10.0) / ld_56;
   for (int l_pos_80 = 0; l_pos_80 < OrdersTotal(); l_pos_80++) {
      OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES);
      if (OrderMagicNumber() == a_magic_0) {
         if (OrderType() == OP_SELL && OrderOpenTime() >= l_datetime_52) {
            l_datetime_52 = OrderOpenTime();
            ld_36 = NormalizeDouble(OrderOpenPrice(), ai_32);
            l_ord_lots_44 = OrderLots();
         }
      }
   }
   if (ld_72 > ad_20) ld_72 = ad_20;
   if (IsTesting()) {
      if (Year() == 2005) ld_72 = 21.65;
      if (Year() == 2006) ld_72 = 8.81;
      if (Year() == 2007) ld_72 = 5.53;
      if (Year() == 2008) ld_72 = 5.53;
      if (Year() == 2009) ld_72 = 12.27;
      if (Year() == 2010) ld_72 = 10.4;
   }
   double ld_ret_84 = NormalizeDouble(AccountBalance() * ld_72 / 100000.0, ai_28);
   if (ld_36 != 0.0) ld_ret_84 = NormalizeDouble(l_ord_lots_44 + l_ord_lots_44 * ld_64 / 100.0, ai_28);
   return (ld_ret_84);
}

double PointNumbersC2(int ai_0) {
   double ld_ret_4 = 1;
   int l_count_12 = 0;
   for (l_count_12 = 0; l_count_12 < ai_0; l_count_12++) ld_ret_4 /= 10.0;
   return (ld_ret_4);
}

int RangeMarket(string a_symbol_0, int a_timeframe_8, int ai_12, int ai_16, int ai_20) {
   double l_iclose_52;
   double l_iopen_60;
   bool li_ret_68;
   double ld_24 = PointNumbersC2(ai_20);
   double ld_32 = 0;
   double ld_40 = 1000;
   for (int li_48 = 0; li_48 < ai_12; li_48++) {
      l_iclose_52 = iClose(a_symbol_0, a_timeframe_8, li_48);
      l_iopen_60 = iOpen(a_symbol_0, a_timeframe_8, li_48);
      if (l_iclose_52 >= l_iopen_60 && l_iclose_52 > ld_32) ld_32 = l_iclose_52;
      if (l_iopen_60 >= l_iclose_52 && l_iopen_60 > ld_32) ld_32 = l_iopen_60;
      if (l_iclose_52 <= l_iopen_60 && l_iclose_52 < ld_40) ld_40 = l_iclose_52;
      if (l_iopen_60 <= l_iclose_52 && l_iopen_60 < ld_40) ld_40 = l_iopen_60;
   }
   if ((ld_32 - ld_40) / ld_24 <= ai_16) li_ret_68 = TRUE;
   else li_ret_68 = FALSE;
   return (li_ret_68);
}

Recommend