моя ea выдает ошибку 4756
не могли бы вы мне помочь, спасибо
- www.mql5.com
CopyHigh(_Symbol,_Period,TimeCurrent(),5,hg);
Top = NormalizeDouble(rates[ArrayMaximum(hg,0,WHOLE_ARRAY)].high,_Digits);
- неправильная конструкция.
Выберите одно из значений максимального двойника и используйте его вместо целочисленного индекса
моя ea выдает ошибку 4756
не могли бы вы мне помочь, спасибо
Ошибка 4756 - это "Не удалось отправить торговый запрос". Если у вас ошибка при отправке ордера, проверьте код возврата MqlTradeResult.
//--- send order OrderSend(mrequest,mresult); // get the result code if(mresult.retcode==10009 || mresult.retcode==10008) //Request is completed or order placed { Alert("An order has been successfully placed with Ticket#:",mresult.order,"!!"); } else { Alert("The order request could not be completed -error:",GetLastError()," with trade return code ",mresult.retcode); ResetLastError(); return; }
По словамКонстантина83выше, у вас ошибка недействительного стопа, что означает, что вы должны разместить отложенный ордер за пределамиSymbolInfoIntegerSYMBOL_TRADE_STOPS_LEVEL иSYMBOL_TRADE_FREEZE_LEVEL.
Ошибка 4756 - это "Не удалось отправить торговый запрос". Если у вас возникла ошибка при отправке ордера, проверьте код возврата MqlTradeResult.
По словамКонстантина83выше, у вас ошибка invalid stop, что означает, что вы должны разместить отложенный ордер за пределамиSymbolInfoIntegerSYMBOL_TRADE_STOPS_LEVEL иSYMBOL_TRADE_FREEZE_LEVEL.
Возвращаются ли недействительные стопы для брокера типа ECN?
Конечно, вы знаете, что ответ - нет. Но зачем вы это спрашиваете?
- www.mql5.com
Почему вы предполагаете, что я знаю ответ "нет"? Недействительные стопы(ошибка 130) возвращаются на mql4, когда SL или TP отправляются с помощью OrderSend() к ECN брокеру, поэтому я спросил, верно ли то же самое на mql5. Какая ошибка возвращается?
Правда? Это интересно. Я должен проверить это позже ;D.
Я немного поизучал mql5. Если поведение тестера стратегий похоже на то, что возвращает брокер, то похоже, что SL и TP игнорируются при отправке для символа, чейENUM_SYMBOL_TRADE_EXECUTION-Exchange execution илиMarket execution, и ошибка не возвращается. Так что все совсем по-другому по сравнению с mql4.
У меня есть простой советник, который размещает сделку с SL и TP, если только символ не является биржевым или рыночным исполнением, тогда он отправляет сделку с неустановленными SL и TP, а затем отправляет второй запрос (TRADE_ACTION_SLTP), чтобы установить SL и TP.
Это отлично работает в тестере стратегий, поэтому сегодня я попробовал это на демо-счете и продолжал получать Invalid Stops (ошибка 10016). Поэтому я проверил Stops Level и Freeze Level, они оба равны 0, я попробовал различные уровни SL и TP, ничего не сработало. Я мог вручную установить те же SL и TP для существующей позиции без каких-либо проблем ... поэтому я добавил тест, чтобы установить SL и TP только если позиция может быть выбрана ... и больше никаких недействительных стопов, никакого торгового запроса TRADE_ACTION_SLTP тоже :-(.
Поэтому я добавил этот код между завершением первоначального торгового запроса, отправленного без TP и SL, и последующим торговым запросом, который отправляет TP и SL ... .
SelectRetryCount = 1; if(SetTPandSL) { while(!PositionSelect(_Symbol) && SelectRetryCount < 10) { Sleep(SelectRetryCount * 100); // sleep for SelectRetryCount * 100 mS SelectRetryCount++; } }
SetTPandSL устанавливается true, если начальный торговый запрос успешен, нет смысла пытаться установить TP и SL, если это не так. Позиция выбирается, и если это не удается, происходит 100 мс сна, затем выбор повторяется, если это не удается, происходит 200 мс сна и т.д. до 9 попыток (всего 4.5 секунды).
Я еще не совсем понимаю, что я делаю с mql5, я просто пытаюсь заставить несколько вещей работать и надеюсь научиться по ходу дела... Является ли то, что я нашел здесь, нормальным поведением? Я бы подумал, что после того, как первоначальный торговый запрос вернул 10009 - TRADE_RETCODE_DONE, я могу отправить запрос на установку TP и SL, так ли это? Кто-нибудь знает?
У меня есть простой советник, который размещает сделку с SL и TP, если только символ не является биржевым или рыночным исполнением, тогда он отправляет сделку с неустановленными SL и TP, а затем отправляет второй запрос (TRADE_ACTION_SLTP), чтобы установить SL и TP.
Это отлично работает в тестере стратегий, поэтому сегодня я попробовал это на демо-счете и продолжал получать Invalid Stops (ошибка 10016). Поэтому я проверил Stops Level и Freeze Level, они оба равны 0, я попробовал различные уровни SL и TP, ничего не сработало. Я мог вручную установить те же SL и TP для существующей позиции без проблем ... поэтому я добавил тест, чтобы установить SL и TP только если позиция может быть выбрана ... и больше никаких недействительных стопов, никакого торгового запроса TRADE_ACTION_SLTP тоже :-(.
Поэтому я добавил этот код между завершением первоначального торгового запроса, отправленного без TP и SL, и последующим торговым запросом, который отправляет TP и SL ... .
SetTPandSL устанавливается true, если начальный торговый запрос успешен, нет смысла пытаться установить TP и SL, если это не так. Позиция выбирается, и если это не удается, происходит 100 мс сна, затем выбор повторяется, если это не удается, происходит 200 мс сна и т.д. до 9 попыток (всего 4.5 секунды).
Я еще не совсем понимаю, что я делаю с mql5, я просто пытаюсь заставить несколько вещей работать и надеюсь научиться по ходу дела... Является ли то, что я нашел здесь, нормальным поведением? Я бы подумал, что после того, как первоначальный торговый запрос вернул 10009 - TRADE_RETCODE_DONE, я могу отправить запрос на установку TP и SL, так ли это? Кто-нибудь знает?
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Вы принимаете политику сайта и условия использования
мой ea делает ошибку 4756
можешь мне помочь спасибо