Period Converter Optimized

0
(0)
Name:
Period Converter Optimized [ ru ]
Author: wfy05 (2005.11.29 15:11)
Rating: 20
Downloaded: 43026
Download:
Period Converter Optimized 1
 Period_Converter_Opt.mq4 (15.4 Kb) View
Period Converter Optimized 2 CPU.gif (12.8 Kb)
Period Converter Optimized 3
    Lastest Version: 1.4

2005.12.24  1.4      faster to detect if data changed by removing float point  operations, added support to output CSV file in real time.
                            OutputCSVFile = 0 means no CSV.
                            OutputCSVFile = 1 means CSV + HST.
                            OutputCSVFile = 2 CSV only, no HST .
                            (useful if you want to generate CSV for builtin periods)
                            CSV Filename will be the same as HST file except the extension added safe checking for PeriodMultiplier.

    Screenshot is the CPU cost on P4 1.8G when refreshing with M1->M3, M10 and H1->H2 together.

    The steps to use the script after installing is almost same as the default MT4 period converter.
    Use this script to make nonstandard timeframe of symbol based on standard timeframe. For example, to make 3-hours timeframe H3 for selected symbol you 
should:
    1. Open H1 chart.
    2. Attach to chart 'Period_converter_opt.mq4' MQL4 file from 'Custom Indicator' folder of 'Navigator' window.
    3. On 'Common' tab check 'Allow DLL imports' checkbox.
    4. On 'Inputs' properties tab please set 'PeriodMultiplier' variable value to 3 (you'll get H1*3 = H3).
    5. Click OK.
    6. Open H3 chart in offline mode ('File – Open Offline'). H3 chart will be updated real-time (by default) while H1 chart with attached 'Period_converter_opt.mq4' 
running.

    Read below for more details:
I. Features:
This is an improved version of period converter for MT4 based on the MT4's default period converter by metaquotes. The default period converter script do not 
support real-time refreshing, and consume lots of CPU (50%-9x%) making the whole system slow. Also, the default one is a script which do not save when you 
exit MT4, so you have to apply every converter script again after restarting, quite annoying. This one fixed all above problems:
1. Real-time updating or custom interval millisecond level updating.
2. Low CPU cost, average 5%-10% or less.
3. Works as an indicator, so can be saved and reloaded during restart. 
4. There is no one converter per chart limitation as it is not script any more, you can only use one window as source to generate as many new timeframe chart 
as possible.
5. Auto updating if there is new history block loaded.

II. How to use:
Copy the mq4 file to your MT4 indicators folder (experts\indicators) to install it as an indicator, NOT script. then in the custom indicator list, attach 
period_converter_opt to the chart you want. It support 4 parameters:
PeriodMultiplier:    new period multiplier factor, default is 2;
UpdateInterval:      update interval in milliseconds, zero means update real-time. default is zero;
Enabled:             You can disable it without remove it with this option.
Other parameters are comments or for debugging, it is safe to ignore them. Also Make sure you have Allow Dll imports option checked in common tab or it won't 
work. After that, File->Open Offline to open the generated offline data. then the offline data will be updated automatically.

    As long as you keep the source chart open and the converter indicator running, the generated chart including indicators inside will always be updated. also 
you can close the generated chart and open again later from File->Open Offline without problem.

    If you want to quit MT4, you can leave those offline chart as other normal online charts. when you start MT4 next time, those charts will also be loaded and 
updated.

III. Notes:
1. Do NOT uncheck the "offline chart" option in offline chart common properties or after MT4 restart, it will treat that chart as online chart and request the data 
from server, resulting empty chart window.

2. You can attach more than one converter to same window with different PeriodMultiplier, e.g: you can attach 3 converter with PeriodMultiplier = 2, 4, 10 to M1
to generate M2, M4, M10 at the same time. It is even ok to use the M1 chart to generate Hourly chart like H2, which only cost a few more CPU resource during 
initial conversion. but usually most server don't have much data for those short period, resulting the generated data isn't long enough for long period. so it is 
suggested to use Hourly/Daily charts as source when needed.

3. The real-time updating mode updates quotes as fast as possible, but as this is done via script, and MT will skip calling start() function when your PC is busy 
and lots of quotes income. anyway, this seldom happen, and you can at least get 10 updates each seconds which is much more  than enough.

4. The offline chart don't have a bid line showing in chart, but all data in the chart including the indicators is still being updated, so don't worry. you can show 
the bid line by unclick the "offline chart" option in chart properties. but which don't helps much and if you forget to check "offline chart" option before exit. It 
will cause errors and become empty on next startup. you have to close the window and open again from File->Open offline, which don't worth the trouble.

IV. History:
2005.12.24  1.4      faster to detect if data changed by removing float point operations, added support to output CSV file.
                            OutputCSVFile = 0 means no CSV;
                            OutputCSVFile = 1 means CSV + HST;
                            OutputCSVFile = 2 CSV only, no HST;
                            (useful if you want to generate CSV for builtin periods)
                            CSV Filename will be the same as HST file except the extension, added safe checking for PeriodMultiplier.

2005.12.04  1.3      Fixed missing data when there is large amount of data loaded in several blocks, and support auto updating when new history is loaded.

2005.11.29  1.2      Additional fix for missing data and server changing.

2005.11.29  1.1      Fixed missing partial data after restart. Reinitialize after changing server or data corrupted.

2005.11.28  1.0      Initial release
9 comments  To post a new comment, please log in or register

This indicator works, but took too much processor power to run. Can you change that?

10.01.2013 12:12 edwinodus

frederick wrote:
When MT4 is closed and reopened with the "breeder" chart intact, the created timeframe charts are as dead as a doornail!

I read something similar on another site/thread concerning an indicator generating constant range bars. The cure was to put it in the experts folder, not the indicator folder.

15.04.2010 15:59 WHRoeder

I encountered some problems with this indicator... so I created a new derivative version called "P4L PeriodCon.mq4" (v1.6) that is posted on ForexFactory.com (http://www.forexfactory.com/showthread.php?t=206301). (If such links are unwelcome here, I apologize; please remove it).

See my post on ForexFactory for complete details...

One problem fixed is that if you create an offline chart, e.g. EURUSD,M20 and open up more than one chart, the 2nd-Nth charts do NOT live-update! Only the first chart does -- but my version fixes that.

A new feature added is to support a user-defined timeshift of any value (so long as it's a multiple of the source chart). Any offline chart can be timeshifted, not just Daily charts. Furthermore, you can generate any number of timeshifted charts from a single source chart just by adding additional instances of the indicator. (I'm sure the more you add it will affect CPU performance, but like v1.4, my indicator is tick-based and has the ability to delay by msec, so performance should not be as big a problem as the earlier script version(s) ). About timeshifted charts, please note the "Symbol()" name is changed, e.g. "EURUSD+2H". Most indicators, EA's, and scripts should work but some may need modification if either Symbol() name is critical, or, if they don't understand how to deal with the relative time-shift between the offline chart and other data sources). I created a new "P4L CandleTime.mq4" script (also on FF) that properly accounts for the timeshift when it reports the bar-remaining-time.

So, yes, one can generate timeshifted charts that display local timezone instead of the broker timezone. One can also generate Daily charts (or H4's) shifted by any number of hours. If you want to align with NY close, 17:00:00 ET, for many broker feeds this will result in a 5-day-per-week Daily chart rather than the more common 6-per-week which have very short Sunday (or Sat) bars.

I have been able to add several instances of the indicator to a source chart, generate multiple offline charts (either unique timeframes and/or timeshifted ones) and then open all those offline charts at once, including multiple of the same offline chart. All of them update with incoming ticks. The live updates also work after quitting and restarting MT4, so long as the source chart remains open. I can't say whether every broker feed is the same, but... it works for me.

The original authors (and "rangebound" of FF who provided some key tips) are graciously acknowledged for their earlier contributions.

15.11.2009 07:54 pips4life

Thanx a lot was very useful for me

23.10.2009 22:40 mirgiyos

works for me perfect I recommend this one vs original one

19.10.2009 13:47 worst_trader

Thanks for your work, but I'd rather use the original one...

11.08.2009 19:37 ppc123

Off again, on again, off again.   This is my third post on this indicator.  At the time of the second post, all was looking good, and the problems referred to in the first post were not occurring.  But now they are.....

After experimenting wilth this indicator, it seems the bottom line is that it works if you use just one chart to breed just one custom timeframe.   Contrary to what the author is saying about this indicator, I cannot get more than one custom timeframe from any "breeder" chart.   Additional timeframes do not refresh.  In fact, once one custome timeframe is running off of a "breeder" chart, this indicator does not work again on that same "breeder" chart, nor on ANY OTHER chart......for the same or ANY OTHER currency pair.

In other words. I can get the indicator to work ONCE, and it does great!  But I cannot get it to work AGAIN on the same, or on ANY other chart.  If I want another custom timeframe, I must first close the only one that is successfully running!

This is a great indicator!   It would be truely great if it did all the author says it will do!  I, for one, would like to have a couple of special timeframes open and running on a couple of currency pairs at the same time.  But even if that is not possible, I would at least like to have more than one custom timeframe running on one pair.

28.02.2008 12:53 frederick

My apologies to wfy05, the author of this fantastic custom indicator.  Now it is working.  What did I do differently?  I do not know.  This time, during life market hours, I used the 1 minute chart to generate a 3 minute chart (as experiment).  The 3 minute chart continued working as I clicked around to other charts and came back to it.  I even turned MT4 off and reopened it and found the 3 minute chart still working whenever I clicked on it.

Thank you, wfy05, for a greatly appreciated indicator.

Now, if you could just make another indicator that would enable conversion of MT4 time to user time in the Data Window.........

28.02.2008 11:59 frederick

I am sorry to say, the author of this indicator is wrong when he says created charts will update automatically, just like built in charts, so long as you leave the " breeder" chart also active.  It does not work.   When MT4 is closed and reopened with the "breeder" chart intact, the created timeframe charts are as dead as a doornail!

Can the author of this indicator fix this?

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?



Author: Forex Wiki Team
We are a team of highly experienced Forex Traders [2000-2023] who are dedicated to living life on our own terms. Our primary objective is to attain financial independence and freedom, and we have pursued self-education and gained extensive experience in the Forex market as our means to achieve a self-sustainable lifestyle.