Questions from Beginners MQL5 MT5 MetaTrader 5 - page 241

 
makskov1987:


when will metatrader come out on windows phone 8

If Microsoft has completed the takeover of Nokia's mobile division for a large-scale assault on the mobile market, it won't be long. MetaQuotes has (hopefully :-) ) a hand on the pulse.
 
Hello, what is the difference between the two expressions, and which one is better to use to limit the running time of the EA
(Hour() >= StartHour && Hour() <= EndHour) 
(TimeHour(TimeCurrent()) >= StartHour && TimeHour(TimeCurrent()) <= EndHour)
 
Hello, could you please tell me where I can get an mql5 script that places orders simultaneously on multiple terminals? Thank you.
 

Continuing to write my trading signal generator.

There are errors in the last part of the initialization code (in bold)

'InitMyCustomIndicator' - the function must have a body

'InitClose' - function must have a body

//| включаемые файлы                                                 |
//+------------------------------------------------------------------+
#property tester_indicator "Blau_Ergodic.ex5"
#include <Expert\ExpertSignal.mqh>
//+------------------------------------------------------------------+
//| Класс CSampleSignal.                                             |
//| Назначение: Класс генератора торговых сигналов.                  |
//|             Является производным от класса CExpertSignal.        |
//+------------------------------------------------------------------+
class CSampleSignal : public CExpertSignal
  {
protected:
   CiCustom           m_TSI;              // объект для доступа к значениям TSI
   CiClose            m_close;           // объект для доступа к ценам закрытия баров
  //--- настраиваемые параметры
   int      q;  // q - период, по которому вычисляется моментум
   int      r; // r - период 1-й EMA, применительно к моментуму
   int      s;  // s - период 2-й EMA, применительно к результату первого сглаживания
   int      u;  // u - период 3-й EMA, применительно к результату второго сглаживания
   int      ul; // ul - (сигнальная линия) период EMA, применительно к эргодике
   double             m_stop_loss;       // уровень установки ордера "stop loss" относительно цены открытия
   double             m_take_profit;     // уровень установки ордера "take profit" относительно цены открытия
public:
              CSampleSignal();
   //--- методы установки параметров настройки
   virtual int       ShortCondition(); // проверка условия открытия селла
   virtual int       LongCondition();  // проверка условия открытия бая
   void               Q(int value)                 { q=value;   }
   void               R(int value)                 { r=value;   }
   void               S(int value)                 { s=value;   }
   void               U(int value)                 { u=value;   }
   void               UL(int value)                { ul=value;  }
   void               StopLoss(double value)       { m_stop_loss=value;   }
   void               TakeProfit(double value)     { m_take_profit=value; }
   //--- метод проверки параметров настройки
   virtual bool       ValidationSettings();
   
   virtual bool       InitIndicators(CIndicators* indicators);

protected:
   //--- метод инициализации объектов
   bool               InitMyCustomIndicator(CIndicators* indicators);
   bool               InitClose(CIndicators* indicators);
   //--- методы доступа к данным объектов
   double             Main(int index)                     { return(m_TSI.GetData(0,index)); }
   double             Signal(int index)                   { return(m_TSI.GetData(1,index)); }
   double             Close(int index)                    { return(m_close.GetData(index)); }
  };
//+------------------------------------------------------------------+
//| Конструктор CSampleSignal.                                       |
//| INPUT:  нет.                                                     |
//| OUTPUT: нет.                                                     |
//| REMARK: нет.                                                     |
//+------------------------------------------------------------------+
void CSampleSignal::CSampleSignal()
  {
   q=2; 
   r=7;
   s=5;
   u=3;
   ul=5;   
  }
//+------------------------------------------------------------------+
//| Проверка параметров настройки.                                   |
//| INPUT:  нет.                                                     |
//| OUTPUT: true-если настройки правильные, иначе false.             |
//| REMARK: нет.                                                     |
//+------------------------------------------------------------------+
bool CSampleSignal::ValidationSettings()
  {
  //--- проверка параметров
   if(q<=0||r<=0||s<=0||u<=0||ul<=0)
     {
      printf(__FUNCTION__+": период должен быть больше нуля");
      return(false);
     }
//--- успешное завершение
   return(true);
  }
//+------------------------------------------------------------------+
//| Инициализация индикаторов и таймсерий.                           |
//| INPUT:  indicators - указатель на объект-коллекцию               |
//|                      индикаторов и таймсерий.                    |
//| OUTPUT: true-в случае успешного завершения, иначе false.         |
//| REMARK: нет.                                                     |
//+------------------------------------------------------------------+
bool CSampleSignal::InitIndicators(CIndicators* indicators)
  {
//--- проверка указателя
   if(indicators==NULL)       return(false);
//--- инициализация скользящей средней
   if(!InitMyCustomIndicator(indicators))    return(false);
//--- инициализация таймсерии цен закрытия
   if(!InitClose(indicators)) return(false);
//--- успешное завершение
   return(true);
  }
 
forexman77:

Continuing to write my trading signal generator.

There are errors in the last part of the initialization code (in bold)

'InitMyCustomIndicator' - the function must have a body

'InitClose' - function must have a body


You are trying to use methods which are declared but not defined.
 
Fleder:
You are trying to use methods that are declared but not defined.

Classes are new to me and not really understood. Can you show me how to make a definition with an example.

 
forexman77:
Classes are new to me and not really understood. Can I use an example to show how to make a definition.
protected:
   //--- метод инициализации объектов
   bool               InitMyCustomIndicator(CIndicators* indicators);
   bool               InitClose(CIndicators* indicators);
.
.
.

bool CSampleSignal::InitMyCustomIndicator(CIndicators* indicators)
{
  //здесь надо вписать тело метода
  return(true);
}

bool CSampleSignal::InitClose(CIndicators* indicators)
{
  //и здесь тоже
  return(true);
}
 
Fleder:

So I only change the last part of the code that I put in bold?

And I do this:

bool CSampleSignal::InitMyCustomIndicator(CIndicators* indicators)
  {
//--- проверка указателя
   if(indicators==NULL)       return(false);
//--- инициализация скользящей средней
   if(!InitMyCustomIndicator(indicators))    return(false);
   return(true);
  }
bool CSampleSignal::InitClose(CIndicators* indicators)
{
   if(!InitClose(indicators)) return(false);
//--- успешное завершение
  return(true);
}
 
forexman77:

So, I only change the last part of the code that I highlighted in bold?

And I do the following:

If your class code has methods such as:

   bool               InitMyCustomIndicator(CIndicators* indicators);
   bool               InitClose(CIndicators* indicators);

Then they must check something. Otherwise there is no point in their existence.

 

Hello!

How do I set up a for loop on bar close prices if I don't know in advance how many bars to check

int i=1;i<ArraySize(select);i++
CopyRates(_Symbol,_Period,0,i,mrate)

I need to check a condition, e.g. that the closing prices of i bars backwards, are lower than each other.

Reason: