Example2: Would a function like this be suitable for error handling?
Something's too short. Even this one isn't full-fledged either.
//*********************ф-ия обработки ошибок*************************|int Fun_Error(int Error)
{
switch(Error)
{ // Преодолимые ошибкиcase0: return(1);
case4: //Print("Торговый сервер занят. Пробуем ещё раз...");Sleep(500); // Простое решениеreturn(1); // Выход из функцииcase128: //Истек срок ожидания совершения сделкиreturn(1);
case129: //Print("Цена изменилась. Пробуем ещё раз...");return(1); // Выход из функцииcase132: //Print("Рынок закрыт. Пробуем ещё раз...");Sleep(123000); // Это было сделано для робо. У них первые 2 минуты в понедельник рынок закрыт, а надо было ставить ордера в 00:00return(1); // Выход из функцииcase135: //Print("Цена изменилась. Пробуем ещё раз...");RefreshRates(); // Обновим данныеreturn(1); // Выход из функцииcase136: //Print("Нет цен. Ждём новый тик...");while(RefreshRates()==false) // До нового тикаSleep(1); // Задержка в циклеreturn(1); // Выход из функцииcase137: //Print("Брокер занят. Пробуем ещё раз...");Sleep(500); // Простое решениеreturn(1); // Выход из функцииcase138: //Print("Новые цены. Пробуем ещё раз...");Sleep(1); // Задержка в циклеreturn(1); // Выход из функцииcase146: //Print("Подсистема торговли занята. Пробуем ещё...");Sleep(500); // Простое решениеreturn(1); // Выход из функцииcase4107: //Print("Неправильный параметр цены для торговой функции. Пробуем ещё...");Sleep(50); // Простое решениеreturn(1); // Выход из функции// Критические ошибкиcase1:
return(0);
case2: Alert("Общая ошибка. Перегрузите терминал и\или компьютер.");
return(0); // Выход из функцииcase5: Alert("Старая версия терминала.");
//Work=false; // Больше не работатьreturn(0); // Выход из функцииcase64: Alert("Счет заблокирован.");
//Work=false; // Больше не работатьreturn(0); // Выход из функцииcase130: Alert("Неправильные стопы.");
return(0); // Выход из функцииcase133: Alert("Торговля запрещена.");
return(0); // Выход из функцииcase134: Alert("Недостаточно денег для совершения операции.");
return(0); // Выход из функцииcase4051: Alert("Недопустимое значение параметра функции.");
return(0); // Выход из функцииcase4108: Alert("Неверный номер тикета.");
return(0); // Выход из функцииdefault: //Print("Возникла ошибка ",Error); // Другие вариантыreturn(0); // Выход из функции
}
}//******************************************************************|
Accordingly, if the function returns 1, we should try to place an order again; if it returns 0, we will exit the function for opening orders.
Could you please tell me the best way to code the following condition
If all candlesticks from 1 to 20 are bearish without exception (the number of points between the opening and closing of each candlestick does not matter)
Could you please tell me the best way to code the following condition
If all candlesticks from 1 to 20 are bearish without exception (the number of points between the opening and closing of each candlestick does not matter)
To open an order.
The only way to do this is to write a "make-work" order.
Hello, if an EA only sets pending orders, should it be able to handle errors?
Yes.
For example.
Yes.
For example.
Would a function like this be suitable for error handling?
Something's too short. Even this one isn't full-fledged either.
Accordingly, if the function returns 1, we should try to place an order again; if it returns 0, we will exit the function for opening orders.
Citizens, can you tell me why the Alpari terminal is unable to place an order?
The OrderSend function looks like this
There are no parameters equal to zero. I have checked it.
The minimum stop and profit distance according to the terminal conditions = 0.1.
The terminal generates error 130 and writes about an invalid profit or stop.
SL and TP parameters are 11 and 1 (after normalization), respectively.
On terminals Aforex, Diven FX, ForexClub, AlfaForex - no problems with the same code.
Citizens, can you tell me why the Alpari terminal is unable to place an order?
The OrderSend function looks like this
There are no parameters equal to zero. I have checked it.
The minimum stop and profit distance according to the terminal conditions = 0.1.
The terminal generates error 130 and writes about an invalid profit or stop.
SL and TP parameters are 11 and 1 (after normalization), respectively.
On terminals Aforex, Diven FX, ForexClub, AlfaForex - no problems with the same code.
buy/sell without stop and takeaway sl=0;tp=0, then modify-->sl=100;tp=300
Buy/sell without stop and takeoff sl=0;tp=0, then modify-->sl=100;tp=300
The thought has already occurred to me out of desperation...
However, the question is why with all the correct parameters the order is not placed.
Since this is a gold chart, the numbers 11 and 1 are quite correct. Translated it means 10 and 110 pips.
I checked prices and stop and profit parameters. There is exactly 120 pips between the profit and stop, and for some reason the opening price = 0.000.
Attempting to place a pending order brought nothing either....
It's getting more and more miraculous.
Good day all!
Could you please tell me the best way to code the following condition
If all candlesticks from 1 to 20 are bearish without exception (the number of points between the opening and closing of each candlestick does not matter)
To open an order.
I can't read anything else, just open an order.
Good day all!
Could you please tell me the best way to code the following condition
If all candlesticks from 1 to 20 are bearish without exception (the number of points between the opening and closing of each candlestick does not matter)
To open an order.
The only way to do this is to write a "make-work" order.
If I could just write it "by hand".