MT5 To AmiBroker data scripts

Hi all,

here are few scripts to get data from MetaTrader 5 into Amibroker. There is no documentation yet, but code is very simple, so if anyone would like to use it then go ahead.

More feature will be added later, including trading interface.


I am looking for MT4 to AB, please help. Thanks.


clone the sources then compile them under MT4. MT4 is compatible with MQL5 nowadays.

do you have the manual please...

There is no manual yet, but it should works out of the box. All you need to do is to change path to CSV file in AFL script.

I've started to write a draft of documentation. MT5 is a good source of free real-time futures data, also API for MT5 is much easier to code than for other Web API, so next step is to create trading interface AmiBroker > MT5.

I used it. But there is a problem with it. It is only downloading data till 18.15? Do you have possible reason to explain this?

What are the steps (in order) you are using to execute these files ?


current settings importing 1 minute bars, so history can be shorter or longer depends on a broker. Custom period can be set in scanCustom function.

Hope that helps.

There is one plugin for MT4. I didnt test it myself.
Link here

Thank you for sending me this link. Really appreaciate it.

hai...its a fine work.....,however while I am trying to implement the AFL in is unable to retrieve the data from the mt5 there any issue wid the data format(the file has been set to .csv format), also the indicator exports the present candle data to the last cell in the excel file bcz of which the data format may be creating an issuee( as I found while manually importing the data from the csv file),.....pls do guide to sort it out....and may I know abt the release of the amibroker trading interface.

Hello, Did anyone succeed to import the candles to Amibroker? I see that MT5 correctly writes intraday_data.txt. But afl as indicator doesnt read it properrly! Did anyone complete it?

To create a trading interface Amibroker to MT5 is a great idea.
Even better if compatible with MT4.

It can be done using txt/csv files but a more elegante solution would be welcome.

How is this project going?

I do not trade FX but I intend to. Some of the methods I use in futures would also work on FX, as backtested.

To code in AFL, backtest and WalkForward in Amibroker and use MT4/5 just to send the orders would be great.

I will learn MQL5 and 4 if I have to, but I prefer not if I am able to send the orders using AB. It does everything I need and it excels.

More and more brokers are using MT5, so it will be possible to trade stocks, futures and forex using AB+MT4/5.

I also believe that it would increase de number of AB users.

Hi jawakow

I know that this is an old thread and you may not be visitng here but i wanted to retrieve data from MT4 to Amibroker and had a look at your code.

I tried to compile your MT5 on MT4 which gave some minor errors - the download file only lists one price (whichever currency you copy on MT4 but on the intraday text file it lists all currencies) ?

How do you run the AFL import file with the JS script ?

Any advise ?


Long time gone since my last post. Just to let you know that I am developing DLL for MT4/5, so JS and AFL code won't be necessary. Will keep posting about progress.


Hi Jawakow

Thanks for the update

Will backfill be available ?


1 Like

If I could help in anyway, please let me know.

I was pretty active some years ago, when we used a yahoo mailing list instead of this forum. Long time coding AFLs.