Группа "Стол заказов MQL"

Рейтинг 2089



РЕКОМЕНДУЮ



Стрелка+алерт+всплывающее окно с 4-ёх таймов для индикатора TDI (mql4)

Здравствуйте! Можно вас попросить «исполнить» стрелочку-алет-окошко?
На скрине пример
если есть совпадение на всех графиках (Н1-М30-М15-М5)
то тогда сигнал бай или селл.
может глупо но я наблюдал за стратегией
и много раз замечал что при совпадении
идет хороший профит и это случается.
хотел на сервер поставить в сову и проверить.
как тз написать не знаю
зеленая пересекает красную двигаясь от синей
и когда пересекают желтую.
индикатор один параметры одинаковы
но условия на всех должно совпасть
тогда сигнал .Screenshot_1.png (7 Kb)TDI-With_Alerts.mq4 (24 Kb)
  • 0
  • Просмотров: 3024
  • 11 августа 2018, 18:30
  • Shiva
Понравилcя материал? Не забудьте поставить плюс и поделиться в социальной сети!

Вступите в группу "Стол заказов MQL", чтобы следить за обновлениями
ПРИСОЕДИНИТЬСЯ К ГРУППЕ
присоединиться
  Предыдущая запись в группе
RSImtf + AOmtf
Следующая запись в группе  
Как сократить код
11 августа 2018
12 августа 2018

Комментарии (8)

+
0
если брать именно момент пересечения на всех тф, то очень редкий сигнал будет.
avatar

  34  AM2 Сообщений: 15891 - Андрей

  • 12 августа 2018, 00:25
+
0
Да на Н1-М30-М15-М5.
avatar

  10  Shiva Автор Сообщений: 148

  • 12 августа 2018, 09:04
+
0
на 15-е
avatar

  34  AM2 Сообщений: 15891 - Андрей

  • 12 августа 2018, 11:25
+
0
Да, хорошо!*relax* 
avatar

  10  Shiva Автор Сообщений: 148

  • 12 августа 2018, 15:09
+
0
avatar

  34  AM2 Сообщений: 15891 - Андрей

  • 15 августа 2018, 21:09
+
0
по одновременному пересечению нет вообще сигналов:


//+------------------------------------------------------------------+
//|                                                          TDI.mq4 |
//|                                              Copyright 2018, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, 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      = 2000;     // лось
extern int TakeProfit    = 3000;     // язь
extern int BULevel       = 0;        // уровень БУ
extern int BUPoint       = 30;       // пункты БУ
extern int TrailingStop  = 0;        // трал
extern int Slip          = 30;       // реквот
extern int Shift         = 1;        // на каком баре сигнал индикатора
extern int Magic         = 123;      // магик

extern string IndName="TDI-With_Alerts";
//+------------------------------------------------------------------+
//| 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),Slip,sl,tp,"",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 yel5 = iCustom(NULL,PERIOD_M5,IndName,2,Shift);
   double gre5 = iCustom(NULL,PERIOD_M5,IndName,4,Shift);
   double yel15 = iCustom(NULL,PERIOD_M15,IndName,2,Shift);
   double gre15 = iCustom(NULL,PERIOD_M15,IndName,4,Shift);
   double yel30=iCustom(NULL,PERIOD_M30,IndName,2,Shift);
   double gre30=iCustom(NULL,PERIOD_M30,IndName,4,Shift);
   double yel60=iCustom(NULL,PERIOD_H1,IndName,2,Shift);
   double gre60=iCustom(NULL,PERIOD_H1,IndName,4,Shift);

   double yel52=iCustom(NULL,PERIOD_M5,IndName,2,Shift+1);
   double gre52=iCustom(NULL,PERIOD_M5,IndName,4,Shift+1);
   double yel152 = iCustom(NULL,PERIOD_M15,IndName,2,Shift+1);
   double gre152 = iCustom(NULL,PERIOD_M15,IndName,4,Shift+1);
   double yel302=iCustom(NULL,PERIOD_M30,IndName,2,Shift+1);
   double gre302=iCustom(NULL,PERIOD_M30,IndName,4,Shift+1);
   double yel602=iCustom(NULL,PERIOD_H1,IndName,2,Shift+1);
   double gre602=iCustom(NULL,PERIOD_H1,IndName,4,Shift+1);

   if(gre5>yel5 && gre52<yel52  && gre15>yel15 && gre152<yel152 && gre30>yel30  && gre302<yel302 && gre60>yel60 && gre602<yel602)
     {
      PutOrder(0,Ask);
     }

   if(gre5<yel5 && gre52>yel52  && gre15<yel15 && gre152>yel152 && gre30<yel30  && gre302>yel302 && gre60<yel60 && gre602>yel602)
     {
      PutOrder(1,Bid);
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Lot()
  {
   double lot=Lots;
   for(int i=OrdersHistoryTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderProfit()>0) break;
            if(OrderProfit()<0)
              {
               lot=OrderLots()*KLot;
               break;
              }
           }
        }
     }
   if(lot>MaxLot)lot=Lots;
   return(lot);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Trailing()
  {
   bool mod;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
              {
               if(Bid-OrderOpenPrice()>TrailingStop*Point)
                 {
                  if(OrderStopLoss()<Bid-TrailingStop*Point)
                    {
                     mod=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*Point,OrderTakeProfit(),0,Yellow);
                     return;
                    }
                 }
              }

            if(OrderType()==OP_SELL)
              {
               if((OrderOpenPrice()-Ask)>TrailingStop*Point)
                 {
                  if((OrderStopLoss()>(Ask+TrailingStop*Point)) || (OrderStopLoss()==0))
                    {
                     mod=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+TrailingStop*Point,OrderTakeProfit(),0,Yellow);
                     return;
                    }
                 }
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void BU()
  {
   bool m;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
              {
               if(OrderOpenPrice()<=(Bid-(BULevel+BUPoint)*Point) && OrderOpenPrice()>OrderStopLoss())
                 {
                  m=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+BUPoint*Point,OrderTakeProfit(),0,Yellow);
                  return;
                 }
              }

            if(OrderType()==OP_SELL)
              {
               if(OrderOpenPrice()>=(Ask+(BULevel+BUPoint)*Point) && (OrderOpenPrice()<OrderStopLoss() || OrderStopLoss()==0))
                 {
                  m=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-BUPoint*Point,OrderTakeProfit(),0,Yellow);
                  return;
                 }
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(BULevel>0) BU();
   if(TrailingStop>0) Trailing();
   if(CountTrades()<1) OpenPos();
  }
//+------------------------------------------------------------------+

avatar

  34  AM2 Сообщений: 15891 - Андрей

  • 15 августа 2018, 21:40
+
0
по превышении сколько хочешь:




//+------------------------------------------------------------------+
//|                                                          TDI.mq4 |
//|                                              Copyright 2018, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, 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      = 2000;     // лось
extern int TakeProfit    = 3000;     // язь
extern int BULevel       = 0;        // уровень БУ
extern int BUPoint       = 30;       // пункты БУ
extern int TrailingStop  = 0;        // трал
extern int Slip          = 30;       // реквот
extern int Shift         = 1;        // на каком баре сигнал индикатора
extern int Magic         = 123;      // магик

extern string IndName="TDI-With_Alerts";
//+------------------------------------------------------------------+
//| 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),Slip,sl,tp,"",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 yel5 = iCustom(NULL,PERIOD_M5,IndName,2,Shift);
   double gre5 = iCustom(NULL,PERIOD_M5,IndName,4,Shift);
   double yel15 = iCustom(NULL,PERIOD_M15,IndName,2,Shift);
   double gre15 = iCustom(NULL,PERIOD_M15,IndName,4,Shift);
   double yel30=iCustom(NULL,PERIOD_M30,IndName,2,Shift);
   double gre30=iCustom(NULL,PERIOD_M30,IndName,4,Shift);
   double yel60=iCustom(NULL,PERIOD_H1,IndName,2,Shift);
   double gre60=iCustom(NULL,PERIOD_H1,IndName,4,Shift);

   if(gre5>yel5 && gre15>yel15 && gre30>yel30 && gre60>yel60)
     {
      PutOrder(0,Ask);
     }

   if(gre5<yel5 && gre15<yel15 && gre30<yel30 && gre60<yel60)
     {
      PutOrder(1,Bid);
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Lot()
  {
   double lot=Lots;
   for(int i=OrdersHistoryTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderProfit()>0) break;
            if(OrderProfit()<0)
              {
               lot=OrderLots()*KLot;
               break;
              }
           }
        }
     }
   if(lot>MaxLot)lot=Lots;
   return(lot);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Trailing()
  {
   bool mod;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
              {
               if(Bid-OrderOpenPrice()>TrailingStop*Point)
                 {
                  if(OrderStopLoss()<Bid-TrailingStop*Point)
                    {
                     mod=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*Point,OrderTakeProfit(),0,Yellow);
                     return;
                    }
                 }
              }

            if(OrderType()==OP_SELL)
              {
               if((OrderOpenPrice()-Ask)>TrailingStop*Point)
                 {
                  if((OrderStopLoss()>(Ask+TrailingStop*Point)) || (OrderStopLoss()==0))
                    {
                     mod=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+TrailingStop*Point,OrderTakeProfit(),0,Yellow);
                     return;
                    }
                 }
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void BU()
  {
   bool m;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
              {
               if(OrderOpenPrice()<=(Bid-(BULevel+BUPoint)*Point) && OrderOpenPrice()>OrderStopLoss())
                 {
                  m=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+BUPoint*Point,OrderTakeProfit(),0,Yellow);
                  return;
                 }
              }

            if(OrderType()==OP_SELL)
              {
               if(OrderOpenPrice()>=(Ask+(BULevel+BUPoint)*Point) && (OrderOpenPrice()<OrderStopLoss() || OrderStopLoss()==0))
                 {
                  m=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-BUPoint*Point,OrderTakeProfit(),0,Yellow);
                  return;
                 }
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(BULevel>0) BU();
   if(TrailingStop>0) Trailing();
   if(CountTrades()<1) OpenPos();
  }
//+------------------------------------------------------------------+

avatar

  34  AM2 Сообщений: 15891 - Андрей

  • 15 августа 2018, 21:45
+
0
Спасибо. Буду смотреть
avatar

  10  Shiva Автор Сообщений: 148

  • 16 августа 2018, 16:58

Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий
Начать торговлю с Альпари