How to Create Custom Time Frames in Metatrader 4

Free Video Trading Course

Note: The PeriodConverter script included in Metatrader 4 has to be reapplied to your charts every time you restart MT4. The script downloaded from this page does not need to be reapplied to your charts after each restart.

Have you ever wanted to create your own custom time frames in Metatrader 4?  I’m going to show you how to do just that with a cool, easy-to-use period converter.  Creating custom chart periods is easy with the free Metatrader 4 platform.

Metatrader 4 is an award winning Forex trading platform, and is the most popular trading platform on the market today.  With Metatrader 4 (MT4), you can create custom trading robots called Expert Advisors (EAs), and you can even backtest trading strategies.

Users of Metatrader 4 also enjoy a community of traders that program and share their own EAs.  In fact, most of the custom indicators, scripts, and expert advisors are built and distributed by this tech savvy user community.  Almost anything can be found, and any trading strategy can be programmed.

Even with all its flexibility, Metatrader 4 does have its limitations.  For one, tick (bar or candlestick) charts aren’t available for MT4.  Tick charts can be invaluable when trading news and other high volatility market situations, but the only tick chart solutions for MT4 so far are crude and frustrating to use.

I’ve yet to find a single tick chart solution that doesn’t have to be reset each time the custom tick chart is closed.  If you switch between profiles often, like I do, then something like that is simply not practical.

That being said, there are some features that Metaquotes (creators of MT4) overlooked that can be implemented fairly easily, and without a big headache from a practical standpoint.

One such feature that we can add is custom time frames, using a simple custom indicator for MT4 called a period converter.

Create Custom Chart Times in MT4 with this Period Converter Indicator

All you have to do is download the P4L PeriodCon 509 file, and extract it or copy it into the indicators folder of your MT4 installation (Metatrader 4 > MQL4 > Indicators).  The next time you start MT4, you can drag your period converter onto any chart.

Note:  In the Common tab check ‘Allow DLL imports’ and clear the ‘Confirm DLL function calls’ checkbox, or this indicator will not work.

In the picture above, the PeriodMultiplier is set to 2.  This number can be changed to whatever you like.  The time frame to which you apply the indicator will be multiplied by this number.

Example:  If I applied the indicator with the setting of 2 (above) to a 5 minute chart, this would produce a 10 minute chart.  If I changed the PeriodMultiplier to 4, that same 5 minute chart would produce a 20 minute chart.

It is also possible to add multiple instances of the indicator to one chart.  In other words, you could create your 10 minute and 20 minute chart from the same 5 minute chart.  You would just have to add two of the period converter indicators to your original 5 minute chart.

In order to use these custom time frames in Metatrader 4, you must find and open them.  All of your custom time frames can be found in your offline charts (File > Open Offline). See the picture below.

Navigate to and open your new custom time frames for Metatrader 4 (see the picture below).  The new custom charts will stay active, as long as the original chart(s) stays open.  Setting these custom chart times up in separate profiles can save you some headaches.

Here’s an example of how I use this tool in my trading:  I open a GBP/USD chart and select the 1 minute default time frame in Metatrader 4.  Then I apply the period converter to my 1 minute time frame with the PeriodMultiplier set to 2.  This creates a 2 minute custom time chart.

I then apply the period converter to my new 2 minute chart.  Only this time, I change the PeriodMultiplier to 3.  This creates a 6 minute custom chart.  I repeat the process on the 6 minute to produce a custom 18 minute chart.

Now, I have a short, medium, and long time frame for short term trading.  I would then save this setup as a separate profile for this currency, and call it something like GBPUSD Short or GBPUSD Pound Dollar 2-6-18.

This way you can open other charts and profiles, but you can always come back to your custom GBPUSD profile without having to go through these steps again.  I personally use a separate profile for each currency and relative time frame (i.e. short GBP, medium GBP, long GBP, swing GBP, etc…).

Multiple time frame trading is a popular technique.  It’s great for triggers and fractal energy observations.  I typically trade with 3 relatively close time frames, according to the Top Dog Trading method.

I use this everyday, so I figured you guys might find it helpful.  I’m not sure who originally contributed this custom indicator, but it has been crucial to my trading system.  If you would also like to create your own custom time frames, download this free period converter for Metatrader 4.

Download the P4L PeriodCon 509 Indicator

Are you still looking for a profitable trading system? Check out Top Dog Trading.



    • says

      Actually, Metatrader will only go as low as 1 minute. As far as I know, Oanda has a proprietary charting software that goes as low as 5 seconds, and I think they’re the only broker who offers such a thing. Google “oanda seconds chart,” and you’ll see what I mean.

    • says

      I’ve used them on offline charts before, but I’ve heard it both ways. I guess it depends on the EA. If it’s an EA that just needs to be run on the chart you are using, you could always just open another regular chart for your pair to run the EA on. 

      Also, the reason people usually say that EA’s don’t work on offline charts is because the offline charts don’t receive tick data, but this period converter gives the offline charts that you create tick data, so… I think most EA’s should work.

      Do you see what I’m saying? You are essentially creating active, custom charts out of offline charts using the period converter. My guess is that any EA should work on these.

  1. Charmy says

    Hi Chris,
    Thanks, this indicator is really useful.

    Do you know if there is an indicator where you can pick the time you want the period to start? e.g. I would like to set up a 12 hour period and have it starting at 9am and 9pm, instead of 0:00 and 12:00

    • says

      Not that I know of. Unfortunately, those periods are based on your Metatrader version. I’d like something like that as well, so that I could use NY based Forex charts for accounts abroad. I’ve never found anything like that, though. Let me know if you do.

  2. dlombard says

    thanks for the converter. does the offline chart need to be continually refreshed or will it update just like a regular chart? I can’t seem to get it to give me real time data without refreshing.

    • says

      It’s always given me real time data, but you have to keep the base chart open. In other words, if you’re multiplying a 5M chart by 4 to get a 20M chart, you have to keep the 5M chart open (with the converter attached).

  3. Damien says

    Go to scripts in mt4 and there is exactly the same period converter that you can drag on to your chart , then open offline chart with converted time.


    • says

      Damien, it’s not exactly the same, but it works the same way. That’s a new addition. Thanks for bringing it to my attention.

      As for your second statement, I never said you couldn’t have tick charts in Metatrader 4. I said it was not practical. Every time you close MT4, you have to wait for the tick chart to rebuild itself.

      I stand by my statement, and most traders who actually trade live with MT4 will agree with me. Tick charts aren’t practical in MT4 just yet. For that you need to use Ninja Trader, Trade Station, proprietary platforms, etc. Hopefully that will change in the near future.

  4. Jerry says

    Hi Chris: I have download the period converter and for some reason my platform is stuck. I can not click other window. How do I get rid off the offline window? Thanks

  5. Dave says

    This period indicator does not seem to work on the new build 604. Any advice to make it operational? I want to activate my Renko Charts on a 2 minute offline chart.

    • says

      Dave, sorry for the late response. I’ve had a lot going on lately, and I’ve been falling behind on the site duties a bit.

      I’m not sure why it’s not working for you, but all the new builds of Metatrader 4 that I have used have included a period converter script of their own that works just like the one I originally uploaded to this site.

      You should find what you’re looking for in your “Scripts” folder.

  6. Jon Sigal says

    Hi I am having problems with getting this indicator to work on my MT4 I put it in the experts/ indicator file close and reopen my MT4 see it on the customized list of indicators put when I click on it or drag it nothing happens? please help?

  7. Jon Sigal says

    I found the answer on a different blog: Because of the new mt4 upgrade to 600+ i think thats why its not working.. But the period converter thats in the code base of your mt4 platform work .. Its under the scripts section .. I just tried it out and works ..

    • says

      Yes… that was mentioned a few times above your first comment, but I’m glad you got it working for you. I need to update this article, now that MT4 includes this ability (and, like you said, the old indicator doesn’t work in the new MT4 builds).

  8. Bob says

    After add period converter example 2 hours, go to another profile 4 hours chats and come back to 2 hours charts profile, offline charts are not showing real time data. Again need to reload(drag period converter) to see real time data. Is any other ways offline charts still updated without reload period converter indicator

    • Chris says

      You always have to use offline charts when creating new timeframes, but they should work just like your regular charts. As far as switching profiles goes… I do this all the time without a problem.

      1. Make sure you’re using the built in period converter that is now offered directly from Metatrader 4.

      2. Make sure you save your profiles, and be sure you’ve included the original chart that has the period converter attached to it.

      Hope that helps. Let me know if you’re still having trouble.

  9. Sylvain says

    It’s so frustrating that MT4 creates a distinction between ‘standard’ timeframes, that can be opened immediately, and timeframes that are created by a script into a datafile.
    I am trading on multiple currencies, and my main EA takes decisions by looking at different distances to the market, I need at least 3 timeframes for each currency. When I realised that an indicator is able to take any of the enumerated timeframes BUT returns 0 if it’s not M1, M5, M15, M30, H1 etc, I was so disappointed. MT4 isn’t even able to return an error message to state the chart isn’t available.
    This article is very, very useful. Thank you.

    • Chris says

      Yeah. I use a bunch of indicators that work fine on the offline charts, but no EAs. Any EAs that I use (for break even, stop loss, etc.) can be added to the original base (standard) chart. Hope you get it working for you. Good luck.

  10. Sylvain says

    Ok, I have now imported this custom indicator into my Oanda MT4. If I attach it to a chart, nothing happens. No error message. No message in logs.
    Is it really compatible with MT4? as I see it was written in 2005.

    • Chris says

      Hello, Sylvain. All the new Metatrader 4 builds come with this script now. Just go to Scripts (under Indicators and Custom Indicators). The script is labeled PeriodConverter. Drag that onto a chart and change the Period multiplier factor to whatever you want (depending on what time frame you are trying to create). Remember to go to File > Open Offline to find your new chart. Also, remember that you have to keep the original chart open as well (the one that you dragged the PeriodConverter script onto). Hope that helps you.

  11. Duane says

    Hi, I have MT4 build 765 using the built in periodconverter script. The problem is the script gets removed when I close the platform. Is there a way to keep it on the chart when closing and reopening MT4?
    Thanks in advance

    • Chris says

      I’m not sure what the problem is. I have build 765 as well, and I’m experiencing the same issue you’re having. I just re-add the script to my original chart each time. It’s a pain. Hopefully they’ll get it sorted out by the next build, since this script adds a lot of functionality to the platform.

      • Duane says

        thanks for the reply. Its been a while since I’ve used that script, but I sure thought it stayed when opening and closing the platform. And thanks for the conformation I’m not going bonkers… yes hopefully this will get fixed. Maybe removing this script on close is by design, anyway to confirm that?

        • Chris says

          No problem. I’m not sure if it’s by design or not. If it is, that is a step in the wrong direction. You’re right; this script used to remain attached to a chart after reopening.

  12. Chris says

    Good news! I found a script that doesn’t need to be reapplied each time you open MT4. I’ve uploaded it to the site, and linked to it in the updated article.

  13. Peter says

    yep, script dropping is a pain – Have set up snapshots of 12 charts each with a different pair as an overview on M3, based on M1 multiplier of 3, and have to reload script on all 12 charts. I would be interested on updates if this is solved.
    Just spotted your update Chris THANKS

  14. Peter says

    only issue I have found is is VERY resource hungry – bogs my i7 PC down to a stop for minutes at a time

    • Chris says

      I’ve never really had that issue with it. Are you talking about the updated script? Then again, I only do 3 time frames for a single currency in each of my profiles that use the Top Dog Trading system.

      It may just be too many charts open at once. You might try saving a handful of them in separate profiles or something similar.

    • Chris says

      No. Sorry. There was a script floating around, but it was impractical for me to use. You had to let the script rebuild the chart every time you restarted MT4. I may eventually try to find it again (or something similar), and put it up on the site.

  15. Peter says

    yes too many charts open! (the P4L ….. 509 indicator).
    I am just after a market overview various pairs so I can quickly zero in on what I wish to trade.
    Hi Chris, Had to open up data files and set aside half of the charts at a time in the profile so I could re-open platform and regain control to do adjustments. My indicator set up also resource hungry.
    A little bit here and a little bit there have optimised everything.
    I have adjusted the refresh rate to 3000 ms, stripped all my charts down to bare minimums, and split one profile into 2 – and now it is acceptable.
    Thanks for pointing out the indicator in pref to the script. too many charts to refresh the script each time. You have provided really good service to people over many years – champion!

  16. Ondrej says

    Do you have any experience with renko charts? On old versions I could just add a renko ea on 1m chart and would automatically generate m2 offline with renko chart) but since the new version the ea doesn’t generate m2 and when I use the scrip to generate m2, renko is missing.

    • Chris says

      No. Sorry. I’ve seen them, and read about trading systems that use them, but I don’t have any experience actually trading with renko charts. Sounds like that particular EA is conflicting with the script. I’m sure there’s another way to get renko charts out there. You might just have to try a few different approaches.

  17. Adi says

    hai, Chris.. just a question..
    do you know anything about backtesting?
    can u explain how to do it?
    thank you

    • Chris says

      I don’t use MT4’s built-in backtesting, because all of the trading systems that I use are manual systems.

      I’ve got a few tips for backtesting, but forward testing, in real market conditions, is my preferred way to test any new trading system or technique.

  18. Jono says

    Thankyou Chris really easy to use and set-up. I was getting annoyed with having to re set it up every time I restarted mt4. Now I just wish metatraders had better data feeds lol but that would be wishing too far. Really helpful tool mate :)

    • Chris says

      Thanks for the kind words, Jono. Yes, it’s annoying to reapply the script over and over again. I’m glad I found this one, and I’m glad you found this article useful.

      I agree on data feeds. Although, even if you pay for better feeds they cannot be guaranteed for intraday Forex trading. You’ve got to trade futures, or other markets to get that. Daily candles or higher are obviously guaranteed, though.

  19. Ross Fone says

    Hi Chris,

    Any idea as to why when using P4L PeriodCon 509 when using 1 minute data and creating say 30 or 60 min data, the data created starts at 10:00 am and ends at 23:00 pm? Where is the rest of the hours between 23:00pm and 10:00 am?


    • Chris says

      Are you checking “Allow DLL imports”? I’m not sure what the problem is. Try the built-in script in MT4. If you can get that to work, this should also work.

  20. Mark says

    It does not work.
    When compiling there is an error in line 1030 ” ‘gwstr’ – parameter conversion not allowed

    MT4 Build 840

    • Chris says

      That’s unfortunate and frustrating for me. Every time I add a working indicator or EA to this site, MT4 makes it obsolete. You can always use MT4’s built-in script, but you have to reapply it each session.

    • Chris says

      I don’t have it either, but if you can find an old version of MT4, you could get run the ex4 and get it. Just a thought.

Leave a Reply

Your email address will not be published. Required fields are marked *