超短线自动交易EA LR NightScalper.mq4-MT4 EA-峰汇在线
诚信为本
量力而为
当前位置:峰汇在线 > MetaTrader 4 > MT4 EA > 正文

超短线自动交易EA LR NightScalper.mq4

LR NightScalper EA综合均线MA、CCI、WPR、Fractals等指标的信号在进行超短交易。

源码:

//+------------------------------------------------------------------+
//|                                              LR NightScalper.mq4 |
//|                                                           Stefan |
//+------------------------------------------------------------------+
#property copyright "Stefan"
#property link      "http://www.125808047.com"

extern string S_1 = "If MAGIC=0, a unique value will be generated by EA";
extern int MAGIC = 0;
extern bool New_Trade = TRUE;
extern string S0 = "----------------------";
extern double lot = 0.1;
extern double Risk = 7.5;
extern bool Hide_SL_TP = FALSE;
extern double TakeProfit = 50.0;
extern double StopLoss = 40.0;
extern int Slippage = 3;
extern double Max_Spread = 6.0;
extern string S1 = "----------------------";
extern bool Allow_Second_Trade = FALSE;
extern double Distance = 12.0;
extern double Lot_Factor = 0.5;
extern string S2 = "----------------------";
extern int GMT_Offset = 0;
extern int Open_Hour = 20;
extern int Close_Hour = 23;
extern bool TradeOnFriday = FALSE;
extern int Friday_Hour = 15;
extern string S3 = "----------------------";
extern bool Use_CCI = FALSE;
extern int CCI_Period = 10;
extern double CCI_Entry = 200.0;
extern double CCI_Exit = 140.0;
extern string S4 = "----------------------";
extern bool Use_WPR = TRUE;
extern int WPR_Period = 10;
extern double WPR_Entry = 91.0;
extern double WPR_Exit = 40.0;
extern string S5 = "----------------------";
extern bool Use_Fractals = TRUE;
extern double MidFractalDist = 5.0;
extern double OppositFractalDist = 10.0;
extern string S6 = "----------------------";
extern bool Use_MA1 = FALSE;
extern int MA_Period1 = 10;
extern bool Use_MA2 = FALSE;
extern int MA_Period2 = 19;
extern bool Use_MA2_Slope = FALSE;
extern double MA_Slope = 1.0;
string Gs_unused_340 = "-----------------------";
bool Gi_348;
int G_datetime_352;
double G_lots_356;
double G_ifractals_364;
double G_ifractals_372;
double Gd_380;
int Gi_388 = 10;
double Gda_392[];
string Gs_396;
int G_magic_404;
bool Gi_408;
bool Gi_412;
bool Gi_416;
bool Gi_420;
bool Gi_424;
bool Gi_428;
bool Gi_432;
bool Gi_436;
bool Gi_440;
bool Gi_444;
bool Gi_448;
bool Gi_452;
bool Gi_456;
bool Gi_460;
bool Gi_464;
bool Gi_468;
double G_icci_472;
double G_iwpr_480;
double G_ima_488;
double G_ima_496;
double G_ima_504;
double G_ima_512;
string G_comment_520 = "";
double Gd_528 = 0.0;
bool cg = false;

int OnInit()
{ 
   if (MAGIC == 0) MAGIC = 100.0 * MathFloor(AccountNumber() / 49432);
   if (MAGIC > 0) MAGIC = 100 * MAGIC;
   if (StringSubstr(Symbol(), 0, 6) == "EURCAD") G_magic_404 = MAGIC + 1;
   if (StringSubstr(Symbol(), 0, 6) == "EURGBP") G_magic_404 = MAGIC + 2;
   if (StringSubstr(Symbol(), 0, 6) == "USDCAD") G_magic_404 = MAGIC + 3;
   if (StringSubstr(Symbol(), 0, 6) == "EURCHF") G_magic_404 = MAGIC + 4;
   if (StringSubstr(Symbol(), 0, 6) == "USDCHF") G_magic_404 = MAGIC + 5;
   if (StringSubstr(Symbol(), 0, 6) == "GBPCHF") G_magic_404 = MAGIC + 6;
   if (StringSubstr(Symbol(), 0, 6) == "GBPCAD") G_magic_404 = MAGIC + 7;
   if (StringSubstr(Symbol(), 0, 6) == "EURUSD") G_magic_404 = MAGIC + 8;
   if (StringSubstr(Symbol(), 0, 6) == "CADJPY") G_magic_404 = MAGIC + 9;
   if (StringSubstr(Symbol(), 0, 6) == "GBPJPY") G_magic_404 = MAGIC + 10;
   if (StringSubstr(Symbol(), 0, 6) == "CADCHF") G_magic_404 = MAGIC + 11;
   if (StringSubstr(Symbol(), 0, 6) == "GBPUSD") G_magic_404 = MAGIC + 12;
   if (StringSubstr(Symbol(), 0, 6) == "USDJPY") G_magic_404 = MAGIC + 13;
   if (StringSubstr(Symbol(), 0, 6) == "AUDUSD") G_magic_404 = MAGIC + 14;
   if (StringSubstr(Symbol(), 0, 6) == "AUDCAD") G_magic_404 = MAGIC + 15;
   if (StringSubstr(Symbol(), 0, 6) == "AUDJPY") G_magic_404 = MAGIC + 16;
   if (StringSubstr(Symbol(), 0, 6) == "EURAUD") G_magic_404 = MAGIC + 17;
   if (StringSubstr(Symbol(), 0, 6) == "GBPAUD") G_magic_404 = MAGIC + 18;
   if (StringSubstr(Symbol(), 0, 6) == "EURNZD") G_magic_404 = MAGIC + 19;
   if (StringSubstr(Symbol(), 0, 6) == "GBPNZD") G_magic_404 = MAGIC + 20;
   if (StringSubstr(Symbol(), 0, 6) == "EURNOK") G_magic_404 = MAGIC + 21;
   if (StringSubstr(Symbol(), 0, 6) == "EURSEK") G_magic_404 = MAGIC + 22;
   if (StringSubstr(Symbol(), 0, 6) == "NZDUSD") G_magic_404 = MAGIC + 23;
   if (StringSubstr(Symbol(), 0, 6) == "NZDJPY") G_magic_404 = MAGIC + 24;
   if (StringSubstr(Symbol(), 0, 6) == "EURJPY") G_magic_404 = MAGIC + 25;
   if (StringSubstr(Symbol(), 0, 6) == "AUDCHF") G_magic_404 = MAGIC + 26;
   if (StringSubstr(Symbol(), 0, 6) == "NZDCHF") G_magic_404 = MAGIC + 27;
   G_comment_520 = "==" + Symbol() + "==";
   Open_Hour += GMT_Offset;
   Close_Hour += GMT_Offset;
   Friday_Hour += GMT_Offset;
   if (Open_Hour >= 24) Open_Hour -= 24;
   if (Close_Hour >= 24) Close_Hour -= 24;
   Comment("www.125808047.com");
   return(INIT_SUCCEEDED);
}

void OnTick()
{
   int ticket_12;
   int ticket_16;
   if ((!IsTesting()) || (!IsOptimization())) f0_8();
   if ((!IsTesting()) || (!IsOptimization())) f0_0(Ask - Bid);
   if (Use_CCI) G_icci_472 = iCCI(NULL, 0, CCI_Period, PRICE_CLOSE, 0);
   if (Use_WPR) G_iwpr_480 = iWPR(NULL, 0, WPR_Period, 0);
   if (Use_MA1) G_ima_488 = iMA(NULL, 0, MA_Period1, 0, MODE_SMMA, PRICE_CLOSE, 1);
   if (Use_MA1) G_ima_496 = iMA(NULL, 0, MA_Period1, 0, MODE_SMMA, PRICE_CLOSE, 2);
   if (Use_MA2 || Use_MA2_Slope) G_ima_504 = iMA(NULL, 0, MA_Period2, 0, MODE_SMMA, PRICE_CLOSE, 1);
   if (Use_MA2 || Use_MA2_Slope) G_ima_512 = iMA(NULL, 0, MA_Period2, 0, MODE_SMMA, PRICE_CLOSE, 2);
   if (Use_Fractals) {
      for (int Li_0 = 1; Li_0 < Bars; Li_0++) {
         if (iFractals(NULL, 0, MODE_UPPER, Li_0) != 0.0) {
            G_ifractals_364 = iFractals(NULL, 0, MODE_UPPER, Li_0);
            break;
         }
      }
      for (int Li_4 = 1; Li_4 < Bars; Li_4++) {
         if (iFractals(NULL, 0, MODE_LOWER, Li_4) != 0.0) {
            G_ifractals_372 = iFractals(NULL, 0, MODE_LOWER, Li_4);
            break;
         }
      }
      Gd_380 = (G_ifractals_364 + G_ifractals_372) / 2.0;
   }
   Gi_408 = FALSE;
   Gi_412 = FALSE;
   Gi_416 = FALSE;
   Gi_420 = FALSE;
   Gi_424 = FALSE;
   Gi_428 = FALSE;
   Gi_432 = FALSE;
   Gi_436 = FALSE;
   Gi_464 = FALSE;
   Gi_468 = FALSE;
   Gi_440 = FALSE;
   Gi_444 = FALSE;
   if (!Use_CCI) {
      Gi_408 = TRUE;
      Gi_412 = TRUE;
   }
   if (!Use_WPR) {
      Gi_416 = TRUE;
      Gi_420 = TRUE;
   }
   if (!Use_MA1) {
      Gi_424 = TRUE;
      Gi_428 = TRUE;
   }
   if (!Use_MA2) {
      Gi_432 = TRUE;
      Gi_436 = TRUE;
   }
   if (!Use_MA2_Slope) {
      Gi_464 = TRUE;
      Gi_468 = TRUE;
   }
   if (!Use_Fractals) {
      Gi_440 = TRUE;
      Gi_444 = TRUE;
   }
   if (Use_CCI && G_icci_472 < (-CCI_Entry)) Gi_408 = TRUE;
   if (Use_CCI && G_icci_472 > CCI_Entry) Gi_412 = TRUE;
   if (Use_WPR && G_iwpr_480 < (-WPR_Entry)) Gi_416 = TRUE;
   if (Use_WPR && G_iwpr_480 > (-(100 - WPR_Entry))) Gi_420 = TRUE;
   if (Use_MA1 && Ask < G_ima_488 - 50.0 * f0_12()) Gi_424 = TRUE;
   if (Use_MA1 && Bid > G_ima_488 + 50.0 * f0_12()) Gi_428 = TRUE;
   if (Use_MA2 && G_ima_504 > G_ima_512) Gi_432 = TRUE;
   if (Use_MA2 && G_ima_504 < G_ima_512) Gi_436 = TRUE;
   if (Use_MA2_Slope && G_ima_504 - G_ima_512 >= MA_Slope * f0_12()) Gi_464 = TRUE;
   if (Use_MA2_Slope && G_ima_512 - G_ima_504 >= MA_Slope * f0_12()) Gi_468 = TRUE;
   if (Use_Fractals && Ask < Gd_380 - MidFractalDist * f0_12() && Ask < G_ifractals_364 - OppositFractalDist * f0_12()) Gi_440 = TRUE;
   if (Use_Fractals && Bid > Gd_380 + MidFractalDist * f0_12() && Bid > G_ifractals_372 + OppositFractalDist * f0_12()) Gi_444 = TRUE;
   if ((!Use_CCI) && (!Use_WPR) && (!Use_Fractals)) {
      Print("You must use at least one signal (CCI, WPR, or Fractals");
   }
   Gi_448 = FALSE;
   Gi_452 = FALSE;
   Gi_456 = FALSE;
   Gi_460 = FALSE;
   if (Use_CCI && G_icci_472 > CCI_Exit) Gi_448 = TRUE;
   if (Use_CCI && G_icci_472 < (-CCI_Exit)) Gi_452 = TRUE;
   if (Use_WPR && G_iwpr_480 > (-WPR_Exit)) Gi_456 = TRUE;
   if (Use_WPR && G_iwpr_480 < WPR_Exit + (-100.0)) Gi_460 = TRUE;
   if (OrdersTotal() > 0) {
      for (int pos_8 = 0; pos_8 < OrdersTotal(); pos_8++) {
         cg = OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES);
         if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_404 && (Gi_448 == TRUE || Gi_456 == TRUE) && f0_0() < Max_Spread * f0_12() &&
            Ask - Bid < Max_Spread * f0_12()) f0_2(G_magic_404);
         if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_404 && (Gi_452 == TRUE || Gi_460 == TRUE) && f0_0() < Max_Spread * f0_12() &&
            Ask - Bid < Max_Spread * f0_12()) f0_2(G_magic_404);
      }
      for (pos_8 = 0; pos_8 < OrdersTotal(); pos_8++) {
         cg = OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES);
         if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_404 && (Ask - OrderOpenPrice() >= TakeProfit * f0_12() || OrderOpenPrice() - Ask >= StopLoss * f0_12())) cg = OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet);
         if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_404 && (OrderOpenPrice() - Bid >= TakeProfit * f0_12() || Bid - OrderOpenPrice() >= StopLoss * f0_12())) cg = OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet);
      }
   }
   Gi_348 = TRUE;
   if ((!TradeOnFriday) && DayOfWeek() == 5) Gi_348 = FALSE;
   if (TradeOnFriday && DayOfWeek() == 5 && TimeHour(TimeCurrent()) > Friday_Hour) Gi_348 = FALSE;
   if (Open_Hour >= 24) Open_Hour -= 24;
   if (Close_Hour >= 24) Close_Hour -= 24;
   if (Open_Hour < Close_Hour && (TimeHour(TimeCurrent()) < Open_Hour || TimeHour(TimeCurrent()) >= Close_Hour)) Gi_348 = FALSE;
   if (Open_Hour > Close_Hour && (TimeHour(TimeCurrent()) < Open_Hour && TimeHour(TimeCurrent()) >= Close_Hour)) Gi_348 = FALSE;
   if (Month() == 12 && Day() > 22) Gi_348 = FALSE;
   if (Month() == 1 && Day() < 5) Gi_348 = FALSE;
   if (Gi_348 && f0_3(G_magic_404) == 0 && (!Allow_Second_Trade) && f0_0() < Max_Spread * f0_12() && Ask - Bid < Max_Spread * f0_12()) Gs_396 = "Trade Session Open .. Waiting for trades";
   if (Gi_348 && f0_3(G_magic_404) == 0 && (f0_0() > Max_Spread * f0_12() || Ask - Bid > Max_Spread * f0_12())) Gs_396 = "Trade Session Open .. Spread is High .. Trading Halted";
   if (Gi_348 && f0_3(G_magic_404) > 0 && (f0_0() > Max_Spread * f0_12() || Ask - Bid > Max_Spread * f0_12())) Gs_396 = "Trade Session Open..Waiting to exit trades..Trading Halted";
   if ((!Gi_348) && f0_3(G_magic_404) == 0) Gs_396 = "Trade Session Closed";
   if ((!Gi_348) && f0_3(G_magic_404) > 0) Gs_396 = "Trade Session Closed .. Waiting to exit trades";
   if (New_Trade && f0_0() < Max_Spread * f0_12() && Ask - Bid < Max_Spread * f0_12() && f0_3(G_magic_404) == 0 && Gi_348 && Time[0] != G_datetime_352 && Gi_408 == TRUE &&
      Gi_416 == TRUE && Gi_424 == TRUE && Gi_432 == TRUE && Gi_464 == TRUE && Gi_440 == TRUE) {
      G_lots_356 = f0_11(Risk);
      ticket_12 = OrderSend(Symbol(), OP_BUY, G_lots_356, Ask, Slippage, 0, 0, G_comment_520, G_magic_404, 0, Lime);
      if (ticket_12 > 0) {
         G_datetime_352 = iTime(NULL, 0, 0);
         if (!Hide_SL_TP) f0_6();
      }
   }
   if (New_Trade && f0_0() < Max_Spread * f0_12() && Ask - Bid < Max_Spread * f0_12() && f0_3(G_magic_404) == 0 && Gi_348 && Time[0] != G_datetime_352 && Gi_412 == TRUE &&
      Gi_420 == TRUE && Gi_428 == TRUE && Gi_436 == TRUE && Gi_468 && Gi_444 == TRUE) {
      G_lots_356 = f0_11(Risk);
      ticket_16 = OrderSend(Symbol(), OP_SELL, G_lots_356, Bid, Slippage, 0, 0, G_comment_520, G_magic_404, 0, Red);
      if (ticket_16 > 0) {
         G_datetime_352 = iTime(NULL, 0, 0);
         if (!Hide_SL_TP) f0_6();
      }
   }
   if (f0_3(G_magic_404) == 1 && Allow_Second_Trade && Time[0] != G_datetime_352 && f0_9() == 0 && Ask <= f0_10() - Distance * f0_12()) {
      G_lots_356 = f0_11(Risk * Lot_Factor);
      ticket_12 = OrderSend(Symbol(), OP_BUY, G_lots_356, Ask, Slippage, 0, 0, G_comment_520, G_magic_404, 0, Lime);
      if (ticket_12 > 0) {
         G_datetime_352 = iTime(NULL, 0, 0);
         if (!Hide_SL_TP) f0_6();
      }
   }
   if (f0_3(G_magic_404) == 1 && Allow_Second_Trade && Time[0] != G_datetime_352 && f0_9() == 1 && Bid >= f0_5() + Distance * f0_12()) {
      G_lots_356 = f0_11(Risk * Lot_Factor);
      ticket_16 = OrderSend(Symbol(), OP_SELL, G_lots_356, Bid, Slippage, 0, 0, G_comment_520, G_magic_404, 0, Red);
      if (ticket_16 > 0) {
         G_datetime_352 = iTime(NULL, 0, 0);
         if (!Hide_SL_TP) f0_6();
      }
   }
   if ((!Hide_SL_TP) && f0_3(G_magic_404) > 0) f0_6();
}

int f0_3(int A_magic_0) {
   int count_4 = 0;
   int order_total_8 = OrdersTotal();
   for (int pos_12 = 0; pos_12 < order_total_8; pos_12++) {
      cg = OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES);
      if (OrderMagicNumber() == A_magic_0 && OrderSymbol() == Symbol() && OrderType() <= OP_SELL) count_4++;
   }
   return (count_4);
}

double f0_5() {
   int ticket_8;
   double order_open_price_0 = 0;
   double Ld_unused_12 = 0;
   int ticket_20 = 0;
   for (int pos_24 = OrdersTotal() - 1; pos_24 >= 0; pos_24--) {
      cg = OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != G_magic_404) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_404 && 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);
}

double f0_10() {
   double order_open_price_0 = 0;
   int ticket_8 = 0;
   double Ld_unused_12 = 0;
   int ticket_20 = 0;
   for (int pos_24 = OrdersTotal() - 1; pos_24 >= 0; pos_24--) {
      cg = OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != G_magic_404) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_404 && 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);
}

int f0_9() {
   int cmd_0 = -1;
   int ticket_4 = 0;
   double Ld_unused_8 = 0;
   int ticket_16 = 0;
   for (int pos_20 = OrdersTotal() - 1; pos_20 >= 0; pos_20--) {
      cg = OrderSelect(pos_20, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != G_magic_404) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_404 && OrderType() <= OP_SELL) {
         ticket_4 = OrderTicket();
         if (ticket_4 > ticket_16) {
            cmd_0 = OrderType();
            Ld_unused_8 = cmd_0;
            ticket_16 = ticket_4;
         }
      }
   }
   return (cmd_0);
}

int f0_2(int A_magic_0) {
   for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
      cg = OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == A_magic_0 && OrderCloseTime() == 0) {
         if (OrderType() == OP_BUY) cg = OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Blue);
         if (OrderType() == OP_SELL) cg = OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Red);
      }
   }
   return (0);
}

double f0_11(double Ad_0) {
   int Li_8;
   double Ld_12 = MarketInfo(Symbol(), MODE_MINLOT);
   double Ld_20 = MarketInfo(Symbol(), MODE_MAXLOT);
   double Ld_ret_28 = 0.0;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 1.0) Li_8 = 1;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 0.1) Li_8 = 2;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 0.01) Li_8 = 3;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 0.001) Li_8 = 4;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 0.0001) Li_8 = 5;
   if (lot > 0.0) {
      Ld_ret_28 = lot;
      return (Ld_ret_28);
   }
   if (Ld_ret_28 == 0.0) {
      Ld_ret_28 = NormalizeDouble(AccountBalance() / 100000.0 * Ad_0, Li_8);
      if (Ld_ret_28 < Ld_12) Ld_ret_28 = Ld_12;
      if (Ld_ret_28 <= Ld_20) return (Ld_ret_28);
      Ld_ret_28 = Ld_20;
      return (Ld_ret_28);
   }
   return (0.0);
}

double f0_12() {
   if (MarketInfo(Symbol(), MODE_DIGITS) == 5.0 || MarketInfo(Symbol(), MODE_DIGITS) == 3.0) return (10.0 * Point);
   return (Point);
}

