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

Intraday Scalper v.1.030 EA



Intraday Scalper v.1.030 EA采用挂单交易。根据一定范围内的高低点放置buy stop 和sell stop两个挂单,带有止损和盈利及特定条件删除挂单。

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

//+------------------------------------------------------------------+
//|                                     Intraday Scalper v.1.030.mq4 |
//|                                         Copyright WWW.SCALPER.RU |
//+------------------------------------------------------------------+
#property copyright "WWW.SCALPER.RU"
#property link      "WWW.SCALPER.RU"

extern int Start1 = 10;
extern int Start2 = 14;
extern int EOD = 24;
extern int FridayClosing = 23;
extern bool FirstSessionOnly = FALSE;
extern int Length = 4;
extern int Pips = 5;
extern int StopLoss = 50;
extern int BreakEven = 30;
extern int TrailingStop = 0;
extern int LossPips = 0;
extern int TakeProfit = 80;
extern double Lots = 0.1;
extern bool MM = TRUE;
extern int LotsPercent = 10;
int gi_140;
int gi_unused_144;
bool gi_148 = TRUE;
double g_stoplevel_152;
double g_spread_160;
double g_maxlot_168;
double g_minlot_176;
double g_lotstep_184;
bool cg = false;


double setpoint() {
   double l_point_0;
   if (Digits == 3) l_point_0 = 0.01;
   else {
      if (Digits == 5) l_point_0 = 0.0001;
      else l_point_0 = Point;
   }
   return (l_point_0);
}

int init() {
   gi_unused_144 = 3;
  // gi_140 = StringGetChar(Symbol(), 0) + 77706 + StringGetChar(Symbol(), 1) * 2 + 3 * StringGetChar(Symbol(), 3) + StringGetChar(Symbol(), 4) << 2 + 10000 * Period();
   g_stoplevel_152 = MarketInfo(Symbol(), MODE_STOPLEVEL);
   g_spread_160 = MarketInfo(Symbol(), MODE_SPREAD);
   g_maxlot_168 = MarketInfo(Symbol(), MODE_MAXLOT);
   g_minlot_176 = MarketInfo(Symbol(), MODE_MINLOT);
   g_lotstep_184 = MarketInfo(Symbol(), MODE_LOTSTEP);
   HideTestIndicators(TRUE);
   return (0);
}

void deinit() {
  Comment("www.125808047.com");
}

int start() {
   double ld_0;
   string ls_8;
 
   if (AccountFreeMargin() < 1500.0 * ld_0) return (0);
   if (MM) {
      if (LotsPercent > 0) Lots = NormalizeDouble(MathCeil(AccountFreeMargin() / 10000.0 * LotsPercent) / 10.0, 1);
      else Lots = ld_0;
   }
   if (EOD >= 24) EOD = 0;
   if (FridayClosing == 0) FridayClosing = 24;
   string ls_16 = "IDS_" + Symbol();
   if (Hour() == Start1 && Minute() < 10) SetOrders(ls_16, 1);
   if (Hour() == Start2 && Minute() < 10 && !FirstSessionOnly) SetOrders(ls_16, 2);
   for (int l_pos_24 = OrdersTotal() - 1; l_pos_24 >= 0; l_pos_24--) {
      cg = OrderSelect(l_pos_24, SELECT_BY_POS);
      if (OrderComment() == ls_16) {
         if (Hour() == EOD || (DayOfWeek() >= 5 && Hour() == FridayClosing - 1 && Minute() >= 50)) {
            switch (OrderType()) {
            case OP_BUY:
               cg = OrderClose(OrderTicket(), OrderLots(), Bid, 3, Red);
               break;
            case OP_SELL:
               cg = OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red);
               break;
            default:
               cg = OrderDelete(OrderTicket());
            }
         } else {
            if (LossPips > 0) {
               if (OrderType() == OP_BUY)
                  if (OrderOpenPrice() - Bid >= LossPips * setpoint()) cg = OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderOpenPrice(), 0, Green);
               if (OrderType() == OP_SELL)
                  if (Ask - OrderOpenPrice() >= LossPips * setpoint()) cg = OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderOpenPrice(), 0, Green);
            }
            if (TrailingStop == 0) {
               if (OrderType() == OP_BUY)
                  if (High[0] - OrderOpenPrice() >= BreakEven * setpoint() && OrderStopLoss() < OrderOpenPrice()) cg = OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, Green);
               if (OrderType() == OP_SELL)
                  if (OrderOpenPrice() - Low[0] >= BreakEven * setpoint() && OrderStopLoss() > OrderOpenPrice()) cg = OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, Green);
            } else {
               if (OrderType() == OP_BUY)
                  if (High[0] - OrderStopLoss() >= (StopLoss + TrailingStop) * setpoint()) cg = OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss() + TrailingStop * setpoint(), OrderTakeProfit(), 0, Green);
               if (OrderType() == OP_SELL)
                  if (OrderStopLoss() - Low[0] >= (StopLoss + TrailingStop) * setpoint()) cg = OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss() - TrailingStop * setpoint(), OrderTakeProfit(), 0, Green);
            }
         }
      }
   }
   return (0);
}

void SetOrders(string a_comment_0, int a_magic_8) {
   int l_ticket_12;
   int l_count_16 = 0;
   int l_count_20 = 0;
   double ld_24 = iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, Length, 1)) + Pips * setpoint();
   double ld_32 = iLow(NULL, PERIOD_H1, iLowest(NULL, PERIOD_H1, MODE_LOW, Length, 1)) - Pips * setpoint();
   double l_price_40 = MathMax(ld_24 - StopLoss * setpoint(), ld_32);
   double l_price_48 = MathMin(ld_32 + StopLoss * setpoint(), ld_24);
   double l_price_56 = ld_24 + TakeProfit * setpoint();
   double l_price_64 = ld_32 - TakeProfit * setpoint();
   for (int l_pos_72 = 0; l_pos_72 < OrdersTotal(); l_pos_72++) {
      cg = OrderSelect(l_pos_72, SELECT_BY_POS, MODE_TRADES);
      if (OrderComment() == a_comment_0 && OrderMagicNumber() == a_magic_8) {
         if (OrderType() == OP_BUYSTOP || OrderType() == OP_BUY) l_count_16++;
         if (OrderType() == OP_SELLSTOP || OrderType() == OP_SELL) l_count_20++;
      }
   }
   if (l_count_16 == 0) {
      l_ticket_12 = OrderSend(Symbol(), OP_BUYSTOP, Lots, ld_24, 3, l_price_40, l_price_56, a_comment_0, a_magic_8, 0, Green);
      if (l_ticket_12 < 0 && GetLastError() == 130/* INVALID_STOPS */) l_ticket_12 = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, l_price_40, l_price_56, a_comment_0, a_magic_8, 0, Green);
   }
   if (l_count_20 == 0) {
      l_ticket_12 = OrderSend(Symbol(), OP_SELLSTOP, Lots, ld_32, 3, l_price_48, l_price_64, a_comment_0, a_magic_8, 0, Green);
      if (l_ticket_12 < 0 && GetLastError() == 130/* INVALID_STOPS */) l_ticket_12 = OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, l_price_48, l_price_64, a_comment_0, a_magic_8, 0, Green);
   }
}

如您喜欢此文章请点下面分享按钮↴峰汇在线 » Intraday Scalper v.1.030 EA
上一篇:
下一篇:
分享到:更多 ()