Скачать MetaTrader 5

Уважаемые разработчики! Закрытие невпопад и ошибка №2 V 4.0 b 186

Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий
Продавай продукты через Маркет и отслеживай статистику продаж
Forex Trader
114257
Forex Trader 2005.12.19 12:20 
Уважаемые разработчики!

При разработке и тестировании советника возникла проблема!
Сделки закрываются невпопад... некоторые попытки закрыть позицию выдают ОБЩУЮ ошибку №2!
Версия 4.0 b 186.
На реальной торговле этого не наблюдается!
В связи с этим при тестировании "искажаются" полученные результаты...

Надеюсь на возможное скорое исправление!

С уважением!
Евгений К.



//+------------------------------------------------------------------+
//| 111.mq4 |
//| Copyright © 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
int r_tmp;
int ticket;
static datetime last_time = 0;
bool OrderOp = true;

//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if( (CurTime()- last_time)<7) return(0);


if (OrdersTotal()>5) // запрещаем торговлю - взяли 5 билетов
{OrderOp = false;}


if (OrdersTotal()==0) // все билеты проданы можно торговать
{OrderOp = true;}




if (OrderOp == true) // разрешено торговать
{

ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,0,"My order #2",16384,0,Green);
last_time = CurTime();
if(ticket<0)
{
Print("OrderSend failed with error #",GetLastError());
return(0);
}

}

if (OrderOp == false) // закрываем 5 открытых сделок
{
for (r_tmp=0; r_tmp < OrdersTotal(); r_tmp++) // можно убрать оставив r_tmp=0
{ //
OrderSelect(r_tmp, SELECT_BY_POS, MODE_TRADES);

if (OrderClose(OrderTicket(), 0.1, Bid, 3, Red) == true)
{last_time = CurTime(); return(0);}


else Print ("ERROR - Ticket -", OrderTicket(),
" GetLastError - ", GetLastError(),
" CurTime() = ", CurTime());

} // аналогично
}

//----
return(0);
}
//+------------------------------------------------------------------+



///////////////////////////////////////// логи реальной торговли - советник работает исправно!!!!!!!!!!!!!!!!!!!!!!!!!!


13:39:12 Compiling 'test'
13:39:12 test EURUSD,M15: deinitialized
13:39:12 test EURUSD,M15: loaded successfully
13:39:12 test EURUSD,M15: initialized
13:41:16 test EURUSD,M15: close #2381090 buy 0.10 EURUSD at 1.2025 at price 1.2023
13:41:17 test EURUSD,M15: close #2381098 buy 0.10 EURUSD at 1.2024 at price 1.2022
13:42:35 test EURUSD,M15: close #2381111 buy 0.10 EURUSD at 1.2021 at price 1.2022
13:42:39 test EURUSD,M15: close #2381118 buy 0.10 EURUSD at 1.2021 at price 1.2023
13:42:41 test EURUSD,M15: close #2381125 buy 0.10 EURUSD at 1.2023 at price 1.2022
13:43:27 test EURUSD,M15: close #2381261 buy 0.10 EURUSD at 1.2024 at price 1.2023
13:43:31 test EURUSD,M15: open #2381361 buy 0.10 EURUSD at 1.2025 ok
13:44:14 test EURUSD,M15: open #2381375 buy 0.10 EURUSD at 1.2027 ok
13:44:41 test EURUSD,M15: open #2381389 buy 0.10 EURUSD at 1.2026 ok
13:45:06 test EURUSD,M15: open #2381399 buy 0.10 EURUSD at 1.2025 ok
13:45:15 test EURUSD,M15: open #2381403 buy 0.10 EURUSD at 1.2025 ok
13:46:10 test EURUSD,M15: open #2381425 buy 0.10 EURUSD at 1.2025 ok
13:46:29 test EURUSD,M15: close #2381361 buy 0.10 EURUSD at 1.2025 at price 1.2021
13:47:00 test EURUSD,M15: close #2381375 buy 0.10 EURUSD at 1.2027 at price 1.2022
13:47:10 test EURUSD,M15: close #2381389 buy 0.10 EURUSD at 1.2026 at price 1.2021
13:47:12 test EURUSD,M15: close #2381399 buy 0.10 EURUSD at 1.2025 at price 1.2022
13:47:16 test EURUSD,M15: close #2381403 buy 0.10 EURUSD at 1.2025 at price 1.2021
13:48:45 test EURUSD,M15: close #2381425 buy 0.10 EURUSD at 1.2025 at price 1.2022
13:49:27 test EURUSD,M15: open #2381493 buy 0.10 EURUSD at 1.2024 ok
13:50:17 test EURUSD,M15: open #2381509 buy 0.10 EURUSD at 1.2023 ok
13:50:31 test EURUSD,M15: open #2381517 buy 0.10 EURUSD at 1.2024 ok
13:50:52 test EURUSD,M15: open #2381534 buy 0.10 EURUSD at 1.2024 ok
13:52:49 test EURUSD,M15: open #2381579 buy 0.10 EURUSD at 1.2024 ok
13:53:11 test EURUSD,M15: open #2381588 buy 0.10 EURUSD at 1.2024 ok
13:53:30 test EURUSD,M15: close #2381493 buy 0.10 EURUSD at 1.2024 at price 1.2020
13:53:50 test EURUSD,M15: close #2381509 buy 0.10 EURUSD at 1.2023 at price 1.2021
13:53:52 test EURUSD,M15: close #2381517 buy 0.10 EURUSD at 1.2024 at price 1.2020
13:54:13 test EURUSD,M15: close #2381534 buy 0.10 EURUSD at 1.2024 at price 1.2021
13:54:22 test EURUSD,M15: close #2381579 buy 0.10 EURUSD at 1.2024 at price 1.2020
13:54:24 test EURUSD,M15: close #2381588 buy 0.10 EURUSD at 1.2024 at price 1.2019


////////////////////////////////// логи из "тестера" МT4.0 B 186 закрывается с провалами - ошибка №2

13:57:52 test EURUSD,M15: loaded successfully
13:57:52 test started for testing
13:57:52 2005.12.02 00:14 test EURUSD,M15: open #1 buy 0.10 EURUSD at 1.1739 ok
13:57:52 2005.12.02 00:29 test EURUSD,M15: open #2 buy 0.10 EURUSD at 1.1738 ok
13:57:52 2005.12.02 00:44 test EURUSD,M15: open #3 buy 0.10 EURUSD at 1.1739 ok
13:57:52 2005.12.02 00:59 test EURUSD,M15: open #4 buy 0.10 EURUSD at 1.1740 ok
13:57:52 2005.12.02 01:14 test EURUSD,M15: open #5 buy 0.10 EURUSD at 1.1739 ok
13:57:52 2005.12.02 01:29 test EURUSD,M15: open #6 buy 0.10 EURUSD at 1.1737 ok
13:57:52 2005.12.02 01:44 test EURUSD,M15: close #4 buy 0.10 EURUSD at 1.1740 at price 1.1736
13:57:52 2005.12.02 01:59 test EURUSD,M15: close #5 buy 0.10 EURUSD at 1.1739 at price 1.1731
13:57:52 2005.12.02 02:14 test EURUSD,M15: ERROR - Ticket -6 GetLastError - 2 CurTime() = 1133489699
13:57:52 2005.12.02 02:14 test EURUSD,M15: close #2 buy 0.10 EURUSD at 1.1738 at price 1.1733
13:57:52 2005.12.02 02:29 test EURUSD,M15: close #1 buy 0.10 EURUSD at 1.1739 at price 1.1734
13:57:52 2005.12.02 02:44 test EURUSD,M15: close #6 buy 0.10 EURUSD at 1.1737 at price 1.1721
13:57:52 2005.12.02 02:59 test EURUSD,M15: close #3 buy 0.10 EURUSD at 1.1739 at price 1.1724
13:57:52 2005.12.02 03:14 test EURUSD,M15: open #7 buy 0.10 EURUSD at 1.1724 ok
13:57:52 2005.12.02 03:29 test EURUSD,M15: open #8 buy 0.10 EURUSD at 1.1728 ok
13:57:52 2005.12.02 03:44 test EURUSD,M15: open #9 buy 0.10 EURUSD at 1.1727 ok
13:57:52 2005.12.02 03:59 test EURUSD,M15: open #10 buy 0.10 EURUSD at 1.1727 ok
13:57:52 2005.12.02 04:14 test EURUSD,M15: open #11 buy 0.10 EURUSD at 1.1729 ok
13:57:52 2005.12.02 04:29 test EURUSD,M15: open #12 buy 0.10 EURUSD at 1.1728 ok
13:57:52 2005.12.02 04:44 test EURUSD,M15: close #10 buy 0.10 EURUSD at 1.1727 at price 1.1726
13:57:52 2005.12.02 04:59 test EURUSD,M15: close #11 buy 0.10 EURUSD at 1.1729 at price 1.1726
13:57:52 2005.12.02 05:14 test EURUSD,M15: ERROR - Ticket -12 GetLastError - 2 CurTime() = 1133500499
13:57:52 2005.12.02 05:14 test EURUSD,M15: close #8 buy 0.10 EURUSD at 1.1728 at price 1.1726
13:57:52 2005.12.02 05:29 test EURUSD,M15: close #7 buy 0.10 EURUSD at 1.1724 at price 1.1727
13:57:52 2005.12.02 05:44 test EURUSD,M15: close #12 buy 0.10 EURUSD at 1.1728 at price 1.1726
13:57:52 2005.12.02 05:59 test EURUSD,M15: close #9 buy 0.10 EURUSD at 1.1727 at price 1.1725
13:57:52 2005.12.02 06:14 test EURUSD,M15: open #13 buy 0.10 EURUSD at 1.1730 ok
13:57:52 2005.12.02 06:29 test EURUSD,M15: open #14 buy 0.10 EURUSD at 1.1730 ok
13:57:52 2005.12.02 06:44 test EURUSD,M15: open #15 buy 0.10 EURUSD at 1.1731 ok
13:57:52 2005.12.02 06:59 test EURUSD,M15: open #16 buy 0.10 EURUSD at 1.1729 ok
13:57:52 2005.12.02 07:14 test EURUSD,M15: open #17 buy 0.10 EURUSD at 1.1731 ok
13:57:52 2005.12.02 07:29 test EURUSD,M15: open #18 buy 0.10 EURUSD at 1.1731 ok
13:57:52 2005.12.02 07:44 test EURUSD,M15: close #16 buy 0.10 EURUSD at 1.1729 at price 1.1722
13:57:52 2005.12.02 07:59 test EURUSD,M15: close #17 buy 0.10 EURUSD at 1.1731 at price 1.1719
13:57:52 2005.12.02 08:14 test EURUSD,M15: ERROR - Ticket -18 GetLastError - 2 CurTime() = 1133511299
13:57:52 2005.12.02 08:14 test EURUSD,M15: close #14 buy 0.10 EURUSD at 1.1730 at price 1.1715
13:57:52 2005.12.02 08:29 test EURUSD,M15: close #13 buy 0.10 EURUSD at 1.1730 at price 1.1713
13:57:52 2005.12.02 08:44 test EURUSD,M15: close #18 buy 0.10 EURUSD at 1.1731 at price 1.1707
13:57:52 2005.12.02 08:59 test EURUSD,M15: close #15 buy 0.10 EURUSD at 1.1731 at price 1.1709
13:57:52 2005.12.02 09:14 test EURUSD,M15: open #19 buy 0.10 EURUSD at 1.1712 ok
13:57:52 2005.12.02 09:29 test EURUSD,M15: open #20 buy 0.10 EURUSD at 1.1716 ok
13:57:52 2005.12.02 09:44 test EURUSD,M15: open #21 buy 0.10 EURUSD at 1.1709 ok
13:57:52 2005.12.02 09:59 test EURUSD,M15: open #22 buy 0.10 EURUSD at 1.1709 ok
13:57:52 2005.12.02 10:14 test EURUSD,M15: open #23 buy 0.10 EURUSD at 1.1708 ok
13:57:52 2005.12.02 10:29 test EURUSD,M15: open #24 buy 0.10 EURUSD at 1.1713 ok
13:57:52 2005.12.02 10:44 test EURUSD,M15: close #22 buy 0.10 EURUSD at 1.1709 at price 1.1711
13:57:52 2005.12.02 10:59 test EURUSD,M15: close #23 buy 0.10 EURUSD at 1.1708 at price 1.1711
13:57:52 2005.12.02 11:14 test EURUSD,M15: ERROR - Ticket -24 GetLastError - 2 CurTime() = 1133522099
13:57:52 2005.12.02 11:14 test EURUSD,M15: close #20 buy 0.10 EURUSD at 1.1716 at price 1.1708
13:57:52 2005.12.02 11:29 test EURUSD,M15: close #19 buy 0.10 EURUSD at 1.1712 at price 1.1707
13:57:52 2005.12.02 11:44 test EURUSD,M15: close #24 buy 0.10 EURUSD at 1.1713 at price 1.1707
13:57:52 2005.12.02 11:59 test EURUSD,M15: close #21 buy 0.10 EURUSD at 1.1709 at price 1.1705
13:57:52 2005.12.02 12:14 test EURUSD,M15: open #25 buy 0.10 EURUSD at 1.1706 ok
13:57:52 2005.12.02 12:29 test EURUSD,M15: open #26 buy 0.10 EURUSD at 1.1706 ok
13:57:52 2005.12.02 12:44 test EURUSD,M15: open #27 buy 0.10 EURUSD at 1.1702 ok
13:57:52 2005.12.02 12:59 test EURUSD,M15: open #28 buy 0.10 EURUSD at 1.1700 ok
13:57:52 2005.12.02 13:14 test EURUSD,M15: open #29 buy 0.10 EURUSD at 1.1703 ok
13:57:52 2005.12.02 13:29 test EURUSD,M15: open #30 buy 0.10 EURUSD at 1.1699 ok
13:57:52 2005.12.02 13:44 test EURUSD,M15: close #28 buy 0.10 EURUSD at 1.1700 at price 1.1704
13:57:52 2005.12.02 13:59 test EURUSD,M15: close #29 buy 0.10 EURUSD at 1.1703 at price 1.1705
13:57:52 2005.12.02 14:14 test EURUSD,M15: ERROR - Ticket -30 GetLastError - 2 CurTime() = 1133532899
13:57:52 2005.12.02 14:14 test EURUSD,M15: close #26 buy 0.10 EURUSD at 1.1706 at price 1.1695
13:57:52 2005.12.02 14:29 test EURUSD,M15: close #25 buy 0.10 EURUSD at 1.1706 at price 1.1699
13:57:52 2005.12.02 14:44 test EURUSD,M15: close #30 buy 0.10 EURUSD at 1.1699 at price 1.1696
13:57:52 2005.12.02 14:59 test EURUSD,M15: close #27 buy 0.10 EURUSD at 1.1702 at price 1.1726
13:57:52 2005.12.02 15:14 test EURUSD,M15: open #31 buy 0.10 EURUSD at 1.1722 ok
13:57:52 2005.12.02 15:29 test EURUSD,M15: open #32 buy 0.10 EURUSD at 1.1704 ok
13:57:52 2005.12.02 15:44 test EURUSD,M15: open #33 buy 0.10 EURUSD at 1.1705 ok
13:57:52 2005.12.02 15:59 test EURUSD,M15: open #34 buy 0.10 EURUSD at 1.1664 ok
13:57:52 2005.12.02 16:14 test EURUSD,M15: open #35 buy 0.10 EURUSD at 1.1686 ok
13:57:52 2005.12.02 16:29 test EURUSD,M15: open #36 buy 0.10 EURUSD at 1.1687 ok
13:57:52 2005.12.02 16:44 test EURUSD,M15: close #34 buy 0.10 EURUSD at 1.1664 at price 1.1699
13:57:52 2005.12.02 16:59 test EURUSD,M15: close #35 buy 0.10 EURUSD at 1.1686 at price 1.1690
13:57:52 2005.12.02 17:14 test EURUSD,M15: ERROR - Ticket -36 GetLastError - 2 CurTime() = 1133543699
13:57:52 2005.12.02 17:14 test EURUSD,M15: close #32 buy 0.10 EURUSD at 1.1704 at price 1.1693
13:57:52 2005.12.02 17:29 test EURUSD,M15: close #31 buy 0.10 EURUSD at 1.1722 at price 1.1706
13:57:52 2005.12.02 17:44 test EURUSD,M15: close #36 buy 0.10 EURUSD at 1.1687 at price 1.1695
13:57:52 2005.12.02 17:59 test EURUSD,M15: close #33 buy 0.10 EURUSD at 1.1705 at price 1.1696
13:57:52 2005.12.02 18:14 test EURUSD,M15: open #37 buy 0.10 EURUSD at 1.1712 ok
13:57:52 2005.12.02 18:29 test EURUSD,M15: open #38 buy 0.10 EURUSD at 1.1708 ok
13:57:52 2005.12.02 18:44 test EURUSD,M15: open #39 buy 0.10 EURUSD at 1.1708 ok
13:57:52 2005.12.02 18:59 test EURUSD,M15: open #40 buy 0.10 EURUSD at 1.1713 ok
13:57:52 2005.12.02 19:14 test EURUSD,M15: open #41 buy 0.10 EURUSD at 1.1720 ok
13:57:52 2005.12.02 19:29 test EURUSD,M15: open #42 buy 0.10 EURUSD at 1.1723 ok
13:57:52 2005.12.02 19:44 test EURUSD,M15: close #40 buy 0.10 EURUSD at 1.1713 at price 1.1714
13:57:52 2005.12.02 19:59 test EURUSD,M15: close #41 buy 0.10 EURUSD at 1.1720 at price 1.1711
13:57:52 2005.12.02 20:14 test EURUSD,M15: ERROR - Ticket -42 GetLastError - 2 CurTime() = 1133554499
13:57:52 2005.12.02 20:14 test EURUSD,M15: close #38 buy 0.10 EURUSD at 1.1708 at price 1.1704
13:57:52 2005.12.02 20:29 test EURUSD,M15: close #37 buy 0.10 EURUSD at 1.1712 at price 1.1705
13:57:52 2005.12.02 20:44 test EURUSD,M15: close #42 buy 0.10 EURUSD at 1.1723 at price 1.1712
13:57:52 2005.12.02 20:59 test EURUSD,M15: close #39 buy 0.10 EURUSD at 1.1708 at price 1.1710
13:57:52 2005.12.02 21:14 test EURUSD,M15: open #43 buy 0.10 EURUSD at 1.1713 ok
13:57:52 2005.12.02 21:29 test EURUSD,M15: open #44 buy 0.10 EURUSD at 1.1717 ok
13:57:52 2005.12.02 21:44 test EURUSD,M15: open #45 buy 0.10 EURUSD at 1.1717 ok
13:57:52 2005.12.02 21:59 test EURUSD,M15: open #46 buy 0.10 EURUSD at 1.1717 ok
13:57:52 2005.12.02 22:14 test EURUSD,M15: open #47 buy 0.10 EURUSD at 1.1718 ok
13:57:52 2005.12.02 22:29 test EURUSD,M15: open #48 buy 0.10 EURUSD at 1.1720 ok
13:57:52 2005.12.02 22:44 test EURUSD,M15: close #46 buy 0.10 EURUSD at 1.1717 at price 1.1717
13:57:52 2005.12.02 22:59 test EURUSD,M15: close #47 buy 0.10 EURUSD at 1.1718 at price 1.1716
13:57:52 2005.12.02 22:59 Tester: order #43 is closed
13:57:52 2005.12.02 22:59 Tester: order #44 is closed
13:57:52 2005.12.02 22:59 Tester: order #48 is closed
13:57:52 2005.12.02 22:59 Tester: order #45 is closed
Forex Trader
114257
Forex Trader 2005.12.19 12:24  
похоже, что Вы работете со 186 билдом от 10 ноября. аналогичные проблемы уже обсуждались и были исправлены в 186 билде от 17 ноября. сейчас у нас на сайте лежит билд от 14 декабря "Для скачивания выложено обновление версии MetaTrader 4 Build 186" скачайте его https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe?utm_campaign=MQL5.community и попробуйте снова
Forex Trader
114257
Forex Trader 2005.12.19 12:34  
Спасибо!

Все заработало... считаю можно удалить тему!
Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий