Errors, bugs, questions - page 259

 

Moderators, a question for you.

I can't send a request to servicedesk.

And the close button doesn't work

Общайтесь с разработчиками через Сервисдеск!
Общайтесь с разработчиками через Сервисдеск!
  • www.mql5.com
Ваше сообщение сразу станет доступно нашим отделам тестирования, технической поддержки и разработчикам торговой платформы.
 
sergeev:

Moderators, a question for you.

I can't send a request to servicedesk.

And the "Close" button doesn't work

Please try again. Servicedesk is part of an internal company system that has been rebooted recently.
 
Can you tell me how to know if a trade has closed on a stop loss?
 
I would like to know if there is an alternative to the infinite loop script in 5, because such a script is very capricious, I would like it to continue working when reopening the terminal or changing the timeframe?
 
Olegts:
I would like to know if there is an alternative to the infinite loop script in 5, because such a script is very capricious, I would like it to continue working when opening the terminal again or changing the timeframe?

If you are satisfied with the minimum frequency of 1 second then OnTimer, otherwise

As long as there is no microsecond operation in OnTimer.

 
possible loss of data due to type conversion ChartObject.mqh 213 4
possible loss of data due to type conversion ChartObject.mqh 481 4
possible loss of data due to type conversion ChartObject.mqh 867 17
possible loss of data due to type conversion ChartObjectsTxtControls.mqh 519 4

Bild 375 - vornings appeared in standard libraries. There may be some more, I haven't checked them yet.

Документация по MQL5: Основы языка / Типы данных / Приведение типов
Документация по MQL5: Основы языка / Типы данных / Приведение типов
  • www.mql5.com
Основы языка / Типы данных / Приведение типов - Документация по MQL5
 
Urain:

If you are happy with a minimum frequency of 1s then OnTimer, otherwise

Until OnTimer there is no microsecond operation.

Thank you, a shorter interval is required, so it's the old-fashioned way :)
 
nanaos:
Could you please tell me how do I know if a trade closed by a stop loss?

In MT5 it's not the trade that closes on the stop loss, but the position, at the moment you can find out only by the comment of the trade which closed the position on the stop loss. Here is a sample code.

