Questions from Beginners MQL5 MT5 MetaTrader 5 - page 922

 
Artyom Trishkin:

Simply add another CArrayObj array to the CArrayObj: Add() array

Doesn't work that way. parameter conversion not allowed

By the way, if it matters. My object to be added to the array is a class inherited from CArrayObj.

class CCustomClass : public CArrayObj
{
}




CCustomClass obj1;
CCustomClass obj2;
...

CArrayObj objects_array;
objects_array.Add(obj1); 
Well, it swears at the last line - parameter conversion not allowed.
 
objects_array.Add(GetPointer(obj1)); 
It's working, didn't see that I didn't have a pointer.
 
TaywinLannister:

Dear forum members help please!!!

I want to assign a price step to a variable:

int V=SymbolInfoInteger(Symb,SYMBOL_POINT);

error: 'SymbolInfoInteger' - no one of the overloads can be applied to the function call

What is my error again?


int V=(int)SymbolInfoInteger(Symb,SYMBOL_POINT);

So try it.

 
foreXteller:

Dear Members of the Forum!

Please advise!!!

The MetaTrader 5 window shows the Bid& Ask values, which (as far as I understand) determine the win/loss.

However, when I try to use minute quotes of the history to test my strategy, these quotes do not contain the Bid and Ask values, but give the values " OPEN", "HIGH" "LOW", "CLOSE", "TICKVOL","VOL", "SPREAD". It is not quite clear how to take Bid and Ask from these values, as well as how to calculate the spread.

Everything is absolutely clear. Describe in more detail what exactly is meant by "when I try to use minute history quotes"? What exactly are you doing or want to do?

 
TaywinLannister:

Dear forum members help please!!!

I want to assign a variable to the price step:

int V=SymbolInfoInteger(Symb,SYMBOL_POINT);

error: 'SymbolInfoInteger' - no one of the overloads can be applied to the function call

What's my mistake again?


SymbolInfoInteger help:

1. Directly returns the value of the property.

long  SymbolInfoInteger( 
   string                    name,      // символ 
   ENUM_SYMBOL_INFO_INTEGER  prop_id    // идентификатор свойства 
   );

2. Returns true or false depending on success of the function. If successful, the value of the property is placed in the destination variable passed by reference by the last parameter.

bool  SymbolInfoInteger( 
   string                    name,      // символ 
   ENUM_SYMBOL_INFO_INTEGER  prop_id,   // идентификатор свойства 
   long&                     long_var   // сюда примем значение свойства 
   );


That is OR long OR bool.

 
TaywinLannister:

Dear forum members help please!!!

I want to assign a price step to a variable:

int V=SymbolInfoInteger(Symb,SYMBOL_POINT);

error: 'SymbolInfoInteger' - no one of the overloads can be applied to the function call

What's my error again?


double V=SymbolInfoDouble(Symb,SYMBOL_POINT);

Point is a value of type double. When received as int it will have a zero value.

 
Vladimir Karputov:

SymbolInfoInteger Help:

1. Directly returns the value of the property.

2. Returns true or false depending on success of the function. If successful, the value of the property is placed in the destination variable passed by reference by the last parameter.


That is OR long OR bool.

Got it, thanks)

 
#property copyright "Copyright 2018, Sergey S Morozov"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

//#property indicator_separate_window    // Индик. рисуется в новом окне
#property indicator_chart_window    // Индик. рисуется в основном окне

#property indicator_buffers 1       // Количество буферов
#property indicator_color1 Red     // Цвет первой линии

extern int History  =50;            // Колич.баров в расчётной истории
extern int Aver_Bars=5;             // Количество баров для расчёта

double ArrayBuff[];

//----------------------------------------------------------------------------------------------------

int OnInit()
{
   SetIndexBuffer(0,ArrayBuff);
   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);
   return(INIT_SUCCEEDED);
}

int OnCalculate(

                const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])

  {

      int i,                           // Индекс бара
      n,                               // Формальный параметр
      Counted_bars;                    // Количество просчитанных баров 
      double
      Sum_H,                           // Сумма значений High за переиод
      Sum_L;                           // Сумма значений Low  за переиод
   //--------------------------------------------------------------------
      Counted_bars=IndicatorCounted(); // Количество просчитанных баров
      i=Bars-Counted_bars-1;           // Индекс первого непосчитанного
      if (i>History-1)                 // Если много баров то ..
         i=History-1;                  // ..рассчитывать заданное колич.
      while(i>=0)                      // Цикл по непосчитанным барам
        {
         Sum_H=0;                      // Обнуление в начале цикла
         Sum_L=0;                      // Обнуление в начале цикла
         for(n=i;n<=i+Aver_Bars-1;n++) // Цикл суммирования значений
           {
            Sum_H=Sum_H + High[n];     // Накопление суммы макс.значений
            Sum_L=Sum_L + Low[n];      // Накопление суммы мин. значений
           }
         ArrayBuff[i]=(Sum_H-Sum_L)/Aver_Bars;  // Знач. 0 буфера на i-ом баре
         i--;                                   // Расчёт индекса следующего бара
        }

   return(rates_total);

  }
//+------------------------------------------------------------------+

I just started, I don't know how to write in this language yet. But the problem is - if in a new window, the graph appears. But I can't display it in the current one... What is my error? Considering that I myself could not write it and I can't find examples here. All the more, it's clearly not through a function like SetChartData(point1,point2); it just happens by itself...

And the variable seems to be set(indicator_chart_window), but still it doesn't work....

Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
  • www.mql5.com
Задавайте вопросы по техническому анализу, обсуждайте торговые системы и улучшайте свои навыки программирования торговых стратегий на языке MQL5. Общайтесь и обменивайтесь опытом на форуме с трейдерами всего мира и помогайте ответами новичкам — наше сообщество развивается вместе с вами. Как прописать расписание торговли робота? Здравствуйте...
 
Vladimir Karputov:

Absolutely everything is available. Describe in more detail what exactly is meant by "when I try to use minute history quotes"? What exactly are you doing or want to do?

In order to download history quotes load MetaTrader 5, click on the icon with dollar symbol: "Symbol List Display" (or you can press Ctrl U). The "Symbols" window will appear. On the "SPECIFICATION" tab find the desired currency pair, e.g. GBPCHF. In the tab "BARs" set minute quotations (M1) and dates of the beginning and the end of the required period. After clicking on the "REQUEST" button, a csv file will be downloaded, which can be used to test strategies with the Metatrader or with your own programs.

Using EXCEL you can view the content of this file, where the first line reveals the information in the file, i.e. "date, time" and then" OPEN", "HIGH" "LOW", "CLOSE", "TICKVOL", "VOL", "SPREAD"

I know exactly what this data means, but how to make BIT and ASK from this data, which MetaTrader 5 uses?

 
Please advise me where in mt5 you can check information about a symbol? I remember in mt 4 you could check in the strategy tester, but in the mt5 tester I haven't found this function.
Reason: