0
Ничего себе объем работы! *shock* 
Могу сделать только небольшую часть.
avatar

AM2

  • 27 ноября 2016, 21:17
0
Нормально я получил *shock* 

avatar

AM2

  • 27 ноября 2016, 18:34
0
Данный вариант открывает по 2 сделки за период по паттерну: www.opentraders.ru/downloads/1402/




//+------------------------------------------------------------------+
//|                                                          PTC.mq4 |
//|                                              Copyright 2016, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict

//--- Inputs
extern string Start1     = "10:50";  // 
extern string End1       = "13:00";  // 
extern string Start2     = "16:30";  // 
extern string End2       = "18:40";  // 
extern double Lots       = 0.1;      // лот
extern int StopLoss      = 150;      // лось
extern int TakeProfit    = 150;      // язь
extern int MAPeriod      = 163;      // MA период
extern int Slip          = 30;       // реквот
extern int Magic1        = 111;      // магик 
extern int Magic2        = 222;      // магик 

datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Comment("");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price,int magic)
  {
   int r=0;
   color clr=Green;
   double sl=0,tp=0;

   if(type==1 || type==3 || type==5)
     {
      clr=Red;
      if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits);
      if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point,Digits);
     }

   if(type==0 || type==2 || type==4)
     {
      clr=Blue;
      if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point,Digits);
      if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point,Digits);
     }

   r=OrderSend(NULL,type,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,"",magic,0,clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountTrades(int magic)
  {
   int count=0;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
           {
            if(OrderType()<2) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   double ma=iMA(NULL,0,MAPeriod,0,0,0,1);
   
   if(t!=Time[0])
     {
      if(CountTrades(Magic1)<2 && TimeCurrent()>StringToTime(Start1) && TimeCurrent()<StringToTime(End1))
        {
         if(Open[3]>Close[3] && Open[2]<Close[2] && Open[1]<Close[1] && Ask>ma && Open[3]>ma)
           {
            PutOrder(0,Ask,Magic1);
           }

         if(Open[3]<Close[3] && Open[2]>Close[2] && Open[1]>Close[1] && Bid<ma && Open[3]<ma)
           {
            PutOrder(1,Bid,Magic1);
           }
        }

      if(CountTrades(Magic2)<2 && TimeCurrent()>StringToTime(Start2) && TimeCurrent()<StringToTime(End2))
        {
         if(Open[3]>Close[3] && Open[2]<Close[2] && Open[1]<Close[1] && Ask>ma && Open[3]>ma)
           {
            PutOrder(0,Ask,Magic2);
           }

         if(Open[3]<Close[3] && Open[2]>Close[2] && Open[1]>Close[1] && Bid<ma && Open[3]<ma)
           {
            PutOrder(1,Bid,Magic2);
           }
        }
     }
  }
//+-----------------------------------------------------

avatar

AM2

  • 27 ноября 2016, 18:24
0
почему то не хочет)))

это не ответ, скрины логи вот это ответ.
avatar

AM2

  • 27 ноября 2016, 18:19
0
Значит делаю первый вход по паттерну, затем если через час профит, то открывается вторая сделка и первая в бу и по 2 сделки за временной отрезок?
avatar

AM2

  • 27 ноября 2016, 17:39
0
Мне будет интересно, расставить сделки, что то закодить, потом вместе посмотрим результат.
avatar

AM2

  • 27 ноября 2016, 16:36
+1
Я как то один раз делал для брокера Открытие под РТС и там тоже МТ5 была платформа.
avatar

AM2

  • 27 ноября 2016, 15:22
+1
Готово. Можете примерно оценить ТС в тестере, если установите стопы:




//+------------------------------------------------------------------+
//|                                                     Contrast.mq4 |
//|                                              Copyright 2016, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict

//--- Inputs
extern double Lots       = 0.1;      // лот
extern double KLot       = 1;        // умножение лота
extern double MaxLot     = 5;        // максимальный лот
extern int StopLoss      = 111;      // лось
extern int TakeProfit    = 111;      // язь
extern int Shift         = 1;        // на каком баре сигнал индикатора
extern int Magic         = 123;      // магик
extern string Expiration = "5";      // истечение ордера
extern string IndName    = "##Contrast";

datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   Comment("");
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
  {
   int r=0;
   color clr=Green;
   double sl=0,tp=0;

   if(type==1 || type==3 || type==5)
     {
      clr=Red;
      if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits);
      if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point,Digits);
     }

   if(type==0 || type==2 || type==4)
     {
      clr=Blue;
      if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point,Digits);
      if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point,Digits);
     }

   r=OrderSend(NULL,type,Lot(),NormalizeDouble(price,Digits),0,sl,tp,Expiration,Magic,0,clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountTrades()
  {
   int count=0;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()<2) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OpenPos()
  {
   double red1  = iCustom(NULL,0,IndName,0,Shift);
   double gold1 = iCustom(NULL,0,IndName,1,Shift);
   double red2  = iCustom(NULL,0,IndName,0,Shift+1);
   double gold2 = iCustom(NULL,0,IndName,1,Shift+1);

   if((gold1<red1 && gold2>red2 && (LastDealResult()==1 || LastDealResult()==0)) || (LastDealResult()==2 && LastDealType()==1))
     {
      PutOrder(0,Ask);
     }

   if((gold1>red1 && gold2<red2 && (LastDealResult()==1 || LastDealResult()==0)) || (LastDealResult()==2 && LastDealType()==2))
     {
      PutOrder(1,Bid);
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int LastDealResult()
  {
   int result=0;

   if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY))
     {
      if(OrderProfit()>0)
        {
         result=1;//tp  
        }
      if(OrderProfit()<0)
        {
         result=2;//sl  
        }
     }
   return(result);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int LastDealType()
  {
   int type=0;

   if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY))
     {
      if(OrderType()==OP_BUY)
        {
         type=1;//buy  
        }
      if(OrderType()==OP_SELL)
        {
         type=2;//sell  
        }
     }
   return(type);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Lot()
  {
   double lot=Lots;

   if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY))
     {
      if(OrderProfit()<0)
        {
         lot=OrderLots()*KLot;
        }
     }
   if(lot>MaxLot)lot=Lots;
   return(lot);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   double red  = iCustom(NULL,0,IndName,0,Shift);
   double gold = iCustom(NULL,0,IndName,1,Shift);

   if(CountTrades()<1 && t!=Time[0])
     {
      OpenPos();
      t=Time[0];
     }

   Comment("\n red: ",red,
           "\n gold: ",gold);
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 27 ноября 2016, 15:17
0
Еще вопрос: за временной промежуток может быть несколько таких паттернов, на всех сделки?
avatar

AM2

  • 27 ноября 2016, 10:33
0
Странно, что тут не ограничения кол-ва ордеров. Н ареле такое кол-во не прокатит, средств не хватит для поддержания просадки элементарно.

Советник только что из печки :) 
avatar

AM2

  • 27 ноября 2016, 10:17
0
У вас очень расплывчатое ТЗ, сначала нужно согласовывать иначе мне придется переделывать много раз.

Торговля по времени уже есть теперь входы.
1. Покупка: цены на 4-х предыдущих барах выше МА.
Здесь нужно определиться со свечным паттерном для покупки?
Одна черная и потом 2 белых или 2 черных и потом 2 белых или еще как?
avatar

AM2

  • 27 ноября 2016, 10:16
0
А сделки по инвестпаролю можно глянуть? :)  *stesnitelno* 
avatar

AM2

  • 26 ноября 2016, 22:08
0
Пока такой набросок. смотрите что убавить что прибавить:



//+------------------------------------------------------------------+
//|                                                          PTC.mq4 |
//|                                              Copyright 2016, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict

//--- Inputs
extern string Start1     = "10:50";  // 
extern string End1       = "13:00";  // 
extern string Start2     = "16:30";  // 
extern string End2       = "18:40";  // 
extern double Lots       = 0.1;      // лот
extern int StopLoss      = 150;      // лось
extern int TakeProfit    = 150;      // язь
extern int MAPeriod      = 163;      // MA период
extern int Slip          = 30;       // реквот
extern int Magic1        = 111;      // магик 
extern int Magic2        = 222;      // магик 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Comment("");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price,int magic)
  {
   int r=0;
   color clr=Green;
   double sl=0,tp=0;

   if(type==1 || type==3 || type==5)
     {
      clr=Red;
      if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits);
      if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point,Digits);
     }

   if(type==0 || type==2 || type==4)
     {
      clr=Blue;
      if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point,Digits);
      if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point,Digits);
     }

   r=OrderSend(NULL,type,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,"",magic,0,clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountTrades(int magic)
  {
   int count=0;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
           {
            if(OrderType()<2) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   double ma=iMA(NULL,0,MAPeriod,0,0,0,1);

   if(CountTrades(Magic1)<1 && TimeCurrent()>StringToTime(Start1) && TimeCurrent()<StringToTime(End1))
     {
      if(Open[3]>Close[3] && Open[2]<Close[2] && Open[1]<Close[1] && Ask>ma)
        {
         PutOrder(0,Ask,Magic1);
        }

      if(Open[3]<Close[3] && Open[2]>Close[2] && Open[1]>Close[1] && Bid<ma)
        {
         PutOrder(1,Bid,Magic1);
        }
     }

   if(CountTrades(Magic2)<1 && TimeCurrent()>StringToTime(Start2) && TimeCurrent()<StringToTime(End2))
     {
      if(Open[3]>Close[3] && Open[2]<Close[2] && Open[1]<Close[1] && Ask>ma)
        {
         PutOrder(0,Ask,Magic2);
        }

      if(Open[3]<Close[3] && Open[2]>Close[2] && Open[1]>Close[1] && Bid<ma)
        {
         PutOrder(1,Bid,Magic2);
        }
     }
  }
//+------------------------------------------------------------------+
avatar

AM2

  • 26 ноября 2016, 21:33
0
Это код Оксаны, за доработками обращайтесь к ней платно. Простое ТЗ рассмотрю.
avatar

AM2

  • 26 ноября 2016, 19:36
0
А можно как то добавить чтоб советник открывал стоповые ордера?

Можно в новом топике.
avatar

AM2

  • 26 ноября 2016, 19:03
0
Пару тройку еще могу посмотреть.
avatar

AM2

  • 26 ноября 2016, 18:02
0
Платно к Оксане в личку или на фриланс.
avatar

AM2

  • 26 ноября 2016, 17:53
0
После выходных буду смотреть.
avatar

AM2

  • 26 ноября 2016, 12:59