void Event()
  {
   if(!HistorySelectByPosition(ID))return;
   double margin=0.0;
   bool res;
   int total=HistoryOrdersTotal();
   ulong deal_ticket=HistoryDealGetTicket(total-1);
   string coment=HistoryDealGetString(deal_ticket,DEAL_COMMENT);
   long deal_type=HistoryDealGetInteger(deal_ticket,DEAL_TYPE);
   double volume=HistoryDealGetDouble(deal_ticket,DEAL_VOLUME);
   double MinLot=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
   double MaxLot=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX);
   double Bid=SymbolInfoDouble(_Symbol,SYMBOL_BID);
   double Ask=SymbolInfoDouble(_Symbol,SYMBOL_ASK);
   ulong stoplevel=SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL);

   if(deal_type==ORDER_TYPE_BUY)
     {
      if(StringFind(coment,"sl")>=0)
        {
         request.volume=NormalizeDouble(volume*Klot,DigitsVolume());
         request.price=NormalizeDouble(Bid,_Digits);
         request.type = ORDER_TYPE_SELL;
         if(SL<=0 || TP<=0)return;
         if(SL>=stoplevel) request.sl=NormalizeDouble(Ask+(SL*_Point),_Digits);
         if(SL<stoplevel) request.sl=NormalizeDouble(Ask+(stoplevel*_Point),_Digits);
         if(TP>=stoplevel) request.tp=NormalizeDouble(Bid -(TP*_Point),_Digits);
         if(TP<stoplevel) request.tp=NormalizeDouble(Bid -(stoplevel*_Point),_Digits);
         OrderCalcMargin(request.type,_Symbol,request.volume,Bid,margin);
         if(AccountInfoDouble(ACCOUNT_FREEMARGIN)-margin<0)return;
        }
      if(StringFind(coment,"tp")>=0){flagNewSeries=true;return;}
     }
   if(deal_type==ORDER_TYPE_SELL)
     {
      if(StringFind(coment,"sl")>=0)
        {
         request.volume=NormalizeDouble(volume*Klot,DigitsVolume());
         request.price=NormalizeDouble(Ask,_Digits);
         request.type = ORDER_TYPE_BUY;
         if(SL<=0 || TP<=0)return;
         if(SL>=stoplevel) request.sl=NormalizeDouble(Bid -(SL*_Point),_Digits);
         if(SL<stoplevel) request.sl=NormalizeDouble(Bid -(stoplevel*_Point),_Digits);
         if(TP>=stoplevel) request.tp=NormalizeDouble(Ask+(TP*_Point),_Digits);
         if(TP<stoplevel) request.tp=NormalizeDouble(Ask+(stoplevel*_Point),_Digits);
         OrderCalcMargin(request.type,_Symbol,request.volume,Ask,margin);
         if(AccountInfoDouble(ACCOUNT_FREEMARGIN)-margin<0)return;
        }
      if(StringFind(coment,"tp")>=0){flagNewSeries=true;return;}
     }

   if(request.volume<MinLot)request.volume=MinLot;
   if(request.volume>MaxLot)request.volume=MaxLot;
   request.volume=NormalizeDouble(request.volume,DigitsVolume());

   request.action       = TRADE_ACTION_DEAL;
   request.magic        = Magic;
   request.symbol       = _Symbol;
   request.deviation    = Slip;
   request.type_filling = ORDER_FILLING_AON;
   request.comment      = CommentOrder;

   OrderSend(request,result);

   switch(result.retcode)
     {
      case 10008: {Print("Ордер размещен");PositionSelect(Symbol());ID=PositionGetInteger(POSITION_IDENTIFIER);}break;
      case 10009: {Print("Заявка выполнена");PositionSelect(Symbol());ID=PositionGetInteger(POSITION_IDENTIFIER);}break;
      case 10004: {Print("Реквота");}break;
      case 10006: {Print("Запрос отвергнут");}break;
      case 10007: {Print("Запрос отменен трейдером");res=false;}break;

      case 10010: {Print("Заявка выполнена частично");res=false;}break;
      case 10011: {Print("Ошибка обработки запроса");res=false;}break;
      case 10012: {Print("Запрос отменен по истечению времени");}break;
      case 10013: {Print("Неправильный запрос");res=false;}break;
      case 10014: {Print("Неправильный объем в запросе");res=false;}break;
      case 10015: {Print("Неправильная цена в запросе");res=false;}break;
      case 10016: {Print("Неправильные стопы в запросе");res=false;}break;
      case 10017: {Print("Торговля запрещена");res=false;}break;
      case 10018: {Print("Рынок закрыт");}break;
      case 10019: {Print("Нет достаточных денежных средств для выполнения запроса");res=false;}break;
      case 10020: {Print("Цены изменились");}break;
      case 10021: {Print("Отсутствуют котировки для обработки запроса");}break;
      case 10022: {Print("Неверная дата истечения ордера в запросе");res=false;}break;
      case 10023: {Print("Состояние ордера изменилось");}break;
      case 10024: {Print("Слишком частые запросы");res=false;}break;
      case 10025: {Print("В запросе нет изменений");res=false;}break;
      case 10026: {Print("Автотрейдинг запрещен сервером");res=false;}break;
      case 10027: {Print("Автотрейдинг запрещен клиентским терминалом");res=false;}break;
      case 10028: {Print("Запрос заблокирован для обработки");res=false;}break;
      case 10029: {Print("Ордер или позиция заморожены");res=false;}break;
      case 10030: {Print("Указан неподдерживаемый тип исполнения ордера по остатку");res=false;}break;
      case 10031: {Print("Нет соединения с торговым сервером");}break;
      case 10032: {Print("Операция разрешена только для реальных счетов");res=false;}break;
      case 10033: {Print("Достигнут лимит на количество отложенных ордеров");res=false;}break;
      case 10034: {Print("Достигнут лимит на объем ордеров и позиций для данного символа");res=false;}break;
      default:    Print("Ошибка № - ",result.retcode);
     }
  }
 

The EA has been optimised on the interval AB. Above is a run with these parameters on the interval AD. I don't understand what happens at point C.

I can't understand that the Expert Advisor is not optimised practically on CD interval. Maybe there is a change in some trade rules after 25.10.2010 (point C) or something else?

 
sultanm:

The EA has been optimised on the interval AB. Above is a run with these parameters on the interval AD. I don't understand what happens at point C.

While the Expert Advisor is practically not optimised on CD interval. Maybe there is a change in some of the trading rules after 25.10.2010 (point C) or something else?

What is the average profit trade size of the Expert Advisor? Something tells me it is less than 10 pips.

The problem is probably in the historical data - it's either more combed (filtered), or just more correct (e.g. contains the correct spreads).

What is the server?

Reason: