Last update: Feb 17, 2014 , uploaded sample templates. (Build 600 harmonious ).
Last P4L PeriodCon.mq4 upgrade: Feb 14, 2014, uploaded P4L PeriodCon 509. Ex4 (still v1.11)
Last P4L getPeriodSymbolTimeshiftsecLib.mq4 upgrade: Apr 01, 2011, published first launch v1_0
There have been a number of variations of period converter progr that were first created in late 2005 and then upgraded into early 2006, but since thenthere have never been any upgrades (to my understanding ) or answers to a number of the limitations -- till now.
A new version (gt;= v1.6) is supplied which I have renamed to P4L PeriodCon.mq4. (It's a derivative of previous variants called: periodcon.mq4 (v1.5 and v1.4), Period_Converter_Opt. mq4 and Period_Converter. Mq4 Previous authors (if known) are imputed in the origin, and also their earlier contributions are graciously acknowledged).
New attributes:
* (Additional in v1.11) Variable InvertChart was added. If set to True, an chart is output using the I as a prefix to the symbol name. (e.g. iEURUSD)
These external variables also apply:
InvertedOutputMultiplier = 1.0 The inverted prices are InvertedOutputMultiplier/price.
InvertedOutputDigits = -1, where -1 is Automatic, or so the user can manually set to gt;= 0
Example: Invert USDJPY to get iUSDJPY (same as JPYUSD). Establish InvertedOutputMultiplier=1000.0, also set InvertedOutputDigits=3 (or 4). A price of 79.275 would generally invert to 0.012614 but using these overrides, inverted price would be 12.614
* Multi-chart live-updates work! The old versions could just live-update (tick-by-tick) a *single* offline chart using a specified name. You can generate, e.g. an M20 (offline) chart and open it, but if you opened a 2nd-Nth window(s) of the same M20 (offline) chart, these did not get live-updates! With a few tips from FF user rangebound (Thanks!) , a new approach was invented that updates and finds as several charts of a specific title as you open. (FYI, if you just open ONE of every offline chart and if you want to save CPU, there's an external factor (LiveUpdateMultipleCharts) you can change to false. But in my experience CPU performance hasn't been a problem with the new multi-chart method).
* Complete support for timeshifts (offsets) for any interval chart. Previous version v1.5 had the capability to generate a single Daily chart with one timeshift, but this new version can open several charts -- and of any timeframe, not only Daily -- in which the user can specify any timeshift cancel desired (plus or minus). HOWEVER: The timeshift *must* be an exact multiple of the origin interval: 90min timeshift is authorized on a supply M30, M15,... or not as, but prohibited on H1(60min) because it is not an exact multiple (i.e. 90/60 equals 1.5 that isn't an exact multiple such as 1,2,3,...).
* Timeshifts are currently specified either in #bars, or together with the new number structure, H.MM,... or both can be utilized (as of gt;= v1.7).
Change the external factor TimeShiftAdd_in_HptMM out of 0.0 to a number. Examples:
1.0 Timeshift 1hour forward (later). If your broker time states 22:45:00, subsequently the timeshifted offline chart time will probably be 23:45:00
0.9 Timeshift 90 minutes forward.
1.3 Timeshift 90 minutes forward (like in 1 hour 30 minutes = 90min complete , same as 0.90 )
-0.20 Timeshift 20 minutes backward (sooner ).
-5.0 Timeshift 5 hours backward (To get a GMT broker period, the chart would then exhibit NY local time)
(Reminder, the timeshift must be an exact multiple of the origin interval (in minutes) ).
Should you prefer setting bars, then use variable TimeShiftAdd_in_Bars (in gt;= v1.7). The timeshift (in minutes) is subsequently the #bars * Stage (of the origin chart).
NOTE: These two variables for timeshifts are BOTH in effect and the values will combine (transformed to minutes) if you use both variables.
The very evident appliions of timeshifts would be:
- Open a chart using a timeshift such the X-axis displays your regional times rather than the broker times.
- With a single MT4 feed, produce H4 and Daily charts in which the daily 00:00:00 new bar time was shifted by any number of hours, to see the very same candles as are seen on additional broker feeds that have a distinct native broker time (e.g. GMT vs. GMT 2 vs. GMT-17 etc.) You can pick if you would like new Daily candles to happen at London open, NY open, NY close, etc..
- Produce M45 candles but shift the bar start time as desired, to align using a time such as NY open (8AM ET) or NYSE open (9:30AM ET).
- Buy a 1minute headstart on a bar close by shing it 0.01. (How? Utilize an M1 chart to generate a higher TF chart timeshifted from 1M)
- Generate a Daily chart with 5-bars-per-week rather than the common 6-bars-per-week! Example: Imagine your broker time is 00:00:00 exactly the same time as GMT. NewYork is GMT-5 that is 19:00:00. Your broker closes on Friday lt; 17:00:00 NY and reopens on Sunday gt;= 17:00:00 NY. Your Daily chart has. Thus, you can generate an offline xxxxxx 2H,Daily chart which will remove the Sunday bar *! If your broker has just 24*5=120 (or less) bars-per-week, and if you currently have a brief Sunday (or Saturday) Daily bar on your chart, then you can choose a suitable timeshift to eliminate your extra (brief ) Daily bar!
- Traders who search for candlestick patterns can try unique timeshifts to find out whether a pattern is more (or less) successful for timeshifted vs. standard broker time.
* As before, one can still add multiple examples of the indior to a single source chart to generate the information for multiple, distinct timeframe-or-timeshifted offline charts.
* A discreet variety of popup Alerts have been added to notify the user of their offline chart title, and whether there were any issues with generating the desired chart. These happen when you add the indior to the origin chart, or when you restart MT4 using a session that has a chart with this indior attached.
* A lot of people like to use indiors such as CandleTime.mq4 to display the time remaining for the bar. However, for timeshifted information, a few indiors (such as those ) do not operate unless modified suitably. A new version v1_2 of my P4L CandleTime.mq4 indior was posted that can be used with the timeshifted offline charts. Please get it from the thread: New very trendy CandleTime and session period Clock indiors
(Note, a new v1_3 (not published yet) will be asked to support charts gt; 1 Month period).
How to use:
* Duplicate this indior to C:/Program Files/__your_MT4_broker__/experts/indiors/
Review the origin together with MetaEditor, Save Compile any adjustments to defaults. Quit and restart MT4.
* Open a source chart of a lower-timeframe that is a multiple of everything chart that you need to generate. If you'd like a Daily chart with hourly offsets compared to your normal Daily chartyou can open an chart or lower. (Note, you can choose any origin TF but you'll only generate info for just as much information as is on your origin chart. If your M5 has 4 months of information, if you would like to generate Daily charts, you would probably prefer to use H1 as origin as it would probably have several more months/years of information. If you would like to use a timeshift, the value (in minutes) should be an exact multiple of your origin chart interval (in minutes) (e.g. 90min/M30 is lawful but 90min/H1 isn't ).
* Insert this indior to the origin chart. NOTE: On the frequent tab, you must check the box to permit DLL imports.
* As desired, change the values for the variables PeriodMultiplier or TimeShiftAdd_in_HptMM (or even TimeShiftAdd_in_Bars), and some other external factor. Example: Open an EURUSD,H1 chart, insert this indior and set PeriodMultipler=24 and a timeshift = -2.0. It will generate the information to get a EURUSD-2H,Daily chart.
* Next, use the menu command: File Open offline (go down the list to find the exact chart title generated, i.e EURUSD-2H,Daily). Select it and click on Open.
* FYI, if you would like to output the generated chart data into a CSV file, alter OutputCSVFile from 0 (HST just ) to either 1 (CSV HST) or 2(CSV Just ). The csv file will be output into the folder lt;your_MT4gt;/ / experts/files/ /
Limitations:
* If your generated chart has changed the Symbol() title (which comprises all TimeShifted charts! ) ) , you won't be able to use that chart with EA's or alternative indiors that require the original Symbol() title in order to work. Neither will you view live trades displayed on that chart. Why? Your broker just knows about the official Symbol titles (e.g. EURUSD). An EA can set a trade of the Symbol, also MT4 can exhibit the Buy/Sell/SL/TP lines for trades on all charts with the Symbol name. But if you have a TimeShifted chart, the Symbol title may have changed, for example, to EURUSD 7H. Your broker doesn't understand anything about that new Symbol name, so you can't exchange it directly, and MT4 won't exhibit live trades on TimeShifted charts. Assuming you have access to this MQ4 source file, your code can probably be modified to set trades if it understands the initial Symbol() name. File P4L getPeriodSymbolTimeshiftsecLib.mq4 under is supplied for this function, but it is your choice to alter your MQ4 origin code.
* Because of a MT4 limit, in order to open any offline chart using a bar period of greater than 1 Month (30 days), MT4 must be duped by telling it the period is lt;= 1Month. To inform the user what the true period is, EITHER the symbol name is changed, or the period is changed (FYI, the period is obviously wrong for charts gt; 1 Month; this can be a consequence of the MT4 limits ). For the following discussion, keep in mind that a chartname is emblem,period.
In gt;= v1.8, variable Over_1MN_alters_Symbol_name Is true by default. This method is a lot easier to determine at a glance what's the actual chart period, but it's less compatible with a few indiors (especially MTF, a.k.a. multi-time-frame) that need the original Symbol() title to be unmodified.
If Over_1MN_alters_Symbol_name = true:
An _x# is added to the Symbol title, in which # is the PeriodMultiplier. Case in point:
EURUSD_x12,Monthly (This is 12 months, i.e. a Annual chart!)
Due to an MT4 limit of 11-characters for its symbol name, if the user specifies also a timeshift and/or a sizable PeriodMultiplier, the symbol name is hacked in various creative approaches to shorten it so MT4 can manage it. By way of example, a Monthly chart with PeriodMultiplier =12 and TimeShiftAdd_in_bars = 1 could be:
EURUSD 1Nx12,Monthly (ILLEGAL 12 character name!)
EU 1N_x12,Monthly (shortened symbol name). (Note 1N is 1 month shift!)
If Over_1MN_alters_Symbol_name = false:
rather than altering the Symbol() title, the Period() is altered rather from the formulation Period() - PeriodMultiplier. The Period() in this instance is the *source* chart period, which in common practice when creating charts over 1-month (30 days) will be likely to be either PERIOD_MN1 (43200), or PERIOD_W1 (10080) or even PERIOD_D1(1440). Cases:
A monthly source chart with PeriodMultiplier=2 will generate: EURUSD,M43198
A weekly source chart with PeriodMultiplier=5 will generate: EURUSD,M10075
Note: 4 hour charts are PERIOD_H4(240) but might require a multiplier of at least 180 to exceed 1-month bars. It will work but it will be confusing to try. (FYI, irrespective of timeframe, if Period() - PeriodMultiplier is adverse, an arbitrary value of 101 is used instead).
Note2: Whatever this setting for Over_1MN_alters_Symbol_name, in the generated chart, the significance of Period() is a lie! If you attempt to utilize indiors that need an accurate value for Period(), it's going to be wrong and your indior origin has to be changed to fix this. If the variable is true, the authentic period is found by decoding the Symbol() title, finding the Number after xray, and multiplying it times the Period() value. If instead the variable is false, the authentic period is found by noting it is slightly less than one of PERIOD_W1, PERIOD_MN1 or even PERIOD_D1, calculating the gap, then multiplying the gap times the PERIOD _ * value. This is complied... sometime in the future, I plan to post a routine to perform this conversion which you can incorporate into your indiors. (UPDATE: See release of P4L getPeriodSymbolTimeshiftsecLib.mq4 below!)
* As previously, you can't generate a chart that has the same period as an already present normal timeframe: M1, M5, M15, M30, H1, H4, Daily, Weekly, Monthly (and on some brokers like Oanda, M10). But as it exists, there's absolutely no point in doing so. HOWEVER, if you want one of those standard charts but timeshifted by some level.
* Many indiors are not compatible with those generated charts. Any timeshifted chart informs the user how much the shift is by altering the Symbol() name. In case your origin chart is EURUSD and you timeshift by 15 minutes, then the offline (new) Symbol() title is EURUSD 15M. Many indiors and scripts do not care about what the symbol name is exactly, but some of them perform. (ALL EA's that require transactions DO maintenance, and are not compatible unless altered!) Thus, offline charts may not be compatible with some progr unless they've been properly modified to account for this Symbol() name change (AND also, if needed, account for the fact that the bars are timeshifted relative to the broker time). Also note any indior that's hardcoded the standard timeframe values may need modifiions to work with non-standard timeframes like M10, M45, H2, etc. (UPDATE: Watch release of P4L getPeriodSymbolTimeshiftsecLib.mq4 below!)
* In MT4 when you open an offline chart, it doesn't utilize your Default chart template (if you have one), however you can just manually load any desired template. (UPDATE: Solved! Save a template then offline charts will open with that default option. A WARNING, however: In your offline saved-template, you MUST check the F8CommonOffline_chart checkbox or else you'll receive blank charts that say Waiting for Update).
* Version 1.8 created so-called Annual charts, but the starting month was arbitrary (and so somewhat useless). Version 1.9 addressed some of those problems with higher-TF charts.
Thinking ahead:
Please note this indior is written for MT4. The new MT5 version (released in 2010) can already generate charts with more or less any time (i.e. M2, M10, M20, M1234, H2, H8, etc.. NOT sure about gt; Monthly(?) ) . I don't have any idea if an ability is already supported by MT5 or not. If you know the solution, please comment. (Thus far, the response was no).
UPDATES:
2009-11-13: First release of P4L PeriodCon.mq4 v1.6 (Was downloaded 68 times ).
2009-12-07: Released v1.7 upgrade of P4L PeriodCon.mq4 (had been downloaded 16 times ).
Thanks to circlesquare, a method to make charts gt; 1 Month was found. MT4 can be duped by (falsely) marking a chart as Monthly or less even though the information remains gt; 1 Month-per-bar. However, to visually tell the user what's the actual period, the symbol name is altered to add _x# (e.g. EURUSD_x12,Monthly is really a Annual chart! Also added back in the TimeShiftAdd_in_Bars variable which is simpler for timeframes.
2009-12-10: Released v1.8 upgrade of P4L PeriodCon.mq4 (had been downloaded 1407 times ).
Added new variable Over_1MN_alters_Symbol_name (true by default). This is actually the more readable format employed in v1.7, but putting it to false will alter the Period() value: Source-Period() - PeriodMultiplier. This later method leaves the Symbol() name unchanged (provided that timeshifts are zero!!) Making generated charts a bit more compatible. (Note, for charts gt; 1-month, the Period() is always a lie -- that was necessary to get around an MT4 limit ).
2011-03-23: Released v1.9 upgrade of P4L PeriodCon.mq4 (had been downloaded 3828 occasions ).
Changes:
* Fixed some of the problems with higher timeframe charts (e.g. per week ) that resulted in the start-of-the-bar to be irregular (i.e. a week should start the start of the week, either Sunday or Monday, not a Thursday for instance ). Some timeframe charts that involve timeshifts might or might not work, because the method to slit the origin bars up and alloe them isn't perfect. This version, however, is far better than v1.8
2011-04-01: First Release v1_0 of P4L getPeriodSymbolTimeshiftsecLib.mq4
New:
* This libary file can be included in your MQ4 indior/script/EA source documents to translate the Symbol() and Period() values as altered by the P4L PeriodCon.mq4 indior. The library routine returns values, symbol, and the period. It's all up to the user to properly incorporate the values.
* Two use versions are described in the code, possibly to call the routine in a separate library file, or to include the 3 essential routines in your source code.
* Note: This is brand new code and was tested for a few typically generated charts. It hasn't been tested for each possible chart multiplier/timeshift mix. Report any problems found by submitting to the ribbon.
2012-10-18: Released v1.11 upgrade of P4L PeriodCon.mq4
Changes:
* Variable InvertChart added. If set to True, an chart is output having an I as a prefix to the name. (e.g. iEURUSD,H1)
* New external factors:
InvertedOutputMultiplier = 1.0 The inverted prices are InvertedOutputMultiplier/price.
InvertedOutputDigits = -1, where -1 is Automatic, or so the user can manually set to gt;> 0
Example: Invert USDJPY to get iUSDJPY (like JPYUSD). Establish InvertedOutputMultiplier=1000.0, and set InvertedOutputDigits=3 (or 4). A price of 79.275 would normally invert to 0.012614 but with those overrides, inverted price will be 12.614
* Altered the principal preliminary popup message to
P4L PeriodCon: Do FileOpen_Offline of chart: EURUSD,H12 (offline) (Time shifted 0min) and KEEP this Resource H1 OPEN!
2014-02-14: Uploaded P4L PeriodCon 509.ex4 (still v1.11)
Changes: None. (It is the same origin as is posted). It was compiled using build 509, and it appears to be compatible with all the new assembles gt;=600.
Fyi, the submitted v1.11. Mq4 (source) document isn't compatible with all the new builds. The source file will need code changes for the new build. (I've no plans to do this ). In the event you have to make custom edits, you can use your own (old) backup of 509, or even find the 509 MetaEditor posted everywhere that you can use to edit and then re-compile to make your own. ex4 file.
2014-02-17: Uploaded sample 509 templates (Construct 600 compatible)
Changes:
Two sample templates are offered below. They are identical, except with respect to.
One supposes use of P4L PeriodCon 509. ex4. The other assumes use of P4L PeriodCon.ex4. (Both based on v1.11).
I do not care which name you use for the base indior. Your choice.
Use the Proper template with any H1 chart. It'll generate two offline charts: foundation 7H,H4 and foundation 7H,Daily
The generated H4 and Daily charts are timeshifted from 7H. Why? These are intended for use with GMT-5 broker feeds (i.e. people who match NewYork U.S. Eastern Time). In case you have such a GMT-5 broker, you can use this template to generate GMT 2 charts. Fyi, GMT 2 Daily charts normally have 5 -Daily-bars-per-week, and 30 -H4-bars-per-week. GMT-5 charts (and most every Other time feed) have 6-Daily-bars-per-week, and 31-H4-bars-per-week. I love to compare the two, since the broker feed impacts, for example, the slopes of trendlines, pitchforks, etc..
New users: Regardless of your broker GMT ?? , use these templates to get started, simply to show you can generate and start offline charts. Then customize the settings and create your desired template(s) that fit your own needs. If you'd like M10 or H2 charts... then customize. If your broker has a GMT counter, then use a timeshift value to customize as desired.
Shades:
The snowy charts are native timeframes, the black ones are generated offline charts. (FYI, it is possible to change the colours of offline charts exactly as with any other chart).
Notice that the non-standard timeframes generated (M10, M45, H2, H8).
Notice that the time-shifted Daily charts with 2H and -1H. A Daily chart is involving them. Notice how the new P4L CandleTime.mq4 indior displays different numbers of hours for each Daily chart before the pub closes for each of those charts. The 2H has 17:29:21 remaining, routine has 19:29:21, and -1H has 20:29:21 remaining.
-----------------------------------------------
FYI, see also: Collection of progr by
-----------------------------------------------
These and other progr I have submitted are *free*, but donations are welcome! PayPal into _at_yahoo_dt_com
https://forexintuitive.com/attachmen...1219852415.mq4
https://forexintuitive.com/attachmen...1247275127.mq4
https://forexintuitive.com/attachmen...3603982864.ex4
https://forexintuitive.com/attachmen...6881946607.tpl
https://forexintuitive.com/attachmen...1134254337.tpl