void f0_6() {
   for (int pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) {
      cg = OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_404) {
         if (OrderStopLoss() == 0.0 || OrderTakeProfit() == 0.0) {
            if (OrderType() == OP_BUY) cg = OrderModify(OrderTicket(), OrderOpenPrice(), f0_7(OrderOpenPrice() - f0_12() * StopLoss), f0_7(OrderOpenPrice() + TakeProfit * f0_12()), 0, Green);
            if (OrderType() == OP_SELL) cg = OrderModify(OrderTicket(), OrderOpenPrice(), f0_7(OrderOpenPrice() + f0_12() * StopLoss), f0_7(OrderOpenPrice() - TakeProfit * f0_12()), 0, Red);
         }
      }
   }
}

double f0_0(double Ad_0 = 0.0) {
   double Ld_8;
   if (Ad_0 == 0.0 && Gi_388 <= 0) return (Ask - Bid);
   if (Ad_0 == 0.0 && Gd_528 == 0.0) return (Ask - Bid);
   if (Ad_0 == 0.0) return (Gd_528 / ArraySize(Gda_392));
   Gd_528 += Ad_0;
   ArraySetAsSeries(Gda_392, TRUE);
   if (ArraySize(Gda_392) == Gi_388) {
      Ld_8 = Gda_392[0];
      Gd_528 -= Ld_8;
      ArraySetAsSeries(Gda_392, FALSE);
      ArrayResize(Gda_392, ArraySize(Gda_392) - 1);
      ArraySetAsSeries(Gda_392, TRUE);
      ArrayResize(Gda_392, ArraySize(Gda_392) + 1);
   } else ArrayResize(Gda_392, ArraySize(Gda_392) + 1);
   ArraySetAsSeries(Gda_392, FALSE);
   Gda_392[0] = Ad_0;
   return (NormalizeDouble(Gd_528 / ArraySize(Gda_392), Digits));
}

double f0_7(double Ad_0) {
   double Ld_8 = 0;
   Ld_8 = NormalizeDouble(Ad_0, Digits);
   return (Ld_8);
}

void f0_8() {
   Comment("\n*=====================*", 
      "\n   " + Gs_396, 
      "\n*=====================*", 
      "\n    平台时间    =  ", Hour() + " : " + Minute(), 
      "\n    开始时间    =  " + DoubleToStr(Open_Hour, 2), 
      "\n    结束时间    =  " + DoubleToStr(Close_Hour, 2), 
      "\n", 
      "\n    订单标识    = " + G_magic_404, 
      "\n    最大点差    = " + DoubleToStr(Max_Spread, 1), 
      "\n    平均点差    = " + DoubleToStr(f0_0() / f0_12(), 1), 
      "\n    交易手数                =  " + DoubleToStr(f0_11(Risk), 2), 
      "\n    止损点数             = " + DoubleToStr(StopLoss, 0), 
      "\n*=====================*", 
      "\n     收益合计   = " + DoubleToStr(f0_4() + f0_1(), 2), 
      "\n*=====================*", 
      "\n     帐户金额   =  " + DoubleToStr(AccountBalance(), 2), 
      "\n     净值金额   =  " + DoubleToStr(AccountEquity(), 2), 
   "\n*=====================*");
}

double f0_4() {
   double Ld_ret_0 = 0;
   int hist_total_8 = OrdersHistoryTotal();
   for (int pos_12 = 0; pos_12 < hist_total_8; pos_12++) {
      if (OrderSelect(pos_12, SELECT_BY_POS, MODE_HISTORY))
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_404) Ld_ret_0 += OrderProfit();
   }
   return (Ld_ret_0);
}

double f0_1() {
   int Li_unused_0 = 0;
   int order_total_4 = OrdersTotal();
   double Ld_ret_8 = 0;
   for (int pos_16 = 0; pos_16 < order_total_4; pos_16++) {
      cg = OrderSelect(pos_16, SELECT_BY_POS, MODE_TRADES);
      if (OrderMagicNumber() == G_magic_404 && OrderType() <= OP_SELL) Ld_ret_8 += OrderProfit();
   }
   return (Ld_ret_8);
}
打赏
版权所有转载请注明标题及链接:峰汇在线 » 超短线自动交易EA LR NightScalper.mq4
上一篇:
下一篇:
分享到: 更多 (0)

如您觉得此文不错请扫码打赏!

支付宝扫一扫打赏

微信扫一扫打赏