How To Use Custom Timeframes in MetaTrader

As a swing trader, I’m traditionally trading setups on timeframes like 1H, 4H and daily. In the past couple of months, however, I’ve changed my approach a little and will often trade other time frames such as 2H or 8H too. My Trade Advisor members have seen and used these custom timeframe setups to their advantage many times.


The reason is that sometimes, a setup is just too granular to be traded on the 1H charts but too coarse to be traded on the 4H charts. The same goes for the 4H and daily timeframes: sometimes, a setup just looks the best on the 8H charts.


8h charts

The trend on the 8H chart (left) looks much nicer
and respects the moving average better than the 4H chart (right).


Timeframes are mostly synthetic anyways. They’re something that we made up to make sense of the never-ending stream of price action. To do that, we timebox that data into manageable chunks of one hour, four hours or a day. We synthesize the data into a single candle.


However, there’s no rule that says that a 4H chart is more valid than an 8H chart.



The Problem


Now, charting software such as can display charts using any arbitrary timeframe. If you feel like watching the 18-day charts, you can do so easily! But software like Metatrader can be a bit more rigid with how it deals with time frames.


Have you ever tried to display a 2H chart in Metatrader? Feel free to look if they have an H2 button on their toolbar:





So how can you show charts with custom timeframes? As it turns out, there’s a way.



The Solution


We’re not going to be able to change the above toolbar to add buttons to it. Unfortunately, Metatrader doesn’t let us. But there is another solution and it only requires a simple three-step process. Let’s get started!



1. Round down to a lower timeframe


We are going to take a standard timeframe that is lower than the one we want and then multiply it to get to our desired timeframe. Let’s explain with an example.


Let’s say you want to have 2-hour charts. For this, you would start with a 1H chart, because you can multiply it by 2 to get to a 2H chart. How about when you want an 8H chart? There are two ways: either you go with the 1H charts and multiply them by 8 or you go with the 4H charts and multiply them by 2.


custom timeframes


Final example: you want to have 5-day charts. It makes the most sense to round down to the daily charts and use a multiplier of 5 to get to the desired result.



2. The PeriodConverter Script


Let’s say that we want a 2H chart on EURUSD. We know that we first need a 1H chart for this and then use a multiplication factor of 2. But how do we get the actual 2H chart?


For this, we will need the PeriodConverter script. This script will take one chart as the input to generate the data for your desired chart. This resulting chart is called an offline chart, as it doesn’t directly receive its input from your broker, but instead gets updated using our PeriodConverter script.


Start with opening the initial 1H EURUSD chart, like this:


eurusd 1H chart


Now, attach the PeriodConverter script, which should be in your Scripts folder in the navigator, to your chart:




When you do this, you should see the following window pop up. You need to check two things:

  • In the Inputs tab, make sure that the multiplier factor is set correctly.
  • In the Common tab, check “Allow DLL imports“. This allows the script to update the offline chart in real-time.


periodconverter window



That’s it! We’re done with step 2!



3. Open the Offline chart


The last thing that we need to do is to open our new offline chart. For this, we need to go to the File menu and click “Open Offline”:


open offline



The following window should pop up. Select the EURUSD,H2 chart and you’re good to go:


eurusd h2


Here’s the end result, side by side. 1H chart on the left, 2H chart on the right:


side by side





Even though MetaTrader doesn’t support this out of the box, we can still have custom timeframe charts. Once you know how to do this, it’s quite easy to do and generally works just as well as normal charts.



Have you ever used non-standard timeframes in your trading? Let me know in the comments!


Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrShare on RedditDigg thisShare on StumbleUpon


I'm a full-time, independent forex trader. I've been trading for over 10 years and specialize in price action trading, reversal trading, trading psychology and algorithmic trading. If you're determined to become a pro trader, I offer select consulting and coaching services. When I'm not trading, I'll either be travelling the world or rock climbing (likely both). Read my story here.