How to Create Custom Time Frames in MetaTrader 4

MetaTrader 4 Custom Timeframes

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 MT4 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 automatically backtest trading strategies.

Users of MetaTrader 4 also enjoy a community of traders that program and freely 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 just about any trading strategy can be programmed.

Even with all its flexibility, MetaTrader 4 does have its limitations. For one, constant volume charts (also known as tick charts) aren’t available for MT4 by default. I’ve written an article on how to create tick charts in MT4, but I’m still keeping my eye out for a more practical solution.

I still haven’t found a single tick chart solution that doesn’t have to be rebuilt each time the custom tick chart or the MetaTrader 4 platform is closed. If you switch between profiles often, 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.

Note: MetaTrader 4 comes with a PeriodConverter script, but it has to be reapplied to your charts every time you restart the platform. The indicator downloaded from this page does not need to be reapplied to your charts after each restart.

Use the 7-step process below to create custom time frames in MT4:

Create Custom Chart Times with this Easy-to-Use MT4 Period Converter Indicator

Step 1 – Download the custom P4L PeriodCon 509 indicator.

Step 2 – Move the extracted file to your Indicators folder (File > Open Data FolderMQL4 > Indicators).

Step 3 – Start or restart MetaTrader 4.

Step 4 – Open a chart of the currency pair that you would like to make a custom time frame for.

Step 5 – Open your “Navigator” window (Ctrl+N), if it’s not already open, and drag the custom MT4 period converter onto your desired chart.

MT4 Period Converter

Step 6 – Adjust your settings under the “Inputs” tab, if needed and click “OK”. The only setting that most of you will need to adjust is the value for the “PeriodMultiplier” variable.

Note: Under the “Common” tab, make sure “Allow DLL imports” is checked or else this indicator will not work.

In the picture above, the “PeriodMultiplier” variable is set to a value of 2. This number can be changed to whatever you like. The chart that you apply this indicator to will be multiplied by this number.

Example: If you apply the MT4 period converter with the setting of 2 (above) to a 5 minute chart, this would produce a 10 minute chart. If you change “PeriodMultiplier” to 4, that same 5 minute chart will produce a 20 minute chart.

You can also 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.

Custom Chart Times MT4

Step 7 – To use your 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 above.

Navigate to and open your newly created custom time frames (see the picture below). Your new custom chart times will stay active, as long as the original chart (the one that you applied the MT4 period converter to) stays open.

Custom Time Frames MT4

Important! You must keep the original chart(s) open (the ones that you applied the indicator to) or else your newly created custom time frames will not update in real time.

How I Trade with this MT4 Period Converter

If I’m setting up my charts to trade a multiple time frame strategy, I could create groups of 3 custom time frames that are 3 periods apart from each other. Something like this: GBPUSD 8 Hours – 1 Day – 3 Days (8 Hours x 3 = 1 Day x 3 = 3 Days).

To accomplish this, I open a GBPUSD chart and select the 4-Hour default time frame in MetaTrader 4. Then I apply the custom MT4 period converter to my 4-Hour time frame with the “PeriodMultiplier” variable set to 2. This creates an 8-Hour custom time frame.

Since the 1-Day time frame is available by default, I simply need to open a new GBPUSD chart and set it to D1. Next, I apply a second instance of the custom MT4 period converter to my original 4-Hour chart. This time I set the “PeriodMultiplier” to 18, which produces a 3-Day chart.

Note: I could also apply the custom period converter to my 1-Day chart and set the “PeriodMultiplier” to 3 to produce a 3-Day chart.

Now, I have a short, medium, and long time frame group for swing trading setups. Lastly, I would save this as a separate profile for this currency, and call it something like GBPUSD 8H-D1-D3 or GBPUSD Swing Trade.

This way I can open other charts and profiles, but you can always come back to my custom GBPUSD profile without having to go through these steps again. I personally use a separate profile for each currency and relative time frame (e.g., GBPUSD Short, GBPUSD Medium, GBPUSD Swing Trade, etc…).

Note: Although this custom MT4 period converter is a big improvement over the default script, it can still be resource hungry when many custom charts are open at once. Setting up groups of custom chart times in separate profiles can save you some headaches, and your CPU will thank you.

Multiple time frame trading is a popular technique. It’s great for timing entry triggers and making fractal energy observations.

In the past, I used these custom chart period groups in MT4 regularly, so I figured you might find this guide helpful.  Now you know how to create your own custom time frames for MetaTrader 4 by using this free MT4 period converter. If you have any questions, please leave a comment. I’m happy to answer them.

121 thoughts on “How to Create Custom Time Frames in MetaTrader 4”

  1. 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 🙂

    • 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, for the kind of trading that I do (mostly swing trading), I doubt that I would see much improvement with a better feed.

  2. 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?

    Thanks,
    Ross

    • I have no idea. I can’t say that I’ve ever encountered that problem. It’s not necessary to use the 1 Minute chart to get accurate results with this indicator. Just apply it to a longer time frames, if you need to, to get longer custom time frames.

    • 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.

    • Hello Mark,

      Thanks for commenting. If you’re compiling, you didn’t download the indicator from this site. I’ve uploaded the ex4 precisely so we wouldn’t have to compile. The mq4 file doesn’t work. The ex4 file still works on the newest mt4 builds. Just download the indicator from this page, delete or remove the one you have in your MT4 installation, and you should be good to go.

    • I didn’t have the mq4 file before, but I found it recently. If anyone wants to try and update it for us, leave me a comment. I’ll send it to the email address you use.

      FYI, the ex4 file still works for now. I’m still using it.

  3. Converting a m1 Chart to a e.g. m10 Chart worked very well. How can I store the new m10 data list as a csv-file? (when pressing F2 always the timeframes of the historical data of the Broker will appear, missing m10).
    Please help.

    • The script and indicator mentioned above both create modified offline charts. I guess, when exporting to a csv file, offline charts are not available. I’m not really sure if that’s the problem, but that would be my guess. I’ve never tried to do this.

  4. Hi,

    I found so useful this period converter, thank you.
    My only problem, that I do not know how can I use this for EA in offline charts?
    There is not possible to select M2 timeframe in the Strategy Tester built-in MT4.

    Can you help me?
    Thank you!

    Kind regards,
    Attila

    • Sorry Attila. I’m not sure. Have you tried deselecting the “Offline chart” checkbox under “Common” in your offline chart’s Properties (F8)?. You may have to manually backtest strategies involving your custom time frames.

      I think you can use custom functions to get desired time frames in your EA, but I really don’t know how that would work in backtesting. I’ve never personally used Strategy Tester with any seriousness. I’ve always been a manual trader.

  5. Many thanks for your work, Chris! One question I have though – how could I create multiple offline charts in parallel (all at once), when just applying the indicator to a 1Minute chart once? I have a high number of currency pairs I would like to have created many offline charts against, though I would like to find a way to accomplish the same with just dragging the indicator to a 1-minute chart once, not having to re-apply the indicator each time and then having to manually enter the new time-frame for the offline chart. Can this be accomplished in some way?

    • Hello Revald,

      You can apply the indicator to your 1 Minute chart multiple times. For instance, you can apply the indicator and change the multiplier to 10 to get a 10 Minute chart, and then apply the indicator again, to the same chart, and change the multiplier to 20 to get a 20 Minute chart.

      As far as not having to re-apply the indicator each time, once you set it up once the way you need it, just save that setup as a profile. That way you can switch away to other chart setups and always come back to that setup without redoing anything.

      Keep in mind that using this indicator to create many custom time frames at once can slow down MetaTrader 4, so it’s helpful to split your charts into groups in separate profiles if you use many charts. For instance, make a separate profile for your EURUSD, GBPUSD, etc., or separate them by short, medium, and long time frames.

      I hope that helps. Good luck!

  6. Hey Chris,

    Thanks for supplying this custom indicator as it is exactly what I have been looking for. Do you have any documentation on how to apply the other inputs in using it. The reason I ask, is that I’m trying to change the candle open time as per one of the earlier comments above, and I’ve been playing around with the time shift and candle shift without much luck. Nt sure what I should be doing here or exactly how it works. I’m also curious about the other settings that refer to inverted etc. Thanks.

    • Hey Jim,

      I’m glad you found this indicator useful. I didn’t create this indicator, so I’m not sure about documentation. You can shift time by hour and minute with TimeShiftAdd_in_HptMM (1.3 = 1 Hour and 30 Minutes forward), or you can shift time by bars with TimeShiftAdd_in_Bars (-2 = 2 bars backward).

      I’m not sure about the inverted output feature. That may have something to do with exporting your history. You’ll have to play around with it.

  7. Avoid this BS indicator. Crashed my MT4 cannot get my charts and settings back. Freezes and locks up immediately. This converter/indicator is garbage. dont waste your time with this. Just trade the charts MT4 offers you,

    • Hey Jo,

      Thanks for the comment. I’m sorry you’re having a problem. After reading your comment, I downloaded this indicator again and installed it. Everything is working fine, as usual, so it sounds like it’s an issue on your end – maybe a conflict between MT4 and another one of your installed programs.

      You could try to reapply this indicator to a fresh install of MT4 after backing up your templates and other indicators.

  8. hi Chris, i have done everything as your guide but when i fresh my chart it still look the same, what happen? I actually wanted to have 2hour chart but MT4 doen’t has it, so find that your add on indicator will be very usefu for me but unfortunately it i don’t get as what you guide. please advice thanks

    • Hello emma,

      I just redownloaded the indicator to make sure everything is working right and it is, so it would appear to be an issue on your end.

      I think it’s probably one of two things. When you said, “I fresh my chart” it makes me think that you believe the indicator changes the chart you apply it to, but that’s not the case.

      1. Be sure to see Step 7. It’s a little farther down than the rest of the steps. In that step, I explain that, after applying the indicator to your chart, you need to find and open your newly created custom chart by going to your offline charts (File > Open Offline).
      Scroll down to the currency that you applied the indicator to and your custom chart should be in that list (Example: GBPUSD, H2).

      2. If you already went through all 7 steps, it’s possible that you missed an important setting. On the chart that you applied the indicator to, bring up your indicators list (Ctrl+I). Select the P4L PeriodCon 509 indicator and click “Edit” to bring up the original menu you saw when dragging the indicator onto your chart. Alternately, you can just delete the indicator and reapply it again.

      Under the “Common” tab, make sure “Allow DLL imports” is checked. If it isn’t checked this indicator will not work.

      Let me know if one of these steps solves the issue for you.

  9. Thank you Chris.

    I have been a silent reader but I truly appreciate you sharing all this. All your MT4 EA and Indicators have helped me a lot as well as your guide to import data to ForexTester.

    Keep up the good work.

    • Hey sara,

      Thanks for the kind words and for reading. I’m glad I’ve been able to help you. You’re using Forex Tester, so it sounds like you’re on the right track. Good luck!

  10. Hi Chris,

    Thank you very much for sharing this excellent tool.
    I’m trying to use this tool for backtesting purposes where I want to use historical data from an external source. I set up a fresh MT4 instance, connect to a demo account once and then block the connection by defining a non-existing proxy server.
    Now via the History center, I delete any history data still in memory and use the import button to import my M1 historical data (CSV file).

    After this, I restart MT4 and use the period converter script to create M5, M15, H1, H4, D1 and W1 data from the M1 data. I also tried to use your tool for this job, as it would potentially save a lot of time running the script time and time again.

    Unfortunately the indicator gives the error messages: “No offline chart because it already exists: EURUSD,M5 (shift 0min)”. I checked the offline chart window (“open offline”) which shows only the M1 chart.

    Is there a workaround for this? I do realize that I’m trying to use the tool for something it was not designed to do!
    Thanks, David

    • Hey David,

      Thanks for reading and commenting. I didn’t create this indicator. I just shared it here for you guys because I found it useful. There may be a workaround for what you’re trying to do. Unfortunately, I don’t have any experience doing what you’re trying to do.

      Sorry, I can’t be more helpful. Good luck!

  11. Hi Chris,
    I am trying to set up an EA that runs on 10 pairs and 6 different TFs, which includes 4 offline charts. I have been using your indicator to set up the offline charts, and in doing so it is by far the best indicator I have seen. However, my EA is not taking any trades on the offline charts. My coder has told me that the EA is not receiving the tick data on the offline chart so it is not able to take the trade. During the set up I have restarted MT4 many times, when I restarted MT4 should I reload your indicator onto the charts? I don’t understand the EA not receiving the tick data as I can see price changing on the offline charts. Any help you give me is much appreciated.

    Fergal.

    • It’s not my indicator, Fergal. Some EAs work on offline charts and some don’t. It has to do with the code of your EA. A couple of years ago, MT4 got an update from Ansi to Unicode. I’m not a coder, so I don’t know much more than that. If your EAs are using the outdated method of generating a fake tick, they probably will not work.

      You could try to de-select the “Offline chart” checkbox in the chart properties (F8) of your offline charts. That sometimes works. Aside from that, your EAs need to be updated.

    • Hello, mito. I haven’t used this in a while. I’ll have to take a look at in when the market re-opens.

      Update: This still works. You did something wrong. Make sure you don’t close the chart you applied this indicator to. In other words, if you applied this indicator to the 1-Minute chart to create a 2-Minute chart, you can’t close the original 1-Minute chart or else your new 2-Minute chart will not update.

Leave a Comment