Errors, bugs, questions - page 2768

 
Greetings. Does the initialisation event occur when the terminal is switched on?
Совершение сделок - Торговые операции - Справка по MetaTrader 5
Совершение сделок - Торговые операции - Справка по MetaTrader 5
  • www.metatrader5.com
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
 
Dear administration. Who should I write to here about deleting my account (with registration as a seller) from mql5.com?
 

Hello! There is an MT5 indicator "Grid Builder" which draws horizontal lines in price increments. You can select e.g. 100p, 200p etc. And it builds a horizontal grid up and down with a given step. But it has one problem, for example, when I draw horizontal levels on timeframe H4 (I put horizontal lines from drawing tools in the terminal) and switch to any other timeframe, all my lines are removed. Only horizontal indicator levels remain. How can I correct this error in the code? To ensure that my horizontal levels are never deleted. Here is the code of the indicator.

//+------------------------------------------------------------------+
//|                                                  GridBuilder.mq5 |
//|                                              Copyright 2015, AM2 |
//|                                     https://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, AM2"
#property link      "https://www.forexsystems.biz"
#property version   "1.00"
#property indicator_chart_window

//---- для расчёта и отрисовки индикатора использовано ноль буферов
#property indicator_buffers 0
//---- использовано всего ноль графических построений
#property indicator_plots   0
//--- входные параметры 
input int count = 50;      //количество линий вверх вниз от цены
input int step  = 333;     //шаг линий 
input double pr = 1.4622;  //цена от которой пляшем
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   ObjectsDeleteAll(0,0,OBJ_HLINE);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
   ObjectsDeleteAll(0,0,OBJ_HLINE);
  }
//+------------------------------------------------------------------+ 
//| Создает горизонтальную линию                                     | 
//+------------------------------------------------------------------+ 
bool HLine(const string name="HLine",double price=0)
  {
//--- создадим горизонтальную линию 
   if(!ObjectCreate(0,name,OBJ_HLINE,0,0,price))
     {
      Print(__FUNCTION__,
            ": не удалось создать горизонтальную линию! Код ошибки = ",GetLastError());
      return(false);
     }
//--- установим цвет линии 
   ObjectSetInteger(0,name,OBJPROP_COLOR,clrGreen);
   ObjectSetInteger(0,name,OBJPROP_WIDTH,1);
   return(true);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
   double price=pr;
//--- создадим горизонтальную линию 
   for(int i=0;i<=count;i++)
     {
      HLine("HLine"+(string)i,price+step*i*_Point);
      HLine("HLine"+(string)(i+count+1),price-step*i*_Point);
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
  • www.mql5.com
При создании графического объекта функцией ObjectCreate() необходимо указать тип создаваемого объекта, который может принимать одно из значений перечисления ENUM_OBJECT. Дальнейшие уточнения свойств созданного объекта возможно с помощью функций по работе с графическими объектами.
 
Александр:

Hello! There is an MT5 indicator "Grid Builder" which draws horizontal lines in price increments. You can select e.g. 100p, 200p etc. And it builds a horizontal grid up and down with a given step. But it has one problem, for example, when I draw horizontal levels on timeframe H4 (I put horizontal lines from drawing tools in the terminal) and switch to any other timeframe, all my lines are removed. Only horizontal indicator levels remain. How can I correct this error in the code? To ensure that my horizontal levels are never deleted. Here is the code of indicator.

Please try toinsert the code correctly.

MQL5.community - Памятка пользователя
MQL5.community - Памятка пользователя
  • www.mql5.com
Теперь вы можете не только читать статьи и скачивать программы на языке MQL5, но и участвовать в обсуждении интересующих вас тем на Форуме, оставлять комментарии к статьям и опубликованным кодам. Кроме того, вы можете не только выкладывать собственные разработки в Code Base, но и публиковать Статьи, за которые мы предлагаем вознаграждение...
 

Beaubra to all.

When I change timeframe that has been idle for a long time, the indicator freezes. Please guide me where the dog is buried. Thank you!

 
BROXIV:

Beaubra to all.

When I change timeframe, which has not been used for a long time, the indicator freezes. Please guide me where the dog is buried. Thank you!

The dog is loading data.

 
BROXIV:

Beaubra to all.

When I change timeframe, which has not been used for a long time, the indicator freezes. Please guide me where the dog is buried. Thank you!

Same place the wolf bit the fox....

He bit it. What do you think? )))))))

 
How can a function be called first and then declared. Is the programme running out of sequence or what?
 
Ivan_Invanov:
How can a function be called first and then declared? Is the program not running in a row or what?

MQL-compiler, not interpreter, google " linker compiler ".





how much probability to receive from a small text string(10-50 symbols) md5-hash (16 bytes) equal to0xAAAAAAAAAAAAAAAAAAAA + 0xAAAAAAAAAAAAAAAAAAAA

ulong hash[2]
this.hash[0] = this.hash[1] = 0xAAAAAAAAAAAAAAAA; 

in general I need some initializer HASH_NULL (I need some reasonable variants), I find 0 unreliable for some reason


UPD: searched online md5 decryption https://md5.web-max.ca/

on the md5 hash: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa says Error , 0 is also an error

 

Good afternoon! I am writing a class for collecting extrema based on iWPR indicator readings. Here is a piece of code: I start by creating a handle for an indicator and then copying the data into a buffer. I create a loop for getting indicator data based on the array size and write the course of events into the file to understand what is going on. I would like to point out that I copied this code from MQL4 and, of course, adapted it for MQL5. I don't understand something or something is wrong, but data of dwpr variable is written to a file with some kind of mistake. What am I doing wrong? I'm attaching the text file of the so called log!

   hWPR=iWPR(NULL,period,240);
   CopyBuffer(hWPR,0,0,ibars,WPRBuffer);
   CopyLow(NULL,0,0,ibars,Low);
   CopyHigh(NULL,0,0,ibars,High);
   CopyTime(NULL,0,0,ibars,Time);
   int y=ArraySize(WPRBuffer);
   //int w=ArraySize(Low);
   //int x=ArraySize(High);
   //int z=ArraySize(Time);
   
   ResetLastError(); 
   if(flag){filehandle=FileOpen(Symbol()+"_VertexUpLoad_3.txt",FILE_WRITE|FILE_TXT);}
   if(flag){FileWrite(filehandle,"Количество элементов в буфере WPRBuffer "+IntegerToString(y)+" Low "+IntegerToString(w)+
            " High "+IntegerToString(x)+" Time "+IntegerToString(z));}
   //for(int i=ibars-1;i>0;i--)
   for(int i=1;i</*ibars*/ y-1;i++)
     {
      if(i==344)
      {
      Print("");}
      datetime d=Time[i];
      //if(x<D'2004.04.02. 12:00:00'){continue;}//участок кода для тестирования
      if(flag){FileWrite(filehandle,"======================================================================================");}
      dwpr=NormalizeDouble(WPRBuffer[i],4);
      if(dwpr>=dup&&dwpr<0.0){chflag=2;}//индикатор в верхней экстремальной зоне
      if(dwpr<=ddn&&dwpr>-100.1){chflag=1;}//индикатор в нижней ЭЗ, а остальное все тоже самое
//Самое начало пока индикатор "балтается"      
      if(dwpr>=0.0000){if(flag){FileWrite(filehandle,"Самое начало пока индикатор балтается. Бар № "+IntegerToString(i)+
                                         " dwpr "+DoubleToString(dwpr,4));}
Files: