Friday 14 July 2017

Metatrader 101: How To Use Offline Charts

This is the one in a series of Metatrader 101 posts, partly so that I can have something to give to clients who are new to Mt4. It will cover the basics so people can get up and running quickly.


In Metatrader you only have a limited choice of charts: bar, candle or line and a limited choice of time-frames. But if you want to use different time-frames more exotic charts such as Renko, Point and Figure etc, is this possible? The answer is yes using what are called Offline Charts.

The basic principle is that you run a script on a "driver" chart which generates the necessary data for your new chart whether it's something like a 3 minute chart or a Renko chart. This generated data is stored in the historic data folder in real-time as the driver chart updates. Then to see this generated chart you go to the File | Open Offline chart menu which shows all the historic data files. Scroll down to find your generated chart and select it and voila!



Step By Step
Here are some step by step instructions. We'll use the PeriodConverter script to illustrate the process as this script comes with every Mt4 installation. We'll use this script to create a 3 minute chart.



1. The first thing you need to do is to make sure that you have Autotrading enabled otherwise you'll spend a lot of time scratching your head as to why it's not working. Look for the  Autotrading icon in your toolbar at the top and make sure that it shows a green triangle not a red square.







2. For this example your driver market should be an M1 chart for the market that you're interested in. We'll use EURUSD as an illustration. So first bring up an M1 EURUSD chart. It doesn't need any indicators etc. and it doesn't matter what it looks like. You just need it to be up. The important thing to remember is that you need to keep this driver chart up the whole time that you are using the offline chart, otherwise the offline chart will stop updating.



3. Next find the PerdiodConverter script in the scripts section and drop it in your M1 EURUSD driver chart. The input dialog box for this script will appear with one input variable on the "Inputs" tab which is the Period multiplier factor. In our case we want an M3 chart so we want a multiplier factor of 3. Enter that in the input field and click OK. 

3. At first glance nothing will appear to have happened. However if you look on the Experts tab of the Terminal window (Ctrl + T if it's not showing) then you'll see a message looking something like this:


4. Next we need to go to the File | Open Offline menu option which will bring up a dialog box showing all the history data files. Scroll down until your find the one which is labelled EURUSD,M3 . Highlight this and then click on the Open button. This will open up the chart. 

5. That's it! The new chart will update almost in real-time (it's programmed in the script to update every two seconds) and you can do all the usual stuff like add studies, EA's and trade off the chart etc.

The finished EURUSD M3 chart
Just remember, you need to keep the driver chart (EURUSD M1 in the example above) running for the Offline chart to update. 

Different Time Periods
If you wanted something like an H8 chart, instead of using EURUSD M1 as a driver you would use EURUSD H1 and then a multiplier factor of 8 etc. So just work out what driver time period makes the most sense for the chart period that you are after and then use the appropriate multiplier.