ROBOTRADING - Форум по автоматизированной и ручной торговле на финансовых рынках.

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.



Пипсюк ScalperPilotAdvisor

Сообщений 1 страница 3 из 3

1

Код:
//=====================================================================
extern int MinPrfofit = 1;
extern int MaxLoss = 10;
extern int Delta = 3;
extern int BB_Period = 1;
extern int BB_Deviation = 2;
extern bool FixLotMM = FALSE;
extern double FixLotSize = 0.1;
extern double RiskPercent = 10.0;
extern int Slippage = 2;

//=====================================================================
int g_magic_132;
double g_stoplevel_140;
double g_spread_148;
double g_maxlot_156;
double g_minlot_164;
double g_lotstep_172;
double g_lots_180;
double gd_188;
string Comm="";
//=====================================================================
int init() {

   g_magic_132 = StringGetChar(Symbol(), 0) + 77704 + StringGetChar(Symbol(), 1) << 1 + 3 * StringGetChar(Symbol(), 3) + StringGetChar(Symbol(), 4) << 2 + 10000 * Period();
   HideTestIndicators(TRUE);
   return (0);
}
//=====================================================================
int start() {
   string ls_0;
   double l_price_8;
   double l_price_16;
   double ld_24;
   bool li_32;
   bool li_36;
   g_stoplevel_140 = MarketInfo(Symbol(), MODE_STOPLEVEL);
   g_spread_148 = MarketInfo(Symbol(), MODE_SPREAD);
   g_maxlot_156 = MarketInfo(Symbol(), MODE_MAXLOT);
   g_minlot_164 = MarketInfo(Symbol(), MODE_MINLOT);
   g_lotstep_172 = MarketInfo(Symbol(), MODE_LOTSTEP);
   
   if (FixLotMM) g_lots_180 = FixLotSize;
   else g_lots_180 = AccountFreeMargin() / 1000.0 * (RiskPercent / 100.0);
   if (g_lots_180 < g_minlot_164) g_lots_180 = g_minlot_164;
   else {
      if (g_lots_180 > g_maxlot_156) g_lots_180 = g_maxlot_156;
      else {
         for (gd_188 = g_minlot_164; gd_188 <= g_lots_180; gd_188 += g_lotstep_172) {
         }
         g_lots_180 = gd_188 - g_lotstep_172;
      }
   }
   for (int $i = OrdersTotal() - 1; $i >= 0; $i--) {
      OrderSelect($i, SELECT_BY_POS);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != g_magic_132) continue;
      if (OrderType() == OP_BUY) {
         ld_24 = Bid - OrderOpenPrice();
         if ((MinPrfofit > 0 && ld_24 >= MinPrfofit * Point) || (MaxLoss > 0 && ld_24 <= (-1 * MaxLoss) * Point)) {
            OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Purple);
         }
      }
      if (OrderType() == OP_SELL) {
         ld_24 = OrderOpenPrice() - Ask;
         if ((MinPrfofit > 0 && ld_24 >= MinPrfofit * Point) || (MaxLoss > 0 && ld_24 <= (-1 * MaxLoss) * Point)) {
            OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Red);
         }
      }
   }
   double l_ibands_44 = iBands(Symbol(), 0, BB_Period, BB_Deviation, 0, PRICE_OPEN, MODE_UPPER, 0);
   double l_ibands_52 = iBands(Symbol(), 0, BB_Period, BB_Deviation, 0, PRICE_OPEN, MODE_LOWER, 0);
   if (Close[0] > l_ibands_44 + Delta * Point) li_36 = TRUE;
   else li_36 = FALSE;
   if (Close[0] < l_ibands_52 - Delta * Point) li_32 = TRUE;
   else li_32 = FALSE;
   if (li_32) {
      if (MaxLoss == 0) l_price_8 = 0;
      else l_price_8 = Ask - (MaxLoss + g_stoplevel_140) * Point;
      if (MinPrfofit == 0) l_price_16 = 0;
      else l_price_16 = Ask + (MinPrfofit + g_stoplevel_140 + g_spread_148) * Point;
      OrderSend(Symbol(), OP_BUY, g_lots_180, Ask, Slippage, l_price_8, l_price_16, Comm, g_magic_132, 16711680);
   }
   if (li_36) {
      if (MaxLoss == 0) l_price_8 = 0;
      else l_price_8 = Bid + (MaxLoss + g_stoplevel_140) * Point;
      if (MinPrfofit == 0) l_price_16 = 0;
      else l_price_16 = Bid - (MinPrfofit + g_stoplevel_140 + g_spread_148) * Point;
      OrderSend(Symbol(), OP_SELL, g_lots_180, Bid, Slippage, l_price_8, l_price_16, Comm, g_magic_132, 255);
   }
   return (0);
}

Отредактировано Andy_Kon (2008-12-30 17:19:29)

0

2

Compiling ScalperPilotAdvisor.mq4'...
'Comm' - variable not defined C:\Program Files\FX Trading Platform\experts\ScalperPilotAdvisor.mq4 (80, 85)
'Comm' - variable not defined C:\Program Files\FX Trading Platform\experts\ScalperPilotAdvisor.mq4 (87, 86)
2 error(s), 0 warning(s)

0

3

1. Подправил.
2. В коде могут быть ошибки (наверное).
3. Сообщите результаты (тесты или ...)

0