Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1146

 
Андрей:

Forgot, thank you for your attention.


A new trick for me. Here's the result.

The indicator still changes the colouring of the chart. If you restore the standard one and tap through iCustom it re-colours the chart in its own way again.

It means we have values in the buffers, it's already good. Then try to find the value not on the 1st bar but slightly farther, on 2-3 bars, or vice versa, on 0. You cannot say anything without having seen the code.
 
guys please explain why when you increase the step of the parameters during optimization the number of passes at the bottom right of the terminal is not reduced, i.e. the number is the same as in a more detailed optimization what could be the reason and the same time as in a more detailed optimization in general step does not help reduce the time for optimization why? and how to speed up optimization in general?
 

Gentlemen, Greetings!


I have been struggling with webrequest (get) for a long time, first using mql4 and now using mql5.

The solution is as follows: I need an onTick to copy from the site the prices of some exotic crosses. My broker, unfortunately, does not have them. The example of the cross is on the site below:

Please help. I'm almost ready to pay for the solution of this problem: Can you imagine how far it goes?))

Good luck to all ! BugRiver

 

How to get a variable of string type in EA, if dll function call returns only pointer to string

const char *sqlite3_sql(sqlite3_stmt *pStmt)


Link to documentation

 
Valiantsin Karvat:

Gentlemen, Greetings!


I have been struggling with webrequest (get) for a long time, first using mql4 and now using mql5.

The solution is as follows: I need an onTick to copy from the site the prices of some exotic crosses. My broker, unfortunately, does not have them. The example of the cross is on the site below:

Please help. I'm almost ready to pay for the solution of this problem: Can you imagine how far it goes?))

Good luck to all ! BugRiver

/// Для MQL 4
// url - адрес страницы сайта
// timeot - время в течении которого будет ожидаться ответ (мс)
// webData - сообщение-ответ на запрос т.е. данные страницы сайта в виде текста
// cut - количество отбрасываемых символов от начала сообщения-ответа
///
// Функция возвращает - true в случае, если удалось получить сообщение-ответ на запрос.
bool ReadURL(const string url, int timeout, string &webData, int cut)
{
   char
   myMessage[],
   webMessage[];
   string sWebTitle;
   if(url == NULL)
   {
      Print("URL: NULL");
      return false;
   }
   ResetLastError();
// метод HTTP, url-адрес, cookie, referer, таймаут, массив тела HTTP-сообщения, размер массива data[] в байтах, массив с данными ответа сервера, заголовки ответа сервера
   WebRequest("GET", url, NULL, NULL, timeout, myMessage, 0, webMessage, sWebTitle);
   if(ArraySize(webMessage) == 0)
   {
      Print("В качестве ответа получено пустое сообщение.");
      Print("URL: ", url);
      return false;
   }
   webData = CharArrayToString(webMessage, cut);
   Print("URL: ", url);
   Print("Title: ", sWebTitle);
   return true;
}
Then you search for the required data from the variable you received the message-response with the help of text functions. It is best to view the message-response in your browser, i.e. go to the required page and open the source code of the page. Find the required data there, and write a unique filter in the programme.

I have not worked with Investing in this way and I think this will be problematic. They made their site especially slow for those who do not have a subscription. Therefore it is better to find another source of quotes for automatic reading from program code.

PS> You can't call WebRequest in the indicator. So you will have to arrange the connection between the indy and the EA or the indy and the looped script, to deliver the data to the indy.
 
//variable
double ma = iCustom(NULL, 0, "EMA", MA_Period, Coef, MA_Shift, SetPrice, 0, 0);
// csi variable
double bz = iCustom(NULL, 0, "Bollinger Squeeze v8", triggerType, stochPeriod_trigger1, cciPeriod_trigger2,rsiPeriod_trigger3,6,0);
//fisher variable
double fi = iCustom(NULL, 0, "Fischer11", RangePeriods, PriceSmoothing,IndexSmoothing, Left_Right, Up_Down, 0,0);
if (Ask == ma && bz > 0 && fi > Koof_H)
{
OrderSend(Symbol(), OP_BUY, 1, Ask, Slippage, Stoploss , TakeProfit, "", magic, 0, Lime);
}
if (Bid == ma && bz < 0 && fi < Koof_L)
{
OrderSend(Symbol(), OP_SELL, 1, Bid, Slippage, Stoploss , TakeProfit, "", magic, 0, Red);
}

I made the code, or rather a parody of it, during half a day of studying and studying, it generates error "return value of 'OrderSend' should be checked".

Can someone help me figure this out?

 
evgen_gal:
//variable
double ma = iCustom(NULL, 0, "EMA", MA_Period, Coef, MA_Shift, SetPrice, 0, 0);
// csi variable
double bz = iCustom(NULL, 0, "Bollinger Squeeze v8", triggerType, stochPeriod_trigger1, cciPeriod_trigger2,rsiPeriod_trigger3,6,0);
//fisher variable
double fi = iCustom(NULL, 0, "Fischer11", RangePeriods, PriceSmoothing,IndexSmoothing, Left_Right, Up_Down, 0,0);
if (Ask == ma && bz > 0 && fi > Koof_H)
{
OrderSend(Symbol(), OP_BUY, 1, Ask, Slippage, Stoploss , TakeProfit, "", magic, 0, Lime);
}
if (Bid == ma && bz < 0 && fi < Koof_L)
{
OrderSend(Symbol(), OP_SELL, 1, Bid, Slippage, Stoploss , TakeProfit, "", magic, 0, Red);
}

I made the code, or rather a parody of it, during half a day of studying and studying, it generates error "return value of 'OrderSend' should be checked".

Can someone help me figure it out and tell me how to create an EA?

I am fine. Still need to read about the error handling function and add to the code.

https://www.mql5.com/ru/forum/64058

Функция обработки ошибок. Нужна помощь!
Функция обработки ошибок. Нужна помощь!
  • 2015.09.12
  • www.mql5.com
Как правильно использовать функцию обработки ошибок, чтобы при возникновении непреодолимой ошибки при отправки ордера, эксперт перестал делать запросы на отправку ордера.
 
Renat Akhtyamov:
It's OK. All that's left is to read up on the error handling function and add it to the code.

He won't find the error, you tell him right away:

 //ема переменая
 int result=-1;
     double ma = iCustom(NULL, 0, "EMA", MA_Period, Coef, MA_Shift, SetPrice, 0, 0); 
    // сси переменая 
     double bz = iCustom(NULL, 0, "Bollinger Squeeze v8", triggerType, stochPeriod_trigger1, cciPeriod_trigger2,rsiPeriod_trigger3,6,0);
    //фишер переменая 
     double fi = iCustom(NULL, 0, "Fischer11", RangePeriods, PriceSmoothing,IndexSmoothing, Left_Right, Up_Down, 0,0);
     
     if  (Ask == ma && bz > 0 && fi > Koof_H)
       {
      result= OrderSend(Symbol(), OP_BUY, 1, Ask, Slippage, Stoploss , TakeProfit, "", magic, 0, Lime);
      
        }
       if (Bid == ma && bz < 0 && fi < Koof_L)
       {
      result= OrderSend(Symbol(), OP_SELL, 1, Bid, Slippage, Stoploss , TakeProfit, "", magic, 0, Red);
       }
 
Vitaly Muzichenko :

Yes, he will not find an error, you immediately tell me:

OK.

after each command to open / close any order, add this line:

 if (result< 0 && Fun_Error( GetLastError ())== 1 ){ return ( 0 );}

and place the called function after the EA code:

 //+------------------------------------------------------------------+
//| ФУНКЦИЯ ОБРАБОТКИ ОШИБОК                                         |
//+------------------------------------------------------------------+
 int Fun_Error( int Error)                        
  {   switch (Error)
     {                                           // Преодолимые ошибки        
           case 0 :       return ( 0 );
           case 1 :       Print ( "Попытка изменить уже установленные значения такими же значениями." ); return ( 1 );
           case 2 :       Print ( "Общая ошибка. Прекратить все попытки торговых операций до выяснения обстоятельств." ); return ( 0 );
           case 3 :       Print ( "В торговую функцию переданы неправильные параметры." ); return ( 1 );
           case 4 :       Print ( "Торговый сервер занят.Пробуем ещё раз.." ); Sleep ( 3000 ); return ( 1 );
           case 5 :       Print ( "Старая версия клиентского терминала." ); return ( 0 );
           case 6 :       Print ( "Нет связи с торговым сервером." ); return ( 1 );
           case 7 :       Print ( "Недостаточно прав." ); return ( 1 );
           case 8 :       Print ( "Слишком частые запросы." ); return ( 1 );
           case 9 :       Print ( "Недопустимая операция нарушающая функционирование сервера." ); return ( 1 );
           case 64 :     Print ( "Счет заблокирован. Необходимо прекратить все попытки торговых операций." ); return ( 0 );
           case 65 :     Print ( "Неправильный номер счета." ); return ( 1 );
           case 128 :     Print ( "Истек срок ожидания совершения сделки." ); return ( 1 );
           case 129 :     Print ( "Неправильная цена bid или ask, возможно, ненормализованная цена." ); return ( 1 );
           case 130 :     Print ( "Слишком близкие стопы или неправильно рассчитанные или ненормализованные цены в стопах (или в цене открытия отложенного ордера)." ); return ( 1 );
           case 131 :     Print ( "Неправильный объем, ошибка в грануляции объема." ); return ( 1 );
           case 132 :     Print ( "Рынок закрыт." ); return ( 1 );
           case 133 :     Print ( "Торговля запрещена." ); return ( 0 );
           case 134 :     Print ( "Недостаточно денег для совершения операции." ); return ( 0 );
           case 135 :     Print ( "Цена изменилась. Пробуем ещё раз.." ); RefreshRates (); return ( 1 );
           case 136 :     Print ( "Нет цен. Ждём новый тик.." );
                         while ( RefreshRates ()== false )           // До нового тика            
                         Sleep ( 1 );
                         return ( 1 );
           case 137 :     Print ( "Брокер занят.Пробуем ещё раз.." ); Sleep ( 3000 ); return ( 1 );
           case 138 :     Print ( "Запрошенная цена устарела, либо перепутаны bid и ask." ); return ( 1 );
           case 139 :     Print ( "Ордер заблокирован и уже обрабатывается." ); return ( 1 );
           case 140 :     Print ( "Разрешена только покупка. Повторять операцию SELL нельзя." ); return ( 1 );
           case 141 :     Print ( "Слишком много запросов." ); return ( 1 );
           case 142 :     Print ( "Ордер поставлен в очередь." ); return ( 1 );
           case 143 :     Print ( "Ордер принят дилером к исполнению." ); return ( 1 );
           case 144 :     Print ( "Ордер аннулирован самим клиентом при ручном подтверждении сделки." ); return ( 1 );
           case 145 :     Print ( "Модификация запрещена, так как ордер слишком близок к рынку и заблокирован из-за возможного скорого исполнения." ); return ( 1 );
           case 146 :     Print ( "Подсистема торговли занята.Пробуем ещё.." ); Sleep ( 500 ); return ( 1 );
           case 147 :     Print ( "Использование даты истечения ордера запрещено брокером." ); return ( 1 );
           case 148 :     Print ( "Количество открытых и отложенных ордеров достигло предела, установленного брокером." ); return ( 1 );
           case 149 :     Print ( "Попытка открыть противоположную позицию к уже существующей в случае, если хеджирование запрещено." ); return ( 1 );
           case 4000 :   return ( 0 );
           case 4001 :   Print ( "Неправильный указатель функции." ); return ( 1 );
           case 4002 :   Print ( "Индекс массива - вне диапазона." ); return ( 1 );
           case 4003 :   Print ( "Нет памяти для стека функций." ); return ( 1 );
           case 4004 :   Print ( "Переполнение стека после рекурсивного вызова." ); return ( 1 );
           case 4005 :   Print ( "На стеке нет памяти для передачи параметров." ); return ( 1 );
           case 4006 :   Print ( "Нет памяти для строкового параметра." ); return ( 1 );
           case 4007 :   Print ( "Нет памяти для временной строки." ); return ( 1 );
           case 4008 :   Print ( "Неинициализированная строка." ); return ( 1 );
           case 4009 :   Print ( "Неинициализированная строка в массиве." ); return ( 1 );
           case 4010 :   Print ( "Нет памяти для строкового массива." ); return ( 1 );
           case 4011 :   Print ( "Слишком длинная строка." ); return ( 1 );
           case 4012 :   Print ( "Остаток от деления на ноль." ); return ( 1 );
           case 4013 :   Print ( "Деление на ноль." ); return ( 1 );
           case 4014 :   Print ( "Неизвестная команда." ); return ( 1 );
           case 4015 :   Print ( "Неправильный переход." ); return ( 1 );
           case 4016 :   Print ( "Неинициализированный массив." ); return ( 1 );
           case 4017 :   Print ( "Вызовы DLL не разрешены." ); return ( 1 );
           case 4018 :   Print ( "Невозможно загрузить библиотеку." ); return ( 1 );
           case 4019 :   Print ( "Невозможно вызвать функцию." ); return ( 1 );
           case 4020 :   Print ( "Вызовы внешних библиотечных функций не разрешены." ); return ( 1 );
           case 4021 :   Print ( "Недостаточно памяти для строки, возвращаемой из функции." ); return ( 1 );
           case 4022 :   Print ( "Система занята." ); return ( 1 );
           case 4050 :   Print ( "Неправильное количество параметров функции." ); return ( 1 );
           case 4051 :   Print ( "Недопустимое значение параметра функции." ); return ( 1 );
           case 4052 :   Print ( "Внутренняя ошибка строковой функции." ); return ( 1 );
           case 4053 :   Print ( "Ошибка массива." ); return ( 1 );
           case 4054 :   Print ( "Неправильное использование массива-таймсерии." ); return ( 1 );
           case 4055 :   Print ( "Ошибка пользовательского индикатора." ); return ( 1 );
           case 4056 :   Print ( "Массивы несовместимы." ); return ( 1 );
           case 4057 :   Print ( "Ошибка обработки глобальныех переменных." ); return ( 1 );
           case 4058 :   Print ( "Глобальная переменная не обнаружена." ); return ( 1 );
           case 4059 :   Print ( "Функция не разрешена в тестовом режиме." ); return ( 1 );
           case 4060 :   Print ( "Функция не подтверждена." ); return ( 1 );
           case 4061 :   Print ( "Ошибка отправки почты." ); return ( 1 );
           case 4062 :   Print ( "Ожидается параметр типа string." ); return ( 1 );
           case 4063 :   Print ( "Ожидается параметр типа integer." ); return ( 1 );
           case 4064 :   Print ( "Ожидается параметр типа double." ); return ( 1 );
           case 4065 :   Print ( "В качестве параметра ожидается массив." ); return ( 1 );
           case 4066 :   Print ( "Запрошенные исторические данные в состоянии обновления." ); return ( 1 );
           case 4067 :   Print ( "Ошибка при выполнении торговой операции." ); return ( 1 );
           case 4099 :   Print ( "Конец файла." ); return ( 1 );
           case 4100 :   Print ( "Ошибка при работе с файлом." ); return ( 1 );
           case 4101 :   Print ( "Неправильное имя файла." ); return ( 1 );
           case 4102 :   Print ( "Слишком много открытых файлов." ); return ( 1 );
           case 4103 :   Print ( "Невозможно открыть файл." ); return ( 1 );
           case 4104 :   Print ( "Несовместимый режим доступа к файлу." ); return ( 1 );
           case 4105 :   Print ( "Ни один ордер не выбран." ); return ( 1 );
           case 4106 :   Print ( "Неизвестный символ." ); return ( 1 );
           case 4107 :   Print ( "Неправильный параметр цены для торговой функции." ); return ( 1 );
           case 4108 :   Print ( "Неверный номер тикета." ); return ( 1 );
           case 4109 :   Print ( "Торговля не разрешена. Необходимо включить опцию Разрешить советнику торговать в свойствах эксперта." ); return ( 1 );
           case 4110 :   Print ( "Длинные позиции не разрешены. Необходимо проверить свойства эксперта." ); return ( 1 );
           case 4111 :   Print ( "Короткие позиции не разрешены. Необходимо проверить свойства эксперта." ); return ( 1 );
           case 4200 :   Print ( "Объект уже существует." ); return ( 1 );
           case 4201 :   Print ( "Запрошено неизвестное свойство объекта." ); return ( 1 );
           case 4202 :   Print ( "Объект не существует." ); return ( 1 );
           case 4203 :   Print ( "Неизвестный тип объекта." ); return ( 1 );
           case 4204 :   Print ( "Нет имени объекта." ); return ( 1 );
           case 4205 :   Print ( "Ошибка координат объекта." ); return ( 1 );
           case 4206 :   Print ( "Не найдено указанное подокно." ); return ( 1 );
           case 4207 :   Print ( "Ошибка при работе с объектом." ); return ( 1 );
           return ( 0 );
     }
     return ( 0 );  
  }
 

I am writing an EA using the Ma_C indicator.


PLEASE tell me how to write buy/sell conditions, if I need to take data from indicator buffer 1 and 2 empty - to buy, not empty buffer 1 and 2 - to sell.


I would be very grateful for any help.

Files:
MA_C.mq4  10 kb
Reason: