MT4 trading programming

You can also add scripts and experts in the same way.
In step (1), select the "MQ4 Scripts" or "MQ4 Experts" hyperlink in the left menu.
In step (3), select the appropriate radio button.

Note that these objects are stored in the following folders:
Experts: c:/program files/<mt4 broker name>/experts
Scripts: c:/program files/<mt4 broker name>/experts/scripts
Custom indicators: c:/program files/<mt4 broker name>/experts/indicators
Include (program code, e.g. .MQH) files: c:/program files/<mt4 broker name>/experts/include
Templates: c:/program files/<mt4 broker name>/templates
Data files: c:/program files/<mt4 broker name>/experts/files

NOTE: As an alternative to the above, if you simply copy the .MQ4 file into the relevant folder, and then (exit and) re-start MT4, the expert, script or indicator will automatically be recompiled, and appear in the Navigator.

Some other good sources for MT4 indicators (apart from FF's search facility):
http://www.forexfactory.com/showthread.php?t=62722 (see ZIP file attached to post #1)
http://www.forex-tsd.com (perform a forum search)
http://codebase.mql4.com/ (peform a site search)
http://www.forexmt4.com/_MT4_Indicators/
http://www.desynced.net/fx/eas/indicators.php
http://www.greattradingsystems.com/f...-4-indicators/
http://allforexindicators.com/Default.aspx
http://www.metatraderlibrary.com/forex-indicators/

If you want to delete an expert, script or indicator (CAREFUL!), use Windows Explorer to go to the appropriate folder, and delete the relevant file with the EX4 extension. For example, if you decide that you no longer want to use PCCI, delete file PCCI.EX4
That will effectively remove PCCI from the custom indicators list in MT4

The file PCCI.MQ4 contains the source code for PCCI (which you copied from the web resource), the PCCI.EX4 file is the executable code that was created when you did your compile back in step (5). If you want to re-instate the indicator, all you need to do is reload the source into MetaEditor (press Ctrl-O and open the relevant file), and then press F5 to compile it, which re-creates the executable file used by MT4.

A more simple way of deleting an expert, script or indicator is by using the Navigator (press Ctrl-N). Click on the item you wish to delete, press the DELETE key, and click Yes to confirm the deletion. Note that this deletes both the source (.MQ4) and executable (.EX4) files.

Happy charting!
David

Footnote: the above is repeated in the attached Word doc. If you prefer, you can download the doc, add your own notes to it, and/or print it out for handy reference.

NOTE: More tips here.

March 27, 2012: Added attached document "How to create a ruler to measure multiple R-multiple profit targets".This is handy if you want a measuring tool where you want to vary a SL setting, and have multiple TP settings (that are R-multiples of the SL) adjust themselves automatically. It uses MT4's in-built Fibonacci Channels facility, so there's no third-party indy required.


Miscellaneous links

Solving Vista/Win7 problems: http://4xtrader.net/how-to-run-metat...ws-7-or-vista/
7bit's Debug View thread: http://www.forexfactory.com/showthread.php?t=245303
Steve Hopwood's EA shell: http://www.forexfactory.com/showthread.php?t=282290
MQL4 tutorials: http://www.forexfactory.com/showthread.php?t=6011
see also: http://www.forexfactory.com/showthre...54#post4485554

MQL4 tutorials (full list of links):
http://www.forexfactory.com/showthread.php?t=6011 (zip files with full tutorials)
http://www.metatrader.info/node/34
http://articles.mql4.com/404
http://articles.mql4.com/417
http://articles.mql4.com/466
http://articles.mql4.com/516
http://articles.mql4.com/536
http://book.mql4.com/
http://docs.mql4.com/ (MQL4 reference manual)
http://www.forexfactory.com/showpost.php?p=2160415
Check out Jim Dandy's excellent MQL4 tutorial videos here: http://www.jimdandyforex.com/lessonvideo-links/

Br0ker comparison links: http://www.forexfactory.com/showthread.php?t=282549

TA resources: http://www.forexfactory.com/showthread.php?t=106577

Useful MQL4 functions (my functions library): http://www.forexfactory.com/showthread.php?t=165557
Format of HST files here: http://www.forexfactory.com/showthre...08#post1477708
Export price history to Excel here: http://www.forexfactory.com/showthre...89#post1479389 (see later posts in thread also)
and updated here: http://www.forexfactory.com/showpost...37#post1935637
Export History indicator: http://www.forexfactory.com/showthre...44#post2831344
Export bid/ask to Excel (SMJones, DDE-sample.xls): http://www.forexfactory.com/showthre...23#post1815623
MT4 Expert Advisor Builder: http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/
Another strategy builder: http://forexsb.com/wiki/start
MQL4: Manual: http://book.mql4.com/
Documentation: http://docs.mql4.com/
Interpreting System Tester Report numbers: http://www.metaquotes.net/experts/ar...tester_report/
Link to MQL4 resources: http://www.forexfactory.com/showpost...15#post2160415
Trade/exit management EAs: http://www.forexfactory.com/showthread.php?t=89371 and http://www.forexfactory.com/showthread.php?t=9553
Compendium of EAs (mainly trade management) in forexsaint’s thread: http://www.forexfactory.com/showthread.php?t=193727
Why MT4 is so widely used: http://www.forexfactory.com/showthre...88#post2785588
What the numbers in MT4's Expert Testing report mean: http://articles.mql4.com/83 and http://articles.mql4.com/127
Using MT4 to plot non-forex charts: http://www.forexfactory.com/showthread.php?t=208577
and http://www.forexfactory.com/showthread.php?t=20535

Reading/writing files outside …\experts\files folder: http://articles.mql4.com/720 and http://codebase.mql4.com/4086
Executing external program: http://forum.mql4.com/16121#109022 and http://support.microsoft.com/kb/238245
How to set up e-mail alerts in MT4: http://broguetraders.com/2011/02/11/...in-metatrader/
also http://www.forexfactory.com/showthread.php?t=23638
and http://www.forexfactory.com/showthread.php?t=273034

MetaTrader 4 Strategy Tester Tutorial: http://www.easyexpertforex.com/backt...imization.html
How to attain 90% modelling quality: http://alansforexblog.com/2008/02/27...pert-advisors/
Free data source for EAs: http://www.forextester.com/datasources.html
EA review/constriction info: http://eareview.net/tick-data
Trade juice table on statistical validity: http://www.tradejuice.com/system-tra...ing-system.htm
Ideas on backtesting: http://www.forexfactory.com/showthre...37#post6160037

Possible sources of tick data:
http://ratedata.gaincapital.com/
http://www.forextickdata.com/services.htm
http://www.tickplusdata.com/forexlist.htm
http://disktrading.is99.com/disktrading/#FOREX
OMZ to ASCII converter here: http://www.quote-solutions.com/softw...historycentre/
http://www.tssupport.com/services/hc/
http://www.goforex.net/forex-directory/forex-data.htm
http://www.global-view.com/forex-tra...forex-history/
http://www.thinkingstuff.com/Resourc...5/Default.aspx

MT4 script to convert tick data to FXT/HST format: http://codebase.mql4.com/516

Free programming threads:
http://www.forexfactory.com/showthread.php?t=168808
http://www.forexfactory.com/showthread.php?t=166758
http://www.forexfactory.com/showthread.php?t=212422
http://www.forexfactory.com/showthread.php?t=197798

How to read/interpret the stats on a Trade Explorer: http://www.forexfactory.com/showthread.php?t=410405

Pips, lots, spread, swap, risk, position sizing, margin, leverage calculations explained: http://www.forexfactory.com/showthre...85#post2285285

--------------------------------------------------------------------------------------

And that's all thanks to Hanover on FF

Good lucko
 
I'd be willing to offer my programming services, no charge, to a few T2W regulars in repayment for many years of entertainment on this forum - provided you are not too fussy about timescales.

I am a professional programmer with many years experience and I have MT4 experts running full time that I have developed (I use MT4 for hedging). Experts/Indicators no matter how complex considered.

My only condition is that if you do come up with something good I get to use it as well!
 
I'd be willing to offer my programming services, no charge, to a few T2W regulars in repayment for many years of entertainment on this forum - provided you are not too fussy about timescales.

I am a professional programmer with many years experience and I have MT4 experts running full time that I have developed (I use MT4 for hedging). Experts/Indicators no matter how complex considered.

My only condition is that if you do come up with something good I get to use it as well!

That's interesting to hear. Let me know if you come up with anything interesting please. Like a profitable system.
 
How to Pick an Expert Advisor
Learn How to Find the Best MetaTrader Trading Robot
Factors Affecting Our Decisions
When making any sort of decision we need to be able to measure, as well as rate things based upon a variety of diverse criterion. Whether it is deciding between what type of car to buy, or something as simple as which type of candy to get from a vending machine, there are ultimately a magnitude of factors affecting our decisions. These statistics are a highly influential factor in any decision making process. Which meal will give the most satisfaction for the price? Or which TV will give the highest quality picture and resolution? Similar to these examples, a variety of variables can be weighed when deciding on a Expert Advisor to trade with. Throughout this two part report, we will spotlight the quantifiable factors that affect our decision. The procedures and statistics we have chosen to focus upon are some of the essential variables that must be considered before finally choosing and trading with a specific EA.

Understanding the Statistics
Cold hard quantitative stats are very important and relevant figures, that you'll need to study during the course of selecting a trading robot. As you can imagine thousands of equations exist to measure risk and performance but there are just a handful of measures that are widespread and should consistently be taken into account. It is very important to keep one's risk tolerance in mind when appropriately evaluating a trading robot. We will show different examples, along with the numerical statistics that will detail how traders may assess an Expert Advisor. Keep in mind that it is likewise important that you consider your individual risk appetite and preferences when deciding which EA is the best fit for you. Although these are not the only statistical measures you may choose to view, ignoring any of them could lead you to miss a critical aspect of an EA, and ultimately adversely affect your trading.

Profitability Measure
The goal of trading is to create and grow wealth. Although this is a very simplistic and holistic way to look at a complex activity, such as trading, ultimately it is the reason all trades are made. With this in mind, the first factor you need to consider is "Will this EA produce positive or negative returns?". Although it is impossible to predict the future, especially in trading, one helpful way is to forecast using historical data. Keeping in mind that historical results do not indicate future performance, it makes very little sense to choose an EA with a losing record. Obviously you will want to choose a profitable EA. However just picking a profitable EA will do you no good. You will need to compare it with other profitable EAs, and therefore profitability needs to be quantified. One of the best measures that we have found is known as the profitability factor. This equation is a simple calculation that not only shows whether or not you can expect a positive or negative return on your capital, but also takes into consideration a very important risk factor which we will talk about shortly. The profitability factor is the ratio of how much you can expect to gain for each dollar put in over how much you are at risk to lose. The equation is calculated as: (profit - commission)/(max drawdown + commission). Any EA with a value less than 1 represents a historically poor EA where returns do not outweigh losses and risk. For all intensive purposes you will always want to eliminate any EA that has a profitability factor of less than one. Below are the statistics for 3 hypothetical EAs:

Initial Deposit Total Gain Total Loss Commissions Max Drawdown Profit Factor
EA 1 5,000 3,200 2,400 75 350 1.706
EA 2 4,500 2,200 1,259 125 585 1.149
EA 3 6,500 4,335 3,890 65 500 0.673

Although there is very limited information provided above, it is already possible to eliminate EA 3 because its Profit Factor is below 1. You may also choose to eliminate EA 2 even though it is above 1, as it may not meet your minimum requirement of return. Although all these EAs have produced positive returns after commissions, the reason we do not see EA 3 as profitable is due to the risk factors associated with its max drawdown. The following section will highlight the various characteristics of the drawdown as well as explain why max drawdown is such a critical statistic.

Understanding the Drawdowns
The drawdown of an EA is one of the most important risk indicators when choosing an EA. Drawdown is the percentage the EA loses from its peak to trough, or the last high point to its next low. The reason it is such an important statistic is because of the information it portrays about potential drops in value and the overall volatility of the EA. The initial drawdown analysis should be done visually by assessing the equity curve of the EA. Large choppy movements are indicative of an EA with high volatility and a substantial amount of drawdowns, which can often be quite drastic. An example of one EA might look like so:



On the other hand, a smooth steady equity curve is a depiction of an EA with less volatility and normally lesser and smaller drawdowns; which could look like this:



Although your initial analysis will be through visual assessment of the equity curve chart, further quantifying this information to a set measure can be extremely useful; especially when comparing two similar EAs. The three key measures dealing with drawdowns are; max drawdown, average drawdown, and drawdown recovery. The first, max drawdown, is the best indicator for a worst case scenario analysis, and is vital in deciding whether or not one could stomach the potential risk associated with the particular EA. Like the name implies, max drawdown is the largest drawdown in percentage terms that the EA has incurred over its lifetime. From a moderately conservative approach, it is prudent to assume that this max drawdown occurs almost immediately after funding your account. By doing this you can assess whether or not you would feel comfortable with this potential risk. If not, it would most likely be best if you chose an alternative EA. In the next report we will continue on with our analysis of drawdowns as well as focus on the statistics associated with trading performance.

Metatrader 4 Education Metatrader 4 Education Copyright © NCMFX, Inc.
*Disclaimer | Home | Careers | Contact Us | About Us | Privacy Policy | Regulation | FAQs | Sitemap | Coming Soon

Forex trading involves significant risk of loss and is not suitable for all investors. Read full disclosure.

The information contained in Facebook link: https://www.facebook.com/pages/Traders-Choice-FX/20302051398 is no longer current and should be disregarded.
 
Learning programming is worth it even though if you learn it because you want to make auto trades.
But you have to invest a loooot of time.
 
Learning programming is worth it even though if you learn it because you want to make auto trades.
But you have to invest a loooot of time.

What in your view is the least painful way to learn it ? Maybe from a book ?
 
You should consider a good book but it is meaningless if you don't practice.
Check out the book "Fundamentals of Computer Programming with C#" by Svetlin Nakov. It is a intro in programming so that the programming language does not really matter.
 
Hi Pat yes I did.

My offer was to program an indicator/EA for you if you have a some ideas you want to test. So get thinking!

I will thanks.
It is hard to come up with something new and not the same ole Macd, Rsi etc.
Bayesian theories might be in the exotic range but.......?
 
Top