GetLastError() — функция, возвращающая коды ошибок. Кодовые константы ошибок определены
в файле stderror.mqh. Для вывода текстовых сообщений следует использовать функцию
ErrorDescription(), определенную в файле stdlib.mqh.
Константа | Значение | Описание |
---|---|---|
ERR_NO_ERROR | 0 | Нет ошибки |
ERR_NO_RESULT | 1 | Нет ошибки, но результат неизвестен |
ERR_COMMON_ERROR | 2 | Общая ошибка |
ERR_INVALID_TRADE_PARAMETERS | 3 | Неправильные параметры |
ERR_SERVER_BUSY | 4 | Торговый сервер занят |
ERR_OLD_VERSION | 5 | Старая версия клиентского терминала |
ERR_NO_CONNECTION | 6 | Нет связи с торговым сервером |
ERR_NOT_ENOUGH_RIGHTS | 7 | Недостаточно прав |
ERR_TOO_FREQUENT_REQUESTS | 8 | Слишком частые запросы |
ERR_MALFUNCTIONAL_TRADE | 9 | Недопустимая операция нарушающая функционирование сервера |
ERR_ACCOUNT_DISABLED | 64 | Счет заблокирован |
ERR_INVALID_ACCOUNT | 65 | Неправильный номер счета |
ERR_TRADE_TIMEOUT | 128 | Истек срок ожидания совершения сделки |
ERR_INVALID_PRICE | 129 | Неправильная цена |
ERR_INVALID_STOPS | 130 | Неправильные стопы |
ERR_INVALID_TRADE_VOLUME | 131 | Неправильный объем |
ERR_MARKET_CLOSED | 132 | Рынок закрыт |
ERR_TRADE_DISABLED | 133 | Торговля запрещена |
ERR_NOT_ENOUGH_MONEY | 134 | Недостаточно денег для совершения операции |
ERR_PRICE_CHANGED | 135 | Цена изменилась |
ERR_OFF_QUOTES | 136 | Нет цен |
ERR_BROKER_BUSY | 137 | Брокер занят |
ERR_REQUOTE | 138 | Новые цены |
ERR_ORDER_LOCKED | 139 | Ордер заблокирован и уже обрабатывается |
ERR_LONG_POSITIONS_ONLY_ALLOWED | 140 | Разрешена только покупка |
ERR_TOO_MANY_REQUESTS | 141 | Слишком много запросов |
ERR_TRADE_MODIFY_DENIED | 145 | Модификация запрещена, так как ордер слишком близок к рынку |
ERR_TRADE_CONTEXT_BUSY | 146 | Подсистема торговли занята |
ERR_TRADE_EXPIRATION_DENIED | 147 | Использование даты истечения ордера запрещено брокером |
ERR_TRADE_TOO_MANY_ORDERS | 148 | Количество открытых и отложенных ордеров достигло предела, установленного брокером. |
Константа | Значение | Описание |
---|---|---|
ERR_NO_MQLERROR | 4000 | Нет ошибки |
ERR_WRONG_FUNCTION_POINTER | 4001 | Неправильный указатель функции |
ERR_ARRAY_INDEX_OUT_OF_RANGE | 4002 | Индекс массива — вне диапазона |
ERR_NO_MEMORY_FOR_FUNCTION_CALL_STACK | 4003 | Нет памяти для стека функций |
ERR_RECURSIVE_STACK_OVERFLOW | 4004 | Переполнение стека после рекурсивного вызова |
ERR_NOT_ENOUGH_STACK_FOR_PARAMETER | 4005 | На стеке нет памяти для передачи параметров |
ERR_NO_MEMORY_FOR_PARAMETER_STRING | 4006 | Нет памяти для строкового параметра |
ERR_NO_MEMORY_FOR_TEMP_STRING | 4007 | Нет памяти для временной строки |
ERR_NOT_INITIALIZED_STRING | 4008 | Неинициализированная строка |
ERR_NOT_INITIALIZED_ARRAYSTRING | 4009 | Неинициализированная строка в массиве |
ERR_NO_MEMORY_FOR_ARRAYSTRING | 4010 | Нет памяти для строкового массива |
ERR_TOO_LONG_STRING | 4011 | Слишком длинная строка |
ERR_REMAINDER_FROM_ZERO_DIVIDE | 4012 | Остаток от деления на ноль |
ERR_ZERO_DIVIDE | 4013 | Деление на ноль |
ERR_UNKNOWN_COMMAND | 4014 | Неизвестная команда |
ERR_WRONG_JUMP | 4015 | Неправильный переход |
ERR_NOT_INITIALIZED_ARRAY | 4016 | Неинициализированный массив |
ERR_DLL_CALLS_NOT_ALLOWED | 4017 | Вызовы DLL не разрешены |
ERR_CANNOT_LOAD_LIBRARY | 4018 | Невозможно загрузить библиотеку |
ERR_CANNOT_CALL_FUNCTION | 4019 | Невозможно вызвать функцию |
ERR_EXTERNAL_EXPERT_CALLS_NOT_ALLOWED | 4020 | Вызовы внешних библиотечных функций не разрешены |
ERR_NOT_ENOUGH_MEMORY_FOR_RETURNED_STRING | 4021 | Недостаточно памяти для строки, возвращаемой из функции |
ERR_SYSTEM_BUSY | 4022 | Система занята |
ERR_INVALID_FUNCTION_PARAMETERS_COUNT | 4050 | Неправильное количество параметров функции |
ERR_INVALID_FUNCTION_PARAMETER_VALUE | 4051 | Недопустимое значение параметра функции |
ERR_STRING_FUNCTION_INTERNAL_ERROR | 4052 | Внутренняя ошибка строковой функции |
ERR_SOME_ARRAY_ERROR | 4053 | Ошибка массива |
ERR_INCORRECT_SERIES_ARRAY_USING | 4054 | Неправильное использование массива-таймсерии |
ERR_CUSTOM_INDICATOR_ERROR | 4055 | Ошибка пользовательского индикатора |
ERR_INCOMPATIBLE_ARRAYS | 4056 | Массивы несовместимы |
ERR_GLOBAL_VARIABLES_PROCESSING_ERROR | 4057 | Ошибка обработки глобальныех переменных |
ERR_GLOBAL_VARIABLE_NOT_FOUND | 4058 | Глобальная переменная не обнаружена |
ERR_FUNCTION_NOT_ALLOWED_IN_TESTING_MODE | 4059 | Функция не разрешена в тестовом режиме |
ERR_FUNCTION_NOT_CONFIRMED | 4060 | Функция не подтверждена |
ERR_SEND_MAIL_ERROR | 4061 | Ошибка отправки почты |
ERR_STRING_PARAMETER_EXPECTED | 4062 | Ожидается параметр типа string |
ERR_INTEGER_PARAMETER_EXPECTED | 4063 | Ожидается параметр типа integer |
ERR_DOUBLE_PARAMETER_EXPECTED | 4064 | Ожидается параметр типа double |
ERR_ARRAY_AS_PARAMETER_EXPECTED | 4065 | В качестве параметра ожидается массив |
ERR_HISTORY_WILL_UPDATED | 4066 | Запрошенные исторические данные в состоянии обновления |
ERR_TRADE_ERROR | 4067 | Ошибка при выполнении торговой операции |
ERR_END_OF_FILE | 4099 | Конец файла |
ERR_SOME_FILE_ERROR | 4100 | Ошибка при работе с файлом |
ERR_WRONG_FILE_NAME | 4101 | Неправильное имя файла |
ERR_TOO_MANY_OPENED_FILES | 4102 | Слишком много открытых файлов |
ERR_CANNOT_OPEN_FILE | 4103 | Невозможно открыть файл |
ERR_INCOMPATIBLE_ACCESS_TO_FILE | 4104 | Несовместимый режим доступа к файлу |
ERR_NO_ORDER_SELECTED | 4105 | Ни один ордер не выбран |
ERR_UNKNOWN_SYMBOL | 4106 | Неизвестный символ |
ERR_INVALID_PRICE_PARAM | 4107 | Неправильный параметр цены для торговой функции |
ERR_INVALID_TICKET | 4108 | Неверный номер тикета |
ERR_TRADE_NOT_ALLOWED | 4109 | Торговля не разрешена |
ERR_LONGS_NOT_ALLOWED | 4110 | Длинные позиции не разрешены |
ERR_SHORTS_NOT_ALLOWED | 4111 | Короткие позиции не разрешены |
ERR_OBJECT_ALREADY_EXISTS | 4200 | Объект уже существует |
ERR_UNKNOWN_OBJECT_PROPERTY | 4201 | Запрошено неизвестное свойство объекта |
ERR_OBJECT_DOES_NOT_EXIST | 4202 | Объект не существует |
ERR_UNKNOWN_OBJECT_TYPE | 4203 | Неизвестный тип объекта |
ERR_NO_OBJECT_NAME | 4204 | Нет имени объекта |
ERR_OBJECT_COORDINATES_ERROR | 4205 | Ошибка координат объекта |
ERR_NO_SPECIFIED_SUBWINDOW | 4206 | Не найдено указанное подокно |
ERR_SOME_OBJECT_ERROR | 4207 | Ошибка при работе с объектом |
Error 4109 — Trade Is Not Allowed — is a very common error when working with expert advisors in MetaTrader 4. The error is, more often than not, the result of one setting value in the MT4 options and can be easily fixed in this case.
What Is Error 4109 — Trade Is Not Allowed?
Error 4109, or translated into English, Trade Is Not Allowed, is the error code MetaTrader 4 gives when an expert advisor is not allowed to trade.
When you load an expert advisor (EA) onto your chart, and it tries to submit orders automatically, MT4 checks if the operation is allowed.
The operations are related to the functions to submit, modify, close, and delete orders: OrderSend()
, OrderModify()
, OrderClose()
, and OrderDelete()
.
If the option is disabled, then the EA cannot submit orders or do perform any other trading actions, and the error 4109 gets triggered.
Error 4109 is just one of the many error codes in MetaTrader, for which «Trade is not allowed» is the corresponding translation.
You can find the full list of error codes on the official website for MQL4 language.
Why Trade Is Not Allowed?
This is a security measure to prevent automated trading.
Automated trading can be risky, so MT4 has options to completely disable it.
In rare cases, this might be due to the broker disabling trading for specific trading accounts or account types.
How to Check If Trading Is Allowed?
When you load an expert advisor you can easily see if MetaTrader allows automated trading or not.
Next to the name of the expert advisor, you can see a face. If the face is sad, it means that the EA cannot trade.
In this case, if the EA tries to submit any order it will receive the error 4109 «Trade Is Not Allowed» response from the server.
You can also check for this error in the Experts tab of the Terminal panel.
How to Fix Error 4109?
Fixing Error 4109 — Trade Is Not Allowed — is very simple and only requires to change two options.
Firstly, enable Allow automated trading in the MT4 Options under the Expert Advisors tab.
Once this is done, you need to check in the EA’s properties whether the Allow live trading checkbox is enabled or not.
When the two options above are properly enabled, the result is the smiling face next to the EA name on the chart.
Hopefully, now your EA will be able to submit, update, close, and delete orders automatically.
In case your broker doesn’t allow EA trading, you will continue receiving error 4109 when your expert advisors attempts any trading operation. Unfortunately, this cannot be solved using options available in MetaTrader platform — you would need to contact your broker about this issue.
Conclusion
Error 4109 is a common error when using expert advisors in MT4 and it means that «Trade is not allowed». Basically, the EA cannot submit orders or make any changes to orders.
To fix this error, you need to enable automated trading in the MT4 options and enable live trading in the EA’s properties.
- Error 1: Common Error
- Error 2: Wrong Username and Password
- Error 3: Waiting for Update
- Error 4: Error 4109
- Error 5: Not Enough Rights
- Error 6: Not Enough Money Error
- Error 7: Write Error
- Error 8: Trading Context is Busy
- Error 9: Re-quote
- Error 10: Invalid Trade Parameters
- Error 11: Trade Modify Denied
- Error 12: Off Quote Message
- Error 13: Invalid Account Error Message
With the execution of trades at the tick of the clock, it could be frustrating to get stuck with an error on your MetaTrader 4 platform.
In case you have encountered errors while using the MetaTrader platform, I will show you the 13 most common errors on the MT4 platform and what to do when you see them.
Let’s get to these common errors on MT4…
Common MetaTrader 4 Errors
Error 1: Common Error
What is a Common Error on MetaTrader (MT4)?
“Common error” appearing on MetaTrader 4 indicates that the internet connection is not available or is very slow.
This is because MetaTrader 4 requires a very strong internet connection to work.
How to Fix Common Error on MT4
Take the following steps if you encounter a common error:
• Close all charts that appear frozen or seem to be loading
• Proceed to reboot your PC
• Check the connection signal and make sure your ISP source is fully functional. (If you are using a modem you may restart the modem application, if you are using a router you may switch it off and back on for about two minutes.
• Check if you are on the right server type, for example, you should only try to login into a DEMO account on a DEMO server, and also try to log into a LIVE account on a LIVE server.
• Rescan your connection servers by clicking on the right-hand side of the screen.
If you are still encountering issues, perhaps you may consider reaching out to your broker.
SEE ALSO: How Much Does an MT4 Server License Cost?
SEE ALSO: How to Install MT4 on VPS – Fast and Easy Guide
SEE ALSO: 5 Best Scalping Forex Robots for MT4
Error 2: Wrong Username and Password
In case where the login details are incorrect, the MetaTrader 4 may not load.
In this situation, it is pertinent to check your login details and confirm if the details are correctly inputted. You may also check the server IP address is wrong.
Rescan servers
• You can rescan your servers by clicking on the left click button of your mouse.
• After running the re-scan, MT4 will look for the best service available to connect to.
• Restart your MT4
Error 3: Waiting for Update
If this message is displayed when you are trying to open your MT4 for the first time, it means the chart is pulling data.
How To Fix Waiting for Update Error on MT4
• Right-click on the chart.
• From the dialogue box that appears, click on refresh.
• Click on your currency pair of choice and drag it and drop it on the chart screen.
• Proceed to restart your MetaTrader software.
Error 4: Error 4109
This is an error seen when working with expert advisors. Error 4109 blocks the expert advisor from trading.
It is a security measure to prevent automated trading. Sometimes it may be due to the broker disabling it.
When you load an expert advisor, you can see if automated trading is allowed or not.
Right beside the expert advisor, is a face. If the face is a sad one it means the expert advisor cannot trade.
How to Fix Error 4109
• First of all, enable allow automated trading in the MT4 options under the expert advisors tab.
• Check in the EA’s properties whether you have enabled live trading by checking the allow live trading checkbox.
Your trading platform should support EA trading for this to work. If you experience further issues, reach out to your broker.
Error 5: Not Enough Rights
This means you do not have the right to trade under the current account.
How to Fix Not Enough Rights on MT4
• Make sure you are logged into your trading account with the master password and not the investor password.
• You can also check if you are trading on the right account e.g. trading on a live account and not on a demo account.
SEE ALSO: 8 Best ECN Forex Brokers
SEE ALSO: Best Way To Backtest On MT4 Using Strategy Tester
SEE ALSO: Advantages and Disadvantages of Using Forex Robots
Error 6: Not Enough Money Error
The “Not Enough Money” error is seen when a trader is trying to place a trade in an account that is not well funded to execute a margin trade.
That means the available margin is not enough for the required margin to place a new trade.
How to Fix Not Enough Money Error
• Deposit or add more money into your trading account.
• You may also consider increasing the leverage in the metetrader4 account. For example, if you intend to trade the USD/JPY pair on the mini lot 0.1. Your leverage is 1:100. USD/JPY is 1.6. You would need to have more than $160 to open a new position.
Error 7: Write Error
This error is usually observed among users who have newly upgraded their computer from windows 7 to a higher version.
It may be caused by full computer storage.
It may also be because folder permission does not allow writing.
How to Fix Write Error
• Free up space on your computer to increase storage capacity.
• Copy an older version of metaeditor.exe from an older version of windows onto your computer.
Error 8: Trading Context is Busy
This error occurs when the trading server receives multiple requests for the same order as a result of multiple or repeated instructions.
For example, when you click multiple times on a Buy or Sell button or you have an expert advisor that attempts to enter the same trade multiple times, your broker will see this as an error and will delay or reject the orders.
This error may also occur if there are too many instructions such that MT4 cannot handle these commands at the same time.
How to Fix Trading Context is Busy
• A simple restart of the MetaTrader platform should ease off the system and clear this error.
• You may split the strategies into multiple MT4 platforms.
Error 9: Re-quote
This is caused by high volatility in the market causing a rapid change in price
Which makes your broker offer a new market price closest to your initial price.
This error can also be caused by poor internet connection, which may delay your order from being transmitted which means that the price you may be viewing is old prices.
A re-quote from your broker is asking you to adjust your quoted price in line with new prices.
How to Fix Requote Errors
• Trade major currency pairs with large liquidity to avoid encountering this error.
• Check your internet connection or upgrade if necessary.
SEE ALSO:
Error 10: Invalid Trade Parameters
This may occur when trying to close a position that has already been closed before-this may be due to poor internet connection.
This error is also seen when a wrong lot size is an input.
How to Fix Invalid Trade Parameters
• Ensure your connection to the internet with your ISP is perfect.
• Use the appropriate lot size with your account type.
Error 11: Trade Modify Denied
This may occur when the stop-loss or take-profit order is placed too close to the current market price.
It may also mean that the orders were placed at the wrong points for the trade.
For example, if you place a sell order on the pair USD/JPY for $1.06 and a take profit order of $1.08 and a stop-loss order of $1.04
How to Fix Trade Modify Denied
Adjust your take-profit/and stop-loss order accordingly.
Error 12: Off Quote Message
This will happen when you try to close a position that has already be closed on another device on the same trading account.
How to Fix
In this case, you need not take any action. The system will ignore your command in an already closed position.
Error 13: Invalid Account Error Message
This can be caused by selecting the wrong server for your account. Another reason could be that your demo account is already expired.
How to Fix
In this case, you need to recreate a demo account or open a live account with a Forex broker of choice.
SEE ALSO: 5 Tips for Choosing a Reputable Forex Broker
SEE ALSO: How To Boost Your Account With Margin Trading
SEE ALSO: How to Apply Margin and Leverage like a Pro
Image credit: Design vector created by freepik – www.freepik.com
The GetLastError() function returns the last error code. The Error code constants are defined in the stderror.mqh file.
To print text messages use the ErrorDescription() function defined in the stdlib.mqh file.
Constant
Value
Description
Step 1 – Solve Mt4 Error Code 4109
Is Mt4 Error Code 4109 appearing? Would you like to safely and quickly eliminate Mt4 Error Code which additionally can lead to a blue screen of death?
When you manually edit your Windows Registry trying to take away the invalid mql4 error 134 keys you’re taking a authentic chance. Unless you’ve got been adequately trained and experienced you’re in danger of disabling your computer system from working at all. You could bring about irreversible injury to your whole operating system. As very little as just 1 misplaced comma can preserve your Pc from even booting every one of the way by!
Troubleshooting mql4 ordermodify error 4051 Windows XP, Vista, 7, 8 & 10
Simply because this chance is so higher, we hugely suggest that you make use of a trusted registry cleaner plan like CCleaner (Microsoft Gold Partner Licensed). This system will scan and then fix any Mt4 Error Code 4109 complications.
Registry cleaners automate the entire procedure of finding invalid registry entries and missing file references (including the 4109 error) likewise as any broken hyperlinks inside of your registry.
Issue with metatrader error 4109
Backups are made immediately prior to each and every scan providing you with the choice of undoing any changes with just one click. This protects you against doable damaging your pc. Another advantage to these registry cleaners is that repaired registry errors will strengthen the speed and performance of one’s procedure drastically.
- https://www.mql5.com/en/forum/45317
- https://fxtrade.oanda.com/community/forex-forum/post/9873583/
- https://www.ea-coder.com/expert-advisor-error-message-codes-on-chart/
- http://www.fxfisherman.com/forums/forex-metatrader/system-coding/1687-error-code-4109-a.html
Cautionary Note: Yet again, for those who are not an state-of-the-art consumer it’s very encouraged that you simply refrain from editing your Windows Registry manually. If you make even the smallest error within the Registry Editor it can result in you some serious issues that may even call for a brand new set up of Windows. Not all difficulties attributable to incorrect Registry Editor use are solvable.
Fixed:
Symptoms of Mt4 Error Code 4109
“Mt4 Error Code 4109” appears and crashes the energetic method window.
Your Personal computer routinely crashes with Mt4 Error Code 4109 when running the exact same system.
“Mt4 Error Code 4109” is shown.
Windows operates sluggishly and responds little by little to mouse or keyboard input.
Your computer periodically “freezes” for the number of seconds in a time.
Will cause of Mt4 Error Code 4109
Corrupt obtain or incomplete set up of Windows Operating System software program.
Corruption in Windows registry from a new Windows Operating System-related application adjust (install or uninstall).
Virus or malware infection which has corrupted Windows method documents or Windows Operating System-related application data files.
Another method maliciously or mistakenly deleted Windows Operating System-related files.
Mistakes this sort of as “Mt4 Error Code 4109” can be brought about by several different elements, so it really is important that you troubleshoot every of the achievable brings about to forestall it from recurring.
Simply click the beginning button.
Variety “command” inside the lookup box… Will not hit ENTER nonetheless!
Although keeping CTRL-Shift in your keyboard, hit ENTER.
You’re going to be prompted that has a authorization dialog box.
Click on Of course.
A black box will open having a blinking cursor.
Variety “regedit” and hit ENTER.
Within the Registry Editor, choose the mql4 error 134 connected key (eg. Windows Operating System) you wish to back again up.
Within the File menu, choose Export.
Inside the Preserve In list, pick out the folder in which you wish to save the Windows Operating System backup key.
Inside the File Title box, sort a reputation for the backup file, these types of as “Windows Operating System Backup”.
From the Export Vary box, ensure that “Selected branch” is selected.
Click on Help you save.
The file is then saved by using a .reg file extension.
You now use a backup within your mql4 ordermodify error 4051 related registry entry.
Solution to your problem
There are actually some manual registry editing measures that can not be talked about in this article due to the high chance involved for your laptop or computer method. If you want to understand more then check out the links below.
Additional Measures:
One. Conduct a Thorough Malware Scan
There’s a probability the Error 4109 Code Mt4 error is relevant to some variety of walware infection. These infections are malicious and ready to corrupt or damage and possibly even delete your ActiveX Control Error files. Also, it’s attainable that your Mt4 Error Code 4109 is actually connected to some element of that malicious plan itself.
2. Clean Disk Cleanup
The a lot more you employ your computer the extra it accumulates junk files. This comes from surfing, downloading packages, and any sort of usual computer system use. When you don’t clean the junk out occasionally and keep your program clean, it could turn into clogged and respond slowly. That is when you can encounter an 4109 error because of possible conflicts or from overloading your hard drive.
Once you clean up these types of files using Disk Cleanup it could not just remedy Mt4 Error Code 4109, but could also create a dramatic change in the computer’s efficiency.
Tip: While ‘Disk Cleanup’ is definitely an excellent built-in tool, it even now will not completely clean up Mt4 Error discovered on your PC. There are numerous programs like Chrome, Firefox, Microsoft Office and more, that cannot be cleaned with ‘Disk Cleanup’.
Since the Disk Cleanup on Windows has its shortcomings it is extremely encouraged that you use a specialized sort of challenging drive cleanup and privacy safety application like CCleaner. This system can clean up your full pc. If you run this plan after each day (it could be set up to run instantly) you are able to be assured that your Pc is generally clean, often operating speedy, and always absolutely free of any 4109 error associated with your temporary files.
How Disk Cleanup can help
1. Click your ‘Start’ Button.
2. Style ‘Command’ into your search box. (no ‘enter’ yet)
3. When holding down in your ‘CTRL-SHIFT’ important go ahead and hit ‘Enter’.
4. You will see a ‘permission dialogue’ box.
5. Click ‘Yes’
6. You will see a black box open up plus a blinking cursor.
7. Variety in ‘cleanmgr’. Hit ‘Enter’.
8. Now Disk Cleanup will start calculating the amount of occupied disk space you will be able to reclaim.
9. Now a ‘Disk Cleanup dialogue box’ seems. There will be a series of checkboxes for you personally to pick. Generally it will likely be the ‘Temporary Files’ that consider up the vast majority of your disk area.
10. Verify the boxes that you want cleaned. Click ‘OK’.
How to repair
3. System Restore can also be a worthwhile device if you ever get stuck and just desire to get back to a time when your computer system was working ideal. It will work without affecting your pics, paperwork, or other crucial information. You can discover this option with your User interface.
Mt4 Error
Manufacturer
Device
Operating System
Mt4 Error Code 4109
4 out of
5
based on
22 ratings.