有您的持续关注
我们会做得更好

智能交易系统Lucky Pip-sofia



Lucky Pip-sofia属于剥头皮加码类型,特定的行情下也会有不菲的盈利成绩。

本网收集整理智能交易EA仅为MQL4编程爱好者提供语法及相关编程技巧的学习研究之用,智能交易存在极高的风险测试请用模拟盘,请勿用于实盘。Lucky Pip-sofia源码如下:

//+------------------------------------------------------------------+
//|                                              Lucky Pip-sofia.mq4 |
//|                                     Copyright 2016, QQ:125808047 |
//+------------------------------------------------------------------+
#property copyright "www.125808047.com"
#property link      "http://www.125808047.com"

bool gi_84 = TRUE;
extern double krok = 0.0;
extern double Lots = 0.01;
extern double Factor_lot = 1.6;
extern double level = 15.0;
extern double TakeProfit = 23.0;
bool gi_128 = FALSE;
double gd_132 = 38.0;
double gd_140 = 18.0;
int gi_148 = 15;
bool gi_152 = FALSE;
double gd_156 = 0.5;
double g_slippage_164 = 3.0;
extern int MagicNumber = 1024545;
bool gi_176 = FALSE;
bool gi_180 = FALSE;
extern string TradeComment = "QQ125808047";
int gi_200 = 0;
int gi_204 = 0;
int gi_208 = 0;
int gi_212 = 0;
int gi_216 = 0;
int gi_220 = 7;
bool gi_224 = TRUE;
bool gi_228 = FALSE;
double gd_232 = 48.0;
double g_pips_240 = 500.0;
double gd_248 = 0.0;
bool gi_256 = TRUE;
bool gi_260 = FALSE;
int gi_264 = 1;
double g_price_268;
double gd_276;
double g_price_284;
double g_bid_292;
double g_ask_300;
double gd_308;
double gd_316;
double gd_324;
bool gi_332;
int g_time_336 = 0;
int gi_340;
int gi_344 = 0;
double gd_348;
int g_pos_356 = 0;
int gi_360;
double gd_364 = 0.0;
bool gi_372 = FALSE;
bool gi_376 = FALSE;
bool gi_380 = FALSE;
int gi_384;
bool gi_388 = FALSE;
int g_datetime_392 = 0;
int g_datetime_396 = 0;
double gd_400;
double gd_408;
string gs_unused_416 = "OFF";
string gs_unused_424 = "REAL";
string gs_432 = "";
bool gi_unused_440 = TRUE;
bool gi_unused_444 = TRUE;
int g_acc_number_448 = 0;
int gi_452;
int gi_456;
int gi_460;
double gd_464;
double gd_472 = 0.0;
double gd_unused_480 = 1.0;

int f0_21() {
   if (gi_176) return (0);
   bool li_ret_0 = TRUE;
   gi_456 = 60 * gi_200 + gi_204;
   gi_460 = 60 * gi_208 + gi_212;
   int day_of_week_4 = DayOfWeek();
   if (day_of_week_4 < gi_216 || day_of_week_4 > gi_220) li_ret_0 = FALSE;
   int li_8 = 60 * TimeHour(TimeCurrent()) + TimeMinute(TimeCurrent());
   if (day_of_week_4 <= gi_216 && gi_456 >= li_8) li_ret_0 = FALSE;
   if (day_of_week_4 >= gi_220 && gi_460 < li_8) li_ret_0 = FALSE;
   return (li_ret_0);
}

int init() {
   if (Digits == 2 || Digits == 4) gi_452 = 1;
   else gi_452 = 10;
   g_acc_number_448 = AccountNumber();
   gd_324 = MarketInfo(Symbol(), MODE_SPREAD) * Point * gi_452;
   double gd_208 = (MarketInfo(Symbol(), MODE_MINLOT)); 
   if (gd_208 ==0.001)gd_248 = 3;
   if (gd_208 ==0.01)gd_248 = 2;  
   if (gd_208 ==0.1)gd_248 = 1; 
   if (gd_208 ==1.0)gd_248 = 1;

   if (gi_152) gs_unused_416 = "ON";
   if (IsDemo()) gs_unused_424 = "DEMO";
   gi_unused_440 = TRUE;
   return (0);
}

int start() {
   double order_open_price_0;
   double order_open_price_8;
   double order_open_price_16;
   double ld_unused_24;
   double order_open_price_40;
   double order_open_price_48;
   double order_open_price_56;
   double ld_unused_64;
   int lia_unused_80[1];
   int lia_unused_84[1];
   double order_lots_88;
   double order_lots_96;
   double iclose_104;
   double iclose_112;
   int li_120;
   double ld_unused_124 = 0;
   double ld_unused_132 = 0;
   double order_lots_140 = 0;
   double order_lots_148 = 0;
   for (int pos_156 = 0; pos_156 < OrdersTotal(); pos_156++) {
      if (OrderSelect(pos_156, SELECT_BY_POS, MODE_TRADES) == FALSE) break;
      if (OrderType() == OP_BUY) {
         if (order_open_price_40 == 0.0) order_open_price_40 = OrderOpenPrice();
         if (OrderOpenPrice() < order_open_price_40) {
            ld_unused_64 = order_open_price_56;
            order_open_price_56 = order_open_price_48;
            order_open_price_48 = order_open_price_40;
            order_open_price_40 = OrderOpenPrice();
         }
         if (order_lots_148 == 0.0) order_lots_148 = OrderLots();
         if (OrderLots() > order_lots_148) order_lots_148 = OrderLots();
      }
      if (OrderType() == OP_SELL) {
         if (order_open_price_0 == 0.0) order_open_price_0 = OrderOpenPrice();
         if (OrderOpenPrice() > order_open_price_0) {
            ld_unused_24 = order_open_price_16;
            order_open_price_16 = order_open_price_8;
            order_open_price_8 = order_open_price_0;
            order_open_price_0 = OrderOpenPrice();
         }
         if (order_lots_140 == 0.0) order_lots_140 = OrderLots();
         if (OrderLots() > order_lots_140) order_lots_140 = OrderLots();
      }
   }
   if (gi_180 == TRUE) {
      f0_12();
      return (0);
   }
   if (gi_128) f0_17(gd_132, gd_140, g_price_284);
   if (gi_228) {
      if (TimeCurrent() >= gi_340) {
         f0_12();
         Print("Closed All Trades Due To Server TimeOut");
      }
   }
   if (g_time_336 == Time[0]) return (0);
   g_time_336 = Time[0];
   double ld_160 = f0_8();
   if (gi_152) {
      if (ld_160 < 0.0 && MathAbs(ld_160) > gd_156 / 100.0 * f0_2()) {
         f0_12();
         Print("Closed All due to EQUITY STOP-OUT");
         gi_388 = FALSE;
      }
   }
   gi_332 = FALSE;
   gi_360 = f0_14();
   for (g_pos_356 = OrdersTotal() - 1; g_pos_356 >= 0; g_pos_356--) {
      bool cg = OrderSelect(g_pos_356, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
         if (OrderType() == OP_BUY) {
            gi_376 = TRUE;
            gi_380 = FALSE;
            order_lots_88 = OrderLots();
            break;
         }
      }
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
         if (OrderType() == OP_SELL) {
            gi_376 = FALSE;
            gi_380 = TRUE;
            order_lots_96 = OrderLots();
            break;
         }
      }
   }
   gi_372 = FALSE;
   if (gi_360 > 0 && gi_360 <= gi_148) {
      RefreshRates();
      gd_308 = f0_10();
      gd_316 = f0_9();
      li_120 = f0_18(gi_376, gi_380, Bid, Ask, gd_308, gd_316, Point, level, gi_452);
      if (li_120 == 1) gi_372 = TRUE;
      gs_432 = f0_0(3);
   }
   if (gi_360 > 1 && gi_224) gi_344 = gi_360 - 1;
   gd_348 = f0_15(OP_SELL);
   if (gi_360 < 1) {
      gi_380 = FALSE;
      gi_376 = FALSE;
      gi_372 = TRUE;
      gd_276 = AccountEquity();
   }
   if (gi_372) {
      gd_308 = f0_10();
      gd_316 = f0_9();
      if (gi_380) {
         if (gi_260) {
            f0_19(0, 1);
            gd_348 = NormalizeDouble(Factor_lot * order_lots_96, gd_248);
         } else gd_348 = f0_15(OP_SELL);
         if (gi_256) {
            gi_344 = gi_360;
            if (gd_348 > 0.0) {
               RefreshRates();
               if (order_open_price_0 == 0.0) gi_384 = f0_1(1, gd_348, Bid, g_slippage_164, Ask, 0, 0, 
TradeComment + "-" + gi_344, MagicNumber, 0, HotPink);
               if (Ask > order_open_price_0 + krok * Point && order_open_price_0 != 0.0) 
gi_384 = f0_1(1, gd_348, Bid, g_slippage_164, Ask, 0, 0, TradeComment + "-" + gi_344, MagicNumber, 0, HotPink);
               if (gi_384 < 0) {
                  Print("Error: ", GetLastError());
                  return (0);
               }
               gd_316 = f0_9();
               gi_372 = FALSE;
               gi_388 = TRUE;
            }
         }
      } else {
         if (gi_376) {
            if (gi_260) {
               f0_19(1, 0);
               gd_348 = NormalizeDouble(Factor_lot * order_lots_88, gd_248);
            } else gd_348 = f0_15(OP_BUY);
            if (gi_256) {
               gi_344 = gi_360;
               if (gd_348 > 0.0) {
                  if (order_open_price_40 == 0.0) gi_384 = f0_1(0, gd_348, Ask, g_slippage_164, Bid, 0, 0, 
TradeComment + "-" + gi_344, MagicNumber, 0, Lime);
                  if (Ask < order_open_price_40 - krok * Point && order_open_price_40 != 0.0) 
gi_384 = f0_1(0, gd_348, Ask, g_slippage_164, Bid, 0, 0, TradeComment + "-" + gi_344, MagicNumber, 0, Lime);
                  if (gi_384 < 0) {
                     Print("Error: ", GetLastError());
                     return (0);
                  }
                  gd_308 = f0_10();
                  gi_372 = FALSE;
                  gi_388 = TRUE;
               }
            }
         }
      }
   }
   if (gi_372 && gi_360 < 1 && f0_21()) {
      iclose_104 = iClose(Symbol(), 0, 2);
      iclose_112 = iClose(Symbol(), 0, 1);
      g_bid_292 = Bid;
      g_ask_300 = Ask;
      if ((!gi_380) && !gi_376) {
         gi_344 = gi_360;
         if (iclose_104 > iclose_112) {
            gd_348 = f0_15(OP_SELL);
            if (gd_348 > 0.0) {
               if (order_open_price_0 == 0.0) gi_384 = f0_1(1, gd_348, g_bid_292, 
g_slippage_164, g_bid_292, 0, 0, TradeComment + " " + MagicNumber + "-" + gi_344, MagicNumber, 0, HotPink);
               if (Ask > order_open_price_0 + krok * Point && order_open_price_0 != 0.0) 
gi_384 = f0_1(1, gd_348, g_bid_292, g_slippage_164, g_bid_292, 0, 0, TradeComment + " " + MagicNumber + "-" 
+ gi_344, MagicNumber, 0, HotPink);
               if (gi_384 < 0) {
                  Print(gd_348, "Error: ", GetLastError());
                  return (0);
               }
               gd_308 = f0_10();
               gi_388 = TRUE;
            }
         } else {
            gd_348 = f0_15(OP_BUY);
            if (gd_348 > 0.0) {
               if (order_open_price_40 == 0.0) gi_384 = f0_1(0, gd_348, g_ask_300, 
g_slippage_164, g_ask_300, 0, 0, TradeComment + " " + MagicNumber + "-" + gi_344, MagicNumber, 0, Lime);
               if (Ask < order_open_price_40 - krok * Point && order_open_price_40 != 0.0) 
gi_384 = f0_1(0, gd_348, g_ask_300, g_slippage_164, g_ask_300, 0, 0, TradeComment + " " + MagicNumber + "-" 
+ gi_344, MagicNumber, 0, Lime);
               if (gi_384 < 0) {
                  Print(gd_348, "Error: ", GetLastError());
                  return (0);
               }
               gd_316 = f0_9();
               gi_388 = TRUE;
            }
         }
      }
      if (gi_384 > 0) gi_340 = TimeCurrent() + 60.0 * (60.0 * gd_232);
      gi_372 = FALSE;
   }
   gi_360 = f0_14();
   g_price_284 = 0;
   double ld_168 = 0;
   for (g_pos_356 = OrdersTotal() - 1; g_pos_356 >= 0; g_pos_356--) {
      cg = OrderSelect(g_pos_356, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
         if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
            g_price_284 += OrderOpenPrice() * OrderLots();
            ld_168 += OrderLots();
         }
      }
   }
   if (gi_360 > 0) g_price_284 = NormalizeDouble(g_price_284 / ld_168, Digits);
   if (gi_388) {
      for (g_pos_356 = OrdersTotal() - 1; g_pos_356 >= 0; g_pos_356--) {
         cg = OrderSelect(g_pos_356, SELECT_BY_POS, MODE_TRADES);
         if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
            if (OrderType() == OP_BUY) {
               g_price_268 = g_price_284 + TakeProfit * Point * gi_452;
               gd_364 = g_price_284 - g_pips_240 * Point * gi_452;
               gi_332 = TRUE;
            }
         }
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
            if (OrderType() == OP_SELL) {
               g_price_268 = g_price_284 - TakeProfit * Point * gi_452;
               gd_364 = g_price_284 + g_pips_240 * Point * gi_452;
               gi_332 = TRUE;
            }
         }
      }
   }
   if (gi_388) {
      if (gi_332 == TRUE) {
         for (g_pos_356 = OrdersTotal() - 1; g_pos_356 >= 0; g_pos_356--) {
            cg = OrderSelect(g_pos_356, SELECT_BY_POS, MODE_TRADES);
            if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
            if (NormalizeDouble(g_price_268, Digits) != NormalizeDouble(OrderTakeProfit(), Digits)) {
               if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) cg = OrderModify(OrderTicket(), g_price_284, OrderStopLoss(), g_price_268, 0, Yellow);
               Sleep(3000);
               if (OrderTakeProfit() > 0.0) gi_388 = FALSE;
            }
         }
      }
   }
   f0_20();
   return (0);
}

void f0_20() {
   if (gi_84) {
      if (IsTesting() && !IsVisualMode()) return;
      f0_7();
   }
}

double f0_6(double ad_0) {
   return (NormalizeDouble(ad_0, Digits));
}

int f0_19(bool ai_0 = TRUE, bool ai_4 = TRUE) {
   int li_ret_8 = 0;
   for (int pos_12 = OrdersTotal() - 1; pos_12 >= 0; pos_12--) {
      if (OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
            if (OrderType() == OP_BUY && ai_0) {
               RefreshRates();
               if (!IsTradeContextBusy()) {
                  if (!OrderClose(OrderTicket(), OrderLots(), f0_6(Bid), 5, CLR_NONE)) {
                     Print("Error close BUY " + OrderTicket());
                     li_ret_8 = -1;
                  }
               } else {
                  if (g_datetime_392 == iTime(NULL, 0, 0)) return (-2);
                  g_datetime_392 = iTime(NULL, 0, 0);
                  Print("Need close BUY " + OrderTicket() + ". Trade Context Busy");
                  return (-2);
               }
            }
            if (OrderType() == OP_SELL && ai_4) {
               RefreshRates();
               if (!IsTradeContextBusy()) {
                  if (!((!OrderClose(OrderTicket(), OrderLots(), f0_6(Ask), 5, CLR_NONE)))) continue;
                  Print("Error Closing SELL Trade : " + OrderTicket());
                  li_ret_8 = -1;
                  continue;
               }
               if (g_datetime_396 == iTime(NULL, 0, 0)) return (-2);
               g_datetime_396 = iTime(NULL, 0, 0);
               Print("Need to close SELL trade : " + OrderTicket() + ". Trade Context Busy");
               return (-2);
            }
         }
      }
   }
   return (li_ret_8);
}

double f0_15(int a_cmd_0) {
   double lots_4;
   int datetime_12;
   switch (gi_264) {
   case 0:
      lots_4 = Lots;
      break;
   case 1:
      lots_4 = NormalizeDouble(Lots * MathPow(Factor_lot, gi_344), gd_248);
      break;
   case 2:
      datetime_12 = 0;
      lots_4 = Lots;
      for (int pos_20 = OrdersHistoryTotal() - 1; pos_20 >= 0; pos_20--) {
         if (!OrderSelect(pos_20, SELECT_BY_POS, MODE_HISTORY)) return (-3);
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
            if (datetime_12 < OrderCloseTime()) {
               datetime_12 = OrderCloseTime();
               if (OrderProfit() < 0.0) {
                  lots_4 = NormalizeDouble(OrderLots() * Factor_lot, gd_248);
                  continue;
               }
               lots_4 = Lots;
            }
         }
      }
   }
   if (AccountFreeMarginCheck(Symbol(), a_cmd_0, lots_4) <= 0.0) return (-1);
   if (GetLastError() == 134/* NOT_ENOUGH_MONEY */) return (-2);
   return (lots_4);
}

int f0_14() {
   gd_464 = 0;
   int count_0 = 0;
   for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
      bool cg = OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
         if (OrderType() == OP_SELL || OrderType() == OP_BUY) count_0++;
      if (OrderTakeProfit() == 0.0) {
         gi_388 = TRUE;
         gi_332 = TRUE;
      }
      if (OrderTakeProfit() > 0.0 && gd_464 == 0.0) {
         if (OrderType() == OP_SELL) gd_464 = (Ask - OrderTakeProfit()) / Point / gi_452;
         if (OrderType() == OP_BUY) gd_464 = (OrderTakeProfit() - Bid) / Point / gi_452;
      }
   }
   return (count_0);
}

void f0_12() {
   for (int pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) {
      bool cg = OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol()) {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
            if (OrderType() == OP_BUY) cg = OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_164, Blue);
            if (OrderType() == OP_SELL) cg = OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_164, Red);
         }
         Sleep(1000);
      }
   }
}

int f0_1(int ai_0, double a_lots_4, double ad_unused_12, int a_slippage_20, double ad_unused_24, int ai_32, 
int ai_36, string a_comment_40, int a_magic_48, int a_datetime_52, color a_color_56) {
   int ticket_60;
   int error_64;
   int count_68;
   int li_72;
   if (gi_360 < gi_148) {
      ticket_60 = 0;
      error_64 = 0;
      count_68 = 0;
      li_72 = 100;
      switch (ai_0) {
      case 0:
         for (count_68 = 0; count_68 < li_72; count_68++) {
            RefreshRates();
            ticket_60 = OrderSend(Symbol(), OP_BUY, a_lots_4, Ask, a_slippage_20, f0_11(Bid, ai_32), 
f0_4(Ask, ai_36), a_comment_40, a_magic_48, a_datetime_52, a_color_56);
            error_64 = GetLastError();
            if (error_64 == 0/* NO_ERROR */) break;
            if (!((error_64 == 4/* SERVER_BUSY */ || error_64 == 137/* BROKER_BUSY */ || error_64 == 146/* TRADE_CONTEXT_BUSY */ || error_64 == 136/* OFF_QUOTES */))) break;
            Sleep(5000);
         }
         break;
      case 1:
         for (count_68 = 0; count_68 < li_72; count_68++) {
            ticket_60 = OrderSend(Symbol(), OP_SELL, a_lots_4, Bid, a_slippage_20, f0_16(Ask, ai_32), 
f0_22(Bid, ai_36), a_comment_40, a_magic_48, a_datetime_52, a_color_56);
            error_64 = GetLastError();
            if (error_64 == 0/* NO_ERROR */) break;
            if (!((error_64 == 4/* SERVER_BUSY */ || error_64 == 137/* BROKER_BUSY */ || 
error_64 == 146/* TRADE_CONTEXT_BUSY */ || error_64 == 136/* OFF_QUOTES */))) break;
            Sleep(5000);
         }
      }
   }
   return (ticket_60);
}

double f0_11(double ad_0, int ai_8) {
   if (ai_8 == 0) return (0);
   return (ad_0 - ai_8 * Point * gi_452);
}

double f0_16(double ad_0, int ai_8) {
   if (ai_8 == 0) return (0);
   return (ad_0 + ai_8 * Point * gi_452);
}

double f0_4(double ad_0, int ai_8) {
   if (ai_8 == 0) return (0);
   return (ad_0 + ai_8 * Point * gi_452);
}

double f0_22(double ad_0, int ai_8) {
   if (ai_8 == 0) return (0);
   return (ad_0 - ai_8 * Point * gi_452);
}

double f0_8() {
   double ld_ret_0 = 0;
   for (g_pos_356 = OrdersTotal() - 1; g_pos_356 >= 0; g_pos_356--) {
      bool cg = OrderSelect(g_pos_356, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
         if (OrderType() == OP_BUY || OrderType() == OP_SELL) ld_ret_0 += OrderProfit();
   }
   return (ld_ret_0);
}

void f0_17(int ai_0, int ai_4, double a_price_8) {
   int li_16;
   double order_stoploss_20;
   double price_28;
   if (ai_4 != 0) {
      for (int pos_36 = OrdersTotal() - 1; pos_36 >= 0; pos_36--) {
         if (OrderSelect(pos_36, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
            if (OrderSymbol() == Symbol() || OrderMagicNumber() == MagicNumber) {
               if (OrderType() == OP_BUY) {
                  li_16 = NormalizeDouble((Bid - a_price_8) / Point / gi_452, 0);
                  if (li_16 < ai_0) continue;
                  order_stoploss_20 = OrderStopLoss();
                  price_28 = Bid - ai_4 * Point * gi_452;
                  if (order_stoploss_20 == 0.0 || (order_stoploss_20 != 0.0 && price_28 > order_stoploss_20)) 
bool cg = OrderModify(OrderTicket(), a_price_8, price_28, OrderTakeProfit(), 0, Aqua);
               }
               if (OrderType() == OP_SELL) {
                  li_16 = NormalizeDouble((a_price_8 - Ask) / Point / gi_452, 0);
                  if (li_16 < ai_0) continue;
                  order_stoploss_20 = OrderStopLoss();
                  price_28 = Ask + ai_4 * Point * gi_452;
                  if (order_stoploss_20 == 0.0 || (order_stoploss_20 != 0.0 && price_28 < order_stoploss_20)) 
cg =OrderModify(OrderTicket(), a_price_8, price_28, OrderTakeProfit(), 0, Red);
               }
            }
            Sleep(1000);
         }
      }
   }
}

double f0_2() {
   if (f0_14() == 0) gd_400 = AccountEquity();
   if (gd_400 < gd_408) gd_400 = gd_408;
   else gd_400 = AccountEquity();
   gd_408 = AccountEquity();
   return (gd_400);
}

double f0_10() {
   double order_open_price_0;
   int ticket_8;
   double ld_unused_12 = 0;
   int ticket_20 = 0;
   for (int pos_24 = OrdersTotal() - 1; pos_24 >= 0; pos_24--) {
      bool cg = OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && OrderType() == OP_BUY) {
         ticket_8 = OrderTicket();
         if (ticket_8 > ticket_20) {
            order_open_price_0 = OrderOpenPrice();
            ld_unused_12 = order_open_price_0;
            ticket_20 = ticket_8;
         }
      }
   }
   return (order_open_price_0);
}

double f0_9() {
   double order_open_price_0;
   int ticket_8;
   double ld_unused_12 = 0;
   int ticket_20 = 0;
   for (int pos_24 = OrdersTotal() - 1; pos_24 >= 0; pos_24--) {
      bool cg = OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && OrderType() == OP_SELL) {
         ticket_8 = OrderTicket();
         if (ticket_8 > ticket_20) {
            order_open_price_0 = OrderOpenPrice();
            ld_unused_12 = order_open_price_0;
            ticket_20 = ticket_8;
         }
      }
   }
   return (order_open_price_0);
}

void f0_7() {
   string ls_0 = "";
   string ls_unused_8 = "";
   string ls_16 = "";
   string dbl2str_24 = DoubleToStr(f0_13(), 2);
   if (f0_13() > gd_472) gd_472 = f0_13();
   ls_16 = "Margin Usage:                            " + DoubleToStr(100 - 100.0 * (AccountFreeMargin() / 
AccountBalance()), 2) + "%\n";
   if (!f0_21()) ls_0 = "New Trades disallowed by scheduler";
   if (gi_176) ls_0 = "Freeze AfterTP Enabled";
   Comment("" + "OPEN TRADES :                         " + DoubleToStr(f0_5(), 0) + " / " 
+ gi_148 + "Total Profit/Loss :                        " + DoubleToStr(f0_3(), 2) 
      + "\n" 
   + ls_0);
}

double f0_3() {
   double ld_ret_0 = 0;
   int hist_total_8 = OrdersHistoryTotal();
   for (int pos_12 = 0; pos_12 < hist_total_8; pos_12++) {
      bool cg = OrderSelect(pos_12, SELECT_BY_POS, MODE_HISTORY);
      if (OrderMagicNumber() == MagicNumber) ld_ret_0 += OrderProfit() + OrderSwap() + OrderCommission();
   }
   return (ld_ret_0);
}


double f0_13() {
   double ld_ret_0 = (AccountEquity() / AccountBalance() - 1.0) / (-0.01);
   if (ld_ret_0 <= 0.0) return (0);
   return (ld_ret_0);
}

int f0_5() {
   int order_total_0 = OrdersTotal();
   int count_4 = 0;
   for (int pos_8 = 0; pos_8 < order_total_0; pos_8++) {
      bool cg = OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES);
      if ((OrderType() == OP_SELL || OrderType() == OP_BUY) && OrderSymbol() == Symbol() 
&& OrderMagicNumber() == MagicNumber) count_4++;
   }
   return (count_4);
}

string f0_0(int ai_0) {
   if (ai_0 == 0) return ("HTTP Error");
   if (ai_0 == 1) return ("Account does not exist or banned");
   if (ai_0 == 2) return ("Account Activation Successful");
   if (ai_0 == 3) return ("Account Authentication Successful");
   if (ai_0 == 4) return ("Account not Activated!!!");
   if (ai_0 == 5) return ("Insert a valid CLICKBANK ID.");
   return ("Ok");
}

int f0_18(int ai_0, int ai_4, double ad_8, double ad_16, double ad_24, double ad_32, double ad_40, 
double ad_48, double ad_56) {
   if (ai_0 && ad_40 * ad_48 * ad_56 <= ad_24 - ad_16) return (1);
   if (ai_4 && ad_8 - ad_32 >= ad_56 * ad_48 * ad_40) return (1);
   return (0);
}
如您喜欢此文章请点下面分享按钮↴峰汇在线 » 智能交易系统Lucky Pip-sofia
上一篇:
下一篇:
分享到:更多 ()