Questions from Beginners MQL5 MT5 MetaTrader 5 - page 399

 

Hello! I am redesigning my Expert Advisor from the article https://www.mql5.com/ru/articles/648 and trying to insert my own function. The problem is, I can't change indicator to fractal. If signal_indicator_handles[s]=iMA(Symbols[s],_Period,IndicatorPeriod[s],0,MODE_SMA,PRICE_CLOSE) I replace it with iFractals(Symbols[s], PERIOD_M15); I get wrong price. Can you help and tweak the code?

//+------------------------------------------------------------------+
//| Получает хэндлы индикаторов                                      |
//+------------------------------------------------------------------+
void GetIndicatorHandles()
  {
//--- Пройдемся по всем символам
   for(int s=0; s<NUMBER_OF_SYMBOLS; s++)
     {
      //--- Если торговля по этому символу разрешена
      if(Symbols[s]!="")
        {
         //--- Если хэндл еще не получен
         if(signal_indicator_handles[s]==INVALID_HANDLE)
           {
            //--- Получим хэндл индикатора
            signal_indicator_handles[s]=iMA(Symbols[s],_Period,IndicatorPeriod[s],0,MODE_SMA,PRICE_CLOSE);
            //--- Если не удалось получить хендл индикатора
            if(signal_indicator_handles[s]==INVALID_HANDLE)
               Print("Не удалось получить хэндл индикатора для символа "+Symbols[s]+"!");
           }
        }
     }
  }

//+------------------------------------------------------------------+
//| Получает значения индикаторов                                    |
//+------------------------------------------------------------------+
bool GetIndicatorsData(int symbol_number)
  {
//--- Количество значений индикаторного буфера для определения торгового сигнала   
   int NumberOfValues=3;
//--- Если хэндл индикатора был получен
   if(signal_indicator_handles[symbol_number]!=INVALID_HANDLE)
     {
      //--- Установим обратный порядок индексации (... 3 2 1 0)
      ArraySetAsSeries(indicator[symbol_number].value,true);
      //--- Получим значения индикатора
      if(CopyBuffer(signal_indicator_handles[symbol_number],0,0,NumberOfValues,indicator[symbol_number].value)<NumberOfValues)
        {
         Print("Не удалось скопировать значения ("+
               Symbols[symbol_number]+"; "+TimeframeToString(_Period)+") в массив indicator! Ошибка ("+
               IntegerToString(GetLastError())+"): "+ErrorDescription(GetLastError())+"");
         return(false);
        }
      return(true);
     }
//--- Если хэндл индикатора не получен, то...
   else
     {
      // ...попробуем получить его еще раз
      GetIndicatorHandles();
     }
   return(false);
  }
  

Проверка
Print("++++++++indicator[symbol_number][0]",Symbols[symbol_number],"= ",indicator[symbol_number].value[0]);
Рецепты MQL5 - Мультивалютный эксперт: пример простой, точной и быстрой схемы
Рецепты MQL5 - Мультивалютный эксперт: пример простой, точной и быстрой схемы
  • 2013.06.11
  • Anatoli Kazharski
  • www.mql5.com
В этой статье мы рассмотрим реализацию простой схемы для мультивалютного эксперта. В данном случае имеется в виду, что эксперт можно будет настроить на тестирование/торговлю по одинаковым условиям, но с разными параметрами для каждого символа. В качестве примера создадим схему для двух символов, но сделаем это так, чтобы при необходимости можно было добавлять дополнительные символы, внося небольшие изменения в код.
 
Hi all, can you please tell me if it's possible to turn off the news of the category I'm not interested in and simply cluttering up the news window in MT5? How can I do it?
 
Can you tell me how to find out the chart_id of a newly created chart?
 
Do you create by hand?
 
Karputov Vladimir:
Do you create by hand?

No.

void OnStart() { ChartOpen("GBPUSD", PERIOD_H1); }
 

Hi all!

Help with this question.

How can I make the standard indicator used not be displayed in the MT4 chart window when testing of the Expert Advisor is completed?

 
Sergei Konoplev:

Hi all!

Help with this question.

How can I make the standard indicator used not be displayed in the MT4 chart window when testing of the Expert Advisor is completed?

See help for HideTestIndicators() function
 
-Aleks-:

No.

void OnStart() { ChartOpen("GBPUSD", PERIOD_H1); }

You can get the identifier of the created graph as follows:

void OnStart()
  {
   ResetLastError();
   long Chart_ID=ChartOpen("GBPUSD",PERIOD_H1);
   if(Chart_ID!=0)
      Print("Идентификатор созданного графика: ",Chart_ID);
   else
      Print("Ошибка открытия нового графика: ",GetLastError());
  }
 
Vitalii Ananev:
See help for HideTestIndicators()
Everything is brilliantly simple! Thanks, the tip helped.)
 
Karputov Vladimir:

Get the identifier of the created graph as follows:

Thank you. Is it possible to get the ID of the last graph created by a user or other script that has stopped working?
Reason: