Прежде чем публиковать код с такими громкими заявлениями, проверили бы его, что ли... Он просто вешает терминал:
Before you post code with such rhetoric, would check it, that is ... He just hangs terminal:
Какая риторика чем ты говоришь?
Не волнуйся, я проверил его. Это не мой код, который бродит терминала, это новый MT5/mql5 ошибка (сборка 858? - 868).
Все версии, в том числе ваш, прослушиваются при испытании с DateTime не соответствующие времени открытия бара.
Все версии, в том числе ваш, прослушиваются при испытании с DateTime не соответствующие времени открытия бара.
А причём здесь время открытия бара? В чём ошибка?
Какая риторика чем ты говоришь?
Не волнуйся, я проверил его. Это не мой код, который бродит терминала, это новый MT5/mql5 ошибка (сборка 858? - 868).
Все версии, в том числе ваш, прослушиваются при испытании с DateTime не соответствующие времени открытия бара.
Please, write in English. Automatical translater is not perfect.
Here is code and results from MT4:
#property show_inputs extern datetime searchDate = D'2013.10.25 21:15:00'; extern bool exacts = false; //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { int shift=iBarShift(Symbol(),PERIOD_M15,searchDate,exacts); Print("iBarShift for ",TimeToStr(searchDate)," is ",shift); return(0); } //+------------------------------------------------------------------+
22:52:16 sBarShift EURUSD,M15 inputs: searchDate='2013.10.25 21:15'; exacts=false;
22:52:16 sBarShift EURUSD,M15: iBarShift for 2013.10.25 21:15 is 6
22:52:29 sBarShift EURUSD,M15 inputs: searchDate='2013.10.25 21:17'; exacts=false;
22:52:29 sBarShift EURUSD,M15: iBarShift for 2013.10.25 21:17 is 6
22:52:38 sBarShift EURUSD,M15 inputs: searchDate='2013.10.25 21:14'; exacts=false;
22:52:38 sBarShift EURUSD,M15: iBarShift for 2013.10.25 21:14 is 7
22:53:32 sBarShift EURUSD,M15 inputs: searchDate='2013.10.25 21:15'; exacts=true;
22:53:32 sBarShift EURUSD,M15: iBarShift for 2013.10.25 21:15 is 6
22:52:52 sBarShift EURUSD,M15 inputs: searchDate='2013.10.25 21:17'; exacts=true;
22:52:52 sBarShift EURUSD,M15: iBarShift for 2013.10.25 21:17 is 6
22:53:17 sBarShift EURUSD,M15 inputs: searchDate='2013.10.25 21:14'; exacts=true;
22:53:17 sBarShift EURUSD,M15: iBarShift for 2013.10.25 21:14 is 7
Here is results from MT5:
searchDate='2013.10.25 21:15'; exacts=false;
2013.10.27 22:58:08 TestBarShift (EURUSD,M15) iBarShift (komposter) for 2013.10.25 21:15 is 6 in 0 milliseconds.
searchDate='2013.10.25 21:17'; exacts=false;
2013.10.27 22:58:20 TestBarShift (EURUSD,M15) iBarShift (komposter) for 2013.10.25 21:17 is 5 in 0 milliseconds.
searchDate='2013.10.25 21:14'; exacts=false;
2013.10.27 22:58:29 TestBarShift (EURUSD,M15) iBarShift (komposter) for 2013.10.25 21:14 is 6 in 0 milliseconds.
searchDate='2013.10.25 21:15'; exacts=true;
2013.10.27 22:58:40 TestBarShift (EURUSD,M15) iBarShift (komposter) for 2013.10.25 21:15 is 6 in 0 milliseconds.
searchDate='2013.10.25 21:17'; exacts=true;
2013.10.27 22:58:49 TestBarShift (EURUSD,M15) iBarShift (komposter) for 2013.10.25 21:17 is -1 in 0 milliseconds.
searchDate='2013.10.25 21:14'; exacts=true;
2013.10.27 22:58:58 TestBarShift (EURUSD,M15) iBarShift (komposter) for 2013.10.25 21:14 is -1 in 0 milliseconds.
I see the deffirence in results and I'll fix my code shortly.
As for your code - I can't test it because it don't work in last MT5 build.
Please, write in English. Automatical translater is not perfect.
Here is code and results from MT4:
Here is results from MT5:
I see the deffirence in results and I'll fix my code shortly.
As for your code - I can't test it because it don't work in last MT5 build.
Thank you, I have to fix my code also when exact is true, as I misunderstood this parameter. English documentation for iBarShift is wrong.
The mql5 bug is on Bars() function, I reported it to Service Desk.
Thank you, I have to fix my code also when exact is true, as I misunderstood this parameter. English documentation for iBarShift is wrong.
I think this is my error too, iBarShift should return bar which contain specified time (not with exact open time).
Could I use your function in my library (with your copyrights, of course)? If it is faster and correct, why should I reinvent the wheel?)
Thank you, I have to fix my code also when exact is true, as I misunderstood this parameter. English documentation for iBarShift is wrong.
The mql5 bug is on Bars() function, I reported it to Service Desk.
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Вы принимаете политику сайта и условия использования
iBarShift:
Многие ищут функцию iBarShift, которая была в языке MQL4 (например, 1,2,3).
В языке MQL5 ее нет, но есть все возможности для ее реализации в виде библиотеки. В качестве альтернативы многие программисты предложили свои варианты реализации этой функции на MQL5.
Я нашел 4 различных версии от circlesquares, komposter (из Codebase), dc2008 (из статьи "Переход с MQL4 на MQL5") и marketeer.
Обнаружилось, что все 4 версии содержат ошибки (не воспроизводят в точности работу функции iBarShift() языка MQL4). В частности, при указании в функции времени бара, время открытия полученного бара не соответствует искомому.
Я решил провести тесты точности и скорости работы различных вариантов реализации, и разработать свою версию. Библиотека и небольшой скрипт для тестирования производительности функций прилагается.
Автор: Alain Verleyen