# MetaTrader 4 runtime error code: ERR_FILE_NOT_BIN (5011)

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/errors/mt4/5011-err-file-not-bin, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

The error, as text you can copy:

```
ERR_FILE_NOT_BIN
```

- Code number: `5011`
- Kind: Runtime error code
- Where you meet it: Raised inside the platform's own language
- API: [MetaTrader 4 (MQL4)](https://openbrokerapi.com/platforms/metatrader-4)
- Status: verified. Source: [docs.mql4.com](https://docs.mql4.com/constants/errorswarnings/errorcodes), checked 2026-10-09.

## What does ERR_FILE_NOT_BIN (5011) mean on the MetaTrader 4 API?

"File must be opened with FILE_BIN flag" is MetaQuotes' whole description of this code. It is an MQL4 runtime error code, returned by GetLastError().

## How do I fix ERR_FILE_NOT_BIN (5011)?

Open the file with the FILE_BIN flag. The vendor's page gives no further remedy.

## More on the MetaTrader 4 API

- [All MetaTrader 4 API error codes](https://openbrokerapi.com/errors/mt4)
- [MetaTrader 4 API error codes](https://openbrokerapi.com/errors/mt4): 161 decoded, each with what it means, and the fix where the source gives one.
- [MetaTrader 4 functions](https://openbrokerapi.com/platforms/metatrader-4/functions): 28 documented, each with its signature, arguments, return value and source.
- [MetaTrader 4 API page](https://openbrokerapi.com/platforms/metatrader-4): The full record: access, authentication, limits and the source for each.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: MetaTrader 4 runtime error code: ERR_FILE_NOT_BIN (5011). Broker API Hub, https://openbrokerapi.com/errors/mt4/5011-err-file-not-bin, newest check 2026-10-09.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
