Category Archives: Tutorials


How to Find Your Broker’s Server IP


In trading latency is important, regardless if you’re trading from your home computer of from a forex vps. Have you ever wondered how you can find out the network latency between your trading platform and your broker’s servers? Well, if you have I have the answer! All you have to do is do a quick ping test (ping command sends ICMP packets to the server and times how long it takes the server to respond), but before you can ping the server you have to know it’s IP address. But most of the times you will not know the actual IP address of your broker’s server(s). Some brokers will tell you some will not, and some will make it easy to find out and some will not. So you’re going to have to take matters into your own hands and find out the IP for yourself.

I’ll show you in this brief tutorial how you can do so.

The first thing I suggest you do is ensure that you have no other web browsing or any other internet network connections running. I’d suggest either restarting your machine and close every program that uses the internet connection, or you can just close every internet related program. Once you’ve done that run your broker’s MT4 / MT5 platform, but make sure you start ONLY that. This will ensure that later on when we search for the IP we will have more accurate results.

OK, so step:

1) Ensure that you are connected successfully to your broker’s server

2) Open up a windows “command prompt”

Click on the Start Menu and go to All Programs –> Accessories –> Command Prompt

You can also (in windows 7 and windows vista) just type in “cmd” in the search box visible once you click on the start menu.

If you’re running windows xp you can just click on the start menu, go to run, and in the run box type “cmd” and hit enter or press ok.

3) In the command prompt type the following command: “netstat -n” (make sure you leave a space after netstat and before “-n”)

4) Now you should get a listing of all the network connections currently open on your computer.The IP address of your MT4 platform should be listed underneath the “foreign address” heading. MetaTrader uses port 443 for communication so next to the IP you will see “:443”. The IP address with the “443” port listed there is the IP address of your broker’s MetaTrader server. See the example below:

Now I should qualify my previous statement about the use of port 443. Sometimes brokers WILL use other ports (for example 80, 923, 1950, etc).

Now you see why I suggested that you open only MT4 and nothing else internet related 🙂 It makes it that much more simple.

5) Now if you did not follow my advice and opened ONLY the MT4 platform and no other applications that make use of the internet connection, then there is an additional step you have to follow.

Close the MT4 platform and go back to the command prompt window and type the “netstat -n” command one more mime. Compare the result with the previous step’s result and note the IPs that are MISSING. The missing IP in this case is the one that belongs to your broker’s server. See this example:

Beware that sometimes two different brokers can have the same IP address. This most likely is due to one of the broker being what’s known as a “whitelabel” of the other one (or vice versa). This means they do not actually have their own server(s). You can think of the whitelabel broker as a sort of forex broker equivalent of a “reseller.”

I must thank the people at the ECN FX Robot website for the inspiration for the article and the images.

If you have some questions or need further clarifications on the process outlined above feel free to leave a comment on this post.

Until next time,

Happy trading.

Alan out.

Quick way to install MT4 on Mac OS X using Crossover

silver apple logo

Hey everyone. Some people have been reporting on my “how to install MT4 on Mac OS X” post that the latest version of MT4 cannot be installed or doesn’t work properly with Crossover. Well to be honest guys I stopped using MT4 on OS X, so I haven’t been keeping up to date on this subject. However one visitors commented that he found a solution, and it is deceptively simple and easy. Apparently all you have to do is use their “Cross Tie” program.

Visit this link:

Then click on the “Install via Cross Tie” link.

I hope you find this helpful.

Thanks goes out to a visitor that goes by the name of “Kong” for sharing this info with me, and eventually with you all via me.



How to disable ‘Auto-Update’ in MT4


Edit: It seems starting with build 482 the makers of MT4 (MetaQuotes) decided to put the platform update code right in the MT4 executable program itself so the platform now updates itself AUTOMATICALLY. I find this to be a bad idea and no doubt many of you do as well. I can go into a few reasons why, but I shall save that for later. As far as I know there is no way to disable this and prevent the platform from automatically updating (and thus restarting) itself. If I find something I will post an update here or in a new post.

Hello fellow traders.

I’m not sure how many of you have wondered if there is a way to get rid of MT4’s automatic auto update notification, but if you wish to permanently disable it I have found a solution. The most common reason I can think of why anyone would wish to do this is to ensure that your EA or backtesting platform is always running a specific version of MT4. This could be necessary for compatibility reasons or maybe you just don’t want to be bothered every time you load up the platform.

There is of course a downside to disabling the auto update feature. The main negative point is that you’ll never receive the latest bug fixes and security fixes that get incorporated into newer version of MT4. If you stick with one version forever you’ll have to live with all the bugs and potential problems that particular version of MT4 has.

But if this is something you are sure you wish to do, here is how you do it:

1) Open up the folder where you installed the MetaTrader 4 platform (typically it is located in c:\program files\)

2) Find a file called LiveUpdate.exe

3) Rename that file. It can be any name just make sure you don’t rename it to something you won’t recognize later. For example, I renamed mine to “LiveUpdate.exe-” (without the quotes obviously)

This will permanently disable MT4’s auto -update feature. Later on if you wish to upgrade the platform to the latest version available from your broker just rename the file back to LiveUpdate.exe and restart the platform.

That should do it!

Alan out.


MetaTrader Backtesting – How to Get 99% Modeling Quality

Greetings everyone!

In today’s post I’m going to show you how you can get 99% modeling quality when backtesting using MT4’s “Strategy Tester.” If you’re a MT4 backtesting veteran you no doubt know that using regular M1 historic data the highest modeling quality you can get is 90%, but what you may or may not know is that the accuracy of your backtests can be pushed even higher, BUT you need raw tick data.

How does one obtain such tick data? Well, I asked myself that very same question, and I’ve looked everywhere for a free source of historical forex tick data and after extensive searching I found it. The only problem is that the tick data is not readily usable by MT4 and as such requires a rather elaborate process of conversion and also a few other tricks to force MT4 to use the converted tick data. That’s where this tutorial or “how-to” comes in. So pay close attention as you MUST follow each step precisely.

You may be asking yourself why would one want to achieve a higher modeling quality level. The answer has to do with scalping. When backtesting an expert advisor that does not attempt to scalp the market the default MT4 history data provides an acceptably accurate level of simulation. However when you’re trying to backtest a scalping EA even the slightest variation in the price feed can strongly affect performance.

UPDATE: previous content removed. If you want the full tutorial you can find it on the following website:

Birt’s EA Review website

Happy backtesting everyone!



Analyzing MetaTrader Strategy Tester Backtest Results

Okay, so you’ve set up your history data and completed your backtest using Metatrader Strategy Tester. Now let’s look at the results.

There are four tabs to look through: Report, Graph, Results, and Journal


This is the meat of the backtest. All the statistics of the backtest are displayed here.

• Bars In Test – Displays the depth of the history on which the modeling was based.

• Ticks Modelled – Displays the size of the modeled sequence. Every record of the sequence represents the bar state (OHLCV) at one or another moment. Different bar states can be modeled depending on the timeframe, modeling method, and presence of history data from smaller timeframes within a bar.

• Modelling Quality – Calculated according to the following formula. This should be 90%. If not, read the article on downloading and setting up history data.

ModellingQuality = ((0.25*(StartGen-StartBar) +
0.5*(StartGenM1-StartGen) +
0.9*(HistoryTotal-StartGenM1)) / (HistoryTotal-StartBar))*100%;

• Gross Profit – The summed up profit for all profitable transactions;

• Gross Loss – The summed up loss for all unprofitable transactions;

• Total Net Profit – The Gross profit minus the Gross loss.

TotalNetProfit = GrossProfit – GrossLoss

• Profit Factor – Profit factor, shows the ratio between gross profit and gross loss. The larger this number is, the better.

        ProfitFactor = GrossProfit / GrossLoss

• Expected Payoff – Calculated as follows:

        Expected Payoff = (ProfitTrades / TotalTrades) * (GrossProfit / ProfitTrades) –
(LossTrades / TotalTrades) * (GrossLoss / LossTrades)

• Absolute Drawdown – Absolute drawdown is the difference between the initial deposit and the smallest value of balance within testing:

        AbsoluteDrawDown = InitialDeposit – MinimalBalance

• Maximal Drawdown – The highest difference between one of local upper extremums of the balance graph and the following lower extremums:

        MaximalDrawDown = Max of (Maximal Peak – next Minimal Peak)

The rest of the statistics are pretty self explanatory, so we won’t waste time defining those. For more information on this, visit Metatrader’s website on backtesting


This is pretty obvious, it is a graph of the Expert advisor’s trade results. The green lines at the bottom mark the lot sizes.


This tab displays every order placed with the running total of your account balance.


This displays any errors and status messages.

Original article source: The Trade Machine (c)

MetaTrader Optimization

Metatrader’s Strategy Tester allows you to optimize your expert advisor to find the most profitable settings for the multitude of possible input variable combinations. You can optimize an expert advisor on a specific chart for a specific time period to find out which input values produced the highest returns and lowest drawdown.

However, it is important to remember that you should not over-optimize. You may get amazing results with a specific input combination, but because the values are so constrained, you probably won’t see results like that in the future. When optimizing an expert advisor, remember to use your head and think about why you are getting the results you are. Was it from one huge winner that you are unlikely to see in the future? Or did it win many times, making it a plausible trade setup for the future.

Don’t forget, you need to have high quality minute data for optimization to be worthwhile. See the article on setting up your metatrader history data.

How To Optimize – Step By Step

To get started optimizing your expert advisor, open Strategy Tester. If you are new to backtesting, read the article: How to Backtest in Metatrader

Select the Expert Advisor from the pull down menu. Choose a currency Symbol and Period. Select Every Tick for Model. Check Use Date and select a time frame that you have high quality minute history data for. Finally check the box next to Optimization.

Next, click on the Expert Properties button on the right. Select the INPUTS tab to enter the range of values you will optimize for. The Start value is the lowest value that you start from. Stop is the highest. And Step is the increment that you step through the range.

For the TakeProfit value, you can see that we start at 50, step through at 25, and stop at 300. This will test every value inbetween 50 and 300 in a 25 increment. So, 50, 75, 100, 125, all the way up to 300. The same idea applies to the other variables.

The checkbox on the left must be checked to optimize for that variable. Otherwise, it will use the regular Value.

When you’re finished entering your input values, click OK. Now we’re ready to start the optimization. Click the Start button on the bottom right of the Strategy Tester window. The backtest may take minutes or hours depending on how many values you are optimizing for. You may want to choose a larger increment Step value or a smaller range if it is taking too long.

After the optimization has completed, select the Optimization Results tab to look through the results. You can sort by the values at the top. Select Profit to view in order of highest returns, or Drawdown to see which values had the least risk.

Original article source: The Trade Machine (c)

Backtesting with MetaTrader’s Strategy Tester

So you’ve just gotten your hands on a hot new expert advisor and you need to know if this thing is really going to work. It’s time to get your hands dirty and start testing. There are two types of testing you should do: forward testing and backtesting.

But first, make sure you have high quality minute data for your backtest. Read this article on Downloading and Setting up History Data to Get 90% Backtesting Quality.

Forward Testing:
Forward testing simply means to open a demo account and run the expert advisor in real time to see how it works and performs. Forward testing is essential, however it takes a lot of time before you get a good idea about how the expert advisor will perform. Instead of relying solely on forward testing, we can also perform backtests.

Backtesting lets you test years of data in just minutes. So, before we decide to spend a lot of time forward testing, we can use Metatrader’s Strategy Tester to see how it will perform long term.

Strategy Tester also allows you to optimize your expert advisor. See the optimization article on this.

History Data

Before you start backtesting you will need to make sure you have complete and accurate history data set up. If your modeling quality is less than 90% or you see mismatched chart errors, then your data is insufficient.

To download history data and learn how to set it up, read this article: How To Set Up Metatrader History Data And Get 90% Backtesting Quality

Strategy Tester Backtest Settings

Now that you have your history data set up, let’s start backtesing!

To open the Metatrader backtesting window, select from the top menu: VIEW > STRATEGY TESTER (or Ctrl + R for the shortcut). The window should open in the bottom of the terminal and look something like this:

Most of the Strategy Tester input values are pretty self explanatory. First, select your Expert Advisor and the Symbol of the currency pair you want to test.

For Model enter Every Tick (the most precise method based on all available least timeframes to generate each tick). This mode allows to model price movement within a bar the most precisely.

For Period enter the time frame you want.

Leave Optimization unchecked for the moment.

Check Use Date and select the start time and end time that you want to test. Make sure you have quality history data for this time period.

Select Visual Mode only if you want a visually step through the backtesting. Go ahead and try this to see how it works. It is a good tool for checking the logic of your expert advisor and to spot any errors. However, it does take a little more time to perform, so you might not want to always use this.

Next, click on the Expert properties button on the right.

Select the TESTING tab. Enter an Initial Deposit value and leave everything else the same.

Select the INPUTS tab. This is where you enter any input values for your expert advisor. These will vary depending on your own EA. Change what you want, or leave the default settings.

Don’t worry about the OPTIMIZATION tab for now. Click OK to close the box.

Now you are ready to start your back test. Hit the START button and let’s see what results we get. Depending on your EA and computer memory, it may take several minutes to hours to complete.

Once your backtest has completed, it is time to Analyzing the backtest results

Original article source: The Trade Machine (c)

How To Set Up Metatrader History Data And Get 90% Backtesting Quality

Setting up Metatrader 4 for backtesting can be a tricky, time consuming, and a little frustrating if you aren’t entirely sure you have it all working properly. This article will guide you through the entire process from obtaining high quality minute history data to installing a separate backtesting account to importing and converting the tick data to different time frames. In no time you will be up and backtesting years of history data with 90% modeling quality!

Step 1: Download high quality minute (M1) Alpari history data for Metatrader. This link takes you to Megaupload where the file is hosted. Save and extract the data into a folder for future use.

Step 2: Download a new installation of Metatrader from This will be your testing version of Metatrader. Install it in a new folder, making sure not to copy over any existing installations of Metatrader. I’ve named my new version MetaTrader 4 Tester 2.

Step 3: When Metatrader installer asks you if you want to launch Metatrader upon completing the installation, choose to NOT launch Metatrader by UNCLICKING the check box. Then select finish the installation.

Step 4: After you have finished installing a new version of Metatrader 4, delete all the folders within your Metatrader history folder. To find this folder browse the Metatrader program file where it was installed. This is typically in the directory: Program Files > Metatrader 4 (or whatever you chose to name this) > history.

Step 5: Now that you have deleted all of the history files, launch Metatrader 4 Terminal and create a demo account with whatever broker they offer you. You should be prompted to create this demo account when you first open Metatrader. If you are not, don’t worry. Just right click ACCOUNTS on the left and choose to OPEN AN ACCOUNT.

Step 6: Once your new demo account has been created, you will need to DELETE it. Yes, you read that correctly. We need to delete the demo account we just opened. We do this to prevent the demo account from overwriting the history data that we will be importing in upcoming steps. You are probably asking: Then why did we open this demo account to begin with? The reason is to create a folder structure for all the currency pairs, which we will be importing data into very soon.

Step 7: After you delete your new account, close Metatrader. Now we are going to take the Alpari history data we downloaded and extracted earlier and move it into our Metatrader Demo account folder. Browse to the history folder within your Metatrader folder as we did earlier. You should see a folder of the demo account we created and then deleted earlier (Note: if you can’t see this folder and you are running Windows Vista, you may need to change some settings in Vista before you can see this folder. You can also skip this step and just import the history files from wherever they currently are in the upcoming steps.)

Before we copy over the M1 history data, make sure there aren’t any left over .hst files from your demo account. If there are delete those.

Now copy over all of the history data files to this demo folder. Copy over just the files and not the folder structure so that you end up with all the data files together in the demo folder like this:

Step 8: Next, re-launch the Metatrader terminal. From now on, every time you launch Metatrader, you will be prompted to “Open An Account”. Choose CANCEL each time you are asked this in the future.

You will also be asked to login to your account. Click CANCEL for this one each time too.

Step 9: Now we need to change the chart settings to their maximum values so that they can hold all the tick data we will be importing. With Metatrader open, select TOOLS > OPTIONS.

Choose the CHARTS tab and edit the “Max Bars In History” and “Max Bars In Chart” to their maximum values by entering as many ‘9’s as it will let you. Click OK.

The next time you open this options menu these max values will be readjusted to the highest number of bars allowed:

Step 10: Next, go to TOOLS > HISTORY CENTER (or press F2 for the shortcut).

On the left hand side find the currency pair that you want to import data for. We have chosen AUDUSD. Expand the menu so that you can see the different time frames. They should be grayed out at the moment. Double click on the 1 Minute timeframe of your pair to select it. It will stay grayed out, but you need to double click it so that we can import the minute data.

Step 11: Click IMPORT. Then click BROWSE and go to the Metatrader > history > demo account directory where we placed the minute data earlier. Select the minute data and open it. You may need to change File Type from ASCII Text to All Files so that you can see the data to open.

You should see the data populate the import box. It may take a few moments to load. If it still doesn’t load, you may need to enter a ‘1’ for Skip Columns. Or you if the data is not separated by commas, change it to whatever format it is in. For ours, the only thing we changed was Skip 1 Column. Once the data is loaded, hit OK.

Because the data is separated into 2 files of different time periods for each pair, you will need to import each file like we did above. So, after we import the data for AUDUSD 2001-2006, we will import again for the other AUDUSD file “M1_AUDUSD”. Once we complete this, we will have a complete time period from 2001 to 2009.

Repeat these steps of importing data for each pair. Once you have finished, hit OK to exit the History Center.

Step 12: Open a chart for a pair that you imported data into. Select the Minute timeframe (M1) at the top. You should see a chart of the minute data for the time period that you imported. All other time frames should still say “Waiting for update” because we still have to convert the minute data into all those time frames.

Step 13: Converting The Data – From the Navigator window on the left, expand SCRIPTS and open period_converter. (TIP: Make sure you have the EXPERTS tab selected at the bottom of the terminal so you can view the status of this script.) You will need to convert the minute data to each time frame by changing the ExtPeriodMultiplier value and running the script. M1 is already done, so let’s start with the 5 minute. Enter 5 for M5 and click OK.

You will know it has finished converting when the EXPERTS tab displays a message that it has written the records.

Open period_converter again. It will ask you: “Do you really want to stop period_converter”. Choose Yes and repeat for the following time frames: Enter 15 for M15, 30 for M30, 60 for H1, 240 for H4, 1440 for D1, and 10080 for W1.

Step 14: Repeat the above steps for each currency pair.

Step 15: That’s it. Now that you have your history data all set up, you are ready to Start Backtesting With Metatrader’s Strategy Tester

Original article source:  The Trade Machine (c)