Forex Blog

This blog offers fundamental analysis, technical analysis and various currency trading information.

Archives

Metatrader Expert Advisors — User’s Tutorial

July 11, 2007 (Last updated on February 6, 2014) by Andriy Moraru

Using Metatrader expert advisors is simple, but sometimes people get confused with it and after downloading a file with the expert advisor a user might get stuck with it without knowing what to do next. This a simple tutorial on how to attach an expert advisor to Metatrader 4 char and activate it.

1. Download your MT4 expert advisor or copy it and save it to your MetaTrader’s ‘Experts’ folder. It can be found at the following location:

C:\Users\<User_account_name>\AppData\Roaming\MetaQuotes\Terminal\<Instance_id>\MQL4\

Saving MetaTrader 4 Expert Advisor

2. Double click it with your mouse and it will be opened in MQL editor (this editor comes with MT4). There will be a button ‘Compile’ at the center top of the window. Click it and your expert advisor will be compiled and ready to use. There might be some errors or warnings during the compilation, but in most cases there shouldn’t be any. You can try and fix those errors, but it takes time and some programming skills, usually.

Compiling MetaTrader 4 Expert Advisor

3. Now, all you need to do is add your expert advisor to the preferred chart and activate it. You can also change some input parameters for the advisor in the Inputs tab:

Adding MetaTrader 4 Expert Advisor

That’s it! Now you can enjoy your expert advisor — its signals or its trading (if it is designed to perform trading). Good luck with them!

Update 2014-02-06: Updated directory information relevant for MT4 Build 600.

133 Responses to “Metatrader Expert Advisors — User’s Tutorial”

  1. Andrei

    If you don’t allow EA to trade when attaching it, it will not perform any trading, but will signal for a trade.
    As for the second question – no, I don’t host EAs for clients yet.

    Reply

  2. Isiaka

    Thank you so much for the EA installation tutorial. I find it usefull, I can now intall any EA to my MetaTrader Platform.

    May God continue to bless you amen.

    Please, I downloaded BINARIO EA, and you said it is only good for Manual Trading, my question now is, how can I trade with the Binario EA or any EA manually?

    Secondly, do you host EA for clients?

    I am waiting for your response to both questions.

    Thanks.
    Isiaka from Nigeria.

    Reply

    Carl Reply:

    This is a reliable and helpful tutorial. Thanks for sharing!

    Reply

  3. Hassan

    Thank you very much. Please, how do we set stop loss, trailing stop and take profit in using an EA like Moving Average and MACD? Thanks

    Reply

  4. Andrei

    Hassan, if EAs have input paramters that correspond to stop-loss, take-profit or trailing stop-loss then you can set them via these parameters (when you attach EA, or opening EA’s properties when it’s already attached). If it has no such parameters then you’ll need to modify EA’s code – and that’s different for each EA.

    Reply

    Kamoru Reply:

    Andrei,
    Where do I get EA’s propeties after I have attached it?

    Reply

    admin Reply:

    When you attach an EA there’s a prompt window. There’s an Inputs tab in this window.
    If you’ve already attached the EA and want to change the input parameters, you can right-click the chart, then choose Expert Advisors, then Properties.

    Reply

  5. Hassan

    Thanks, I attached Moving average to GBP USD H1. It gave me profit of 50 pips.(It executed ‘buy’ when MA cross upward), but when there was a reversal) downward, the long position was not closed to execute a short position. I realised that I would have to close the trade myself.

    But on the properties I saw lots, maximum risk, decrease factor, etc, but did not know which one to alter. Does it mean that the MA of metatrader 4 did not come with stops.

    Reply

  6. Andrei

    Hassan, yes that means that there is no way to add a stop-loss without modifying the code of this EA.

    Reply

  7. lucky

    Please, I am a novice trader who is emotionally inclined. I want to know if I should depend on Expert advisor to trade on my behalf rather than consistently making loss from my manual trading. i.e is the probability of my making positive returns from expert advisor higher than manual trading?

    Regards

    Reply

  8. Andrei

    lucky, trading with EA makes your results almost completely independent of yourself. So, if you are constantly losing from manual trading and can’t find a way to improve your skills, I’d recommend using the automated expert advisors.

    Reply

  9. lucky

    Hello, Mr Andrei,
    Why are my Expert advisors not executing trades? Is it because I shut down my computer system before they execute trades, despite that i allowed trading and enabled them.
    If experts are more than one can’t trade be executed?

    Reply

  10. Andrei

    lucky, some expert advisors trade very rarely. Maybe they didn’t met any position entry conditions yet.

    Reply

  11. Marie

    Hello. I have noticed the option for expert advisors on my platform, but Im not sure how to activate it?? Also, I was wondering if this is something you have to apply to each time frame and pair? Im confused. Would someone help me please? Thank you so much for your time.

    Reply

  12. Andrei

    Marie, if your platform is MetaTrader 4, then reread the whole tutorial. It describes in details how to activate expert advisors.
    Expert advisor is added to a chart. Each chart has only one currency pair and timeframe associated with it. So if you want to use EA on another pair/timeframe open another chart and add EA to it.

    Reply

  13. jatin

    hi, i am jatin . i just download ur all EA’s and put them into expert folders. but whenever i double click on it it shows a error of unknown file extension. how can i open EA with MQL to proceed to next step of compiling?
    thanx in advance

    Reply

  14. Andrei

    jatin, do you have MT4 properly installed? Your MQL Editor should automatically recognize .mq4 files and open them on double click. Alternatively, you can open Editor manually from MT4 (a yellow rhombus sign under the main menu) and then open your EAs from the Editor.

    Reply

  15. Kevin Tan

    Thank for sharing, this is very helpful for a novice like me!

    Reply

  16. ray

    Hi I am trying to code some indicators for my own use, but cannot find any guidance on the MT4 parameters required or how to access another time frame; can you help?

    Reply

  17. Andrei

    Ray, I can help, but you can also look into some other indicator’s .mq4 files and learn from the examples.

    Reply

  18. peter

    how can i code an EA so that it works in live a/c

    Reply

  19. Andrei

    Peter, any EA can work with live account.

    Reply

  20. onyeka

    Thanks for your effort, I am having a little problem, with the AMAZING EA that I downloaded, this news trading software requires that I input the exact hour of the news trading, I don’t know how to go about it, manually I use to change the forexfactory time to suit my Nigerian local time which is GMT+1, now how do I get the time of the news or do I will my manual method still of time still work, secondly what is one standard lot, 1.0, 0.1 or 0.01, how do I remove the EA from the chart if am done with the trading.
    Thanks
    Onyeka from Nigeria

    Reply

  21. Andrei

    Onyeka:

    1. You need to set the time depending on the news’ time and your MT4 server’s time. E.g. if the news come outs at 15:00 GMT and your server time is GMT+3, you have to set Hour to 18. It doesn’t matter what’s your local time is, only your MetaTrader server’s time matters.

    2. One standard lot (1 lot) is 100,000 units of trading volume (you have to use $1,000 margin to trade 1 standard lot with 1:100 leverage). 0.1 standard lot is 10,000 units of trading volume or mini lot – it requires $100 margin on 1:100 leverage. 0.01 is 1,000 units of trading volume or micro lot – it requires $10 margin on 1:100 leverage.

    3. To remove an expert advisor from a chart you have three options:
    a) Right click on the chart, select Advisors->Remove. It will remove your EA from the chart.
    b) Right click on the chart, select Advisors->Properties, General tab and remove the mark from “Allow advisor to trade”. It will disable trading for this EA.
    c) Click the Advisors icon button under the main menu. It will turn red and it will disable all advisors in the MetaTrader platform.

    Reply

    gerhard Reply:

    Hi Andrei.
    how do i install this MACD samle EA in to my remote server? i am unable to bring the EA over ? what must i do ???
    best regards. Gerhard

    Reply

    Andrei Reply:

    Do you mean VPS server or what? Just copy it to
    “experts” folder of your MetaTrader installation.

    Reply

  22. Louay

    Thank you very much. Please, how can add this Neural Networks to Moving Average

    http://www.arabictrader.com/vb/attachments/forum4/154889d1222450782-svm.zip

    Reply

  23. Andrei

    Louay, You want to add a Neutral Network to the Moving Average? I don’t know how’s that. Sounds really stupid to me.

    Reply

  24. onyeka

    sir, the Amazing EA refused to perform any action on the trade I attached it to, even after it showed me some figures on the chart like stop loss and take profit, which indicates that the EA is on, my brokers server time is G.M.T+ 2, and the news was to come out at 12.30 G.M.T, so I used the time 14.30, so what could have been wrong
    Onyeka from Nigeria

    Reply

  25. Andrei

    Onyeka, What did it output to Experts and Log tabs of your MT4? This post is not about AmazingEA, so, please, reply via http://www.earnforex.com/contact.php

    Reply

  26. Michel

    Hello,
    I placed my EA (mql4 file) into the experts folder, compiled it and it said 0 errors, but the executable file was not created, so I cannot run it.
    The same thing is happening when I try to run the period_converter for the M1 historical data. It says that it cannot open the period_converter.ex4… I checked the folder and that file does not exist, only the period_converter.mql4 exists and when I compile it it does not create the executable. Can you help me?

    Reply

  27. Andrei

    Michel,

    If you have more than one MT4 platform installed then it’s possible that you compile the files with the one, but try to run them with another MT4 instance.

    Reply

  28. zulkifli mohd noor

    Dear Expert advisor,

    I’ve installed my MA3 dan MA12 into my chart and i’ve also installed ma expert advisor. The system did take position automatically but it can’t close automatically when the price cross my MA3. Can you help me how to add into the program to make my position close when it cross my MA3.
    Thanks a lot bro.

    Reply

  29. Andrei

    Zulkifkli,

    That depends on what EA are you using.

    Reply

  30. zulkifli mohd noor

    Dear Andrei,

    I’m using MA expert advisors and it’s really open position automatically, but it can’t close position when the price were at the cross between 2 ma’s. How can it be done?

    Thanks

    Reply

    Desmond Reply:

    Another way to see error messages is to look at the “experts” tab in the trading terminal.
    look at : https://sites.google.com/site/dmweadev/file-cabinet/home/ea-s-info-1
    for more info.

    Reply

  31. Andrei

    Zulkifli,

    I didn’t see this EA, but I guess you have to edit its code to make it close the positions when you want.

    Reply

  32. rotimi

    hi,pls i need to know how to install expert advisors & where can i get a reliable expert advisor.your assistance will be appreciated.am a complete novice about forex.

    Reply

  33. Bimbson

    Hi,
    Where can i get a reliable EA for GBP/USD and USD/CAD

    Reply

  34. Ska77

    Thanks for sharing all of this, your EA are very good 1, better than others,
    Recommended for every 1.

    Very good..

    Reply

  35. Ska77

    I can say, that’s your EA are perfect.

    Reply

  36. han

    i want to set ea on my setting where can i learn how to set ea setting to my parameter. which books or website do you recommend.qqq thanks

    Reply

  37. GMann

    Please advise – how do you load the saved EA file into the MT4 platform?

    Reply

    Andrei Reply:

    Isn’t the blog post you are commenting explaining that?

    Reply

  38. Jeff Moore

    Hi Andrei,

    I’ve just started to test the following two EAs.

    Have you any answers for the following questions.

    1) I’m testing Framework on GBPJPY on the 15 minute chart.
    Do you need to copy the indicators onto the chart to ensure
    the EA performs correctly. for example, does the CCI need
    to be on the chart, and are there any indicators which need
    to be on the Phoenix chart I am testing on GBPUSD.

    2) Does the EA place trades based on the timeframe you are
    using. For example I have framework running on the 15 minute
    and when I switch the chart over to the 1 minute, it executes
    multiple trades repeatedly, although now that I am running it on
    the 15 minute it has executed 3 trades. Is this correct.

    Thanks

    Jeff

    Phoenix and Framwork

    Reply

    Andrei Reply:

    1) No, you don’t have to add any indicators to the chart for the EAs to work properly they use all needed indicators internally.

    2) Yes, most EAs trade based on the timeframe to which they are attached.

    Reply

  39. Jeff Moore

    Hi Andrei,

    I see very good results from GBPUSD, however the others such as USDJPY, USDCHF and EURJPY don’t seem to have the same precison. I have found some settings on the web which I have changed for those pairs. I will let you know the results. I’ve found GBPUSD to be very precise on the 15 minute chart.

    Thanks

    Jeff

    Reply

  40. Jeff Moore

    FrameWork,

    Hi Andrei, I’m testing Framework on GBPJPY at the moment. It executes the trades very well and always has a good run or closes the positions quickly if the signals change. Where I see it can cause a problem though is with the code itv++ where it adds to the position during a trend. I had it running last night and today. It had an excellent entry, but added 20 lots to the position from the bottom of the trend before the move. Then at the top of the move it added another 20 positions which were all closed automatically when the market and CCI indicators turned. Do you know of any method by which you can change the settings to ensure that the position isn’t added to as the market trends and a selection of how many positions can be opened on the initial signals. I would like to try and stop it from opening positions when the trade has already initiated, and also stop it from opening positions 200 points into a move.

    Thanks

    Jeff

    Reply

    Andrei Reply:

    You can increase the Interval input parameter to reduce the frequency of pyramiding the lots. Other things would require a dramatic code change.

    Reply

  41. Adez

    Hello there,
    Can I get an expert advisor that will always alert me whenever RSI crosses its 50/50 line up or down?
    And I pray it works with all periods and all time frames.

    Reply

    Andrei Reply:

    You can create a thread asking for this favor at the forum:
    http://www.earnforex.com/forum/f12/

    Reply

  42. pyan

    Hi, Andrei, I am using Framework EA, I just want the EA to make a trade max of not more than 3 trades, how can I change the setting? because the EA keep enter the trade and seem to be no ending…. Is this EA is Hedging? Thanks a lot

    Reply

  43. Andrei

    Pyan, please, discuss Framework EA at this forum:
    http://www.earnforex.com/forum/f13/framework-17/

    Reply

  44. Ron Zhao

    Hi, Andrei,
    I tested Framework. It produced profits quite well. However, when the profits reached the peak, I got a lot of “close at stop”, which closed out all open positions at huge losses. Why was that happening? I noticed that some open position should have been closed out by “TP”, but it didn’t happen. Please help!

    Reply

  45. Andrei

    Ron, please ask all Framework related questions in its separate forum thread here:
    http://www.earnforex.com/forum/f13/framework-17/

    Reply

  46. danilo

    chiedo scusa, ma questi EA scaricabili, aprono e chiudo le posizioni da soli? o bisogna farlo manualmente??grazie..!

    Reply

  47. Sridhar

    HI All,
    Can some one help me in getting the EA

    Reply

    Andrei Reply:

    Sridhar, and what’s the problem?

    Reply

  48. Bayu, Indonesia

    Dear Mr.Andrei,

    Thanks a lot for great EA, especially for Adjustable_MA… I’m a novice in FX market, and got frustration with manually trading.. hope EA can be changed my trading way..

    Reply

    Andrei Reply:

    I am glad to be of help. Please, ask if you need some more info about the MT4 EAs.

    Reply

    Bayu, Indonesia Reply:

    Dear Mr.Andrei,

    I already try EA Adjustable_MA in demo account.
    I have problem, why for 1 pairs, it’s open 2 position (long and short) at same time within 1 minutes?
    and, what the meaning of “extern int Slippage = 3” in Adjustable_MA script?
    I use this EA for pairs of USD/CHF and EUR/JPY, they have spread 3 pips. Does it correlate with “extern int Slippage = 3” that cause the problem?

    Thanks for your help.

    Reply

    Andrei Reply:

    I really don’t know why it would open 2 positions in different directions for one pair… “extern int Slippage = 3” is the input parameter for a price slippage. Value of 3 means that the buy/sell orders will be considered good even if they are executed at a price worse than the given by up to 3.

    Reply

  49. Loyez

    Please,i am new into coding,i just coded an EA but i am having 1 error saying double quotes needed,could you help me to solve this problem,i have really looked into it and it is giving me headache to locate it may be because i dont know much about coding b4,i am a medic.
    please help me to remove this error,let me have your email so that i can send you the ea.
    Thanks
    Loyez
    BURLOG

    Reply

  50. Jerry, Malaysia

    Dear Mr.Andrei,

    Can you tell me, where I can get EA using stochastic oscillator indicator?

    Reply

Leave a Reply

required
required (will not be published)
optional