Receiving the data

 
Hi,
How are the data for individual time frame, M1, M5, ............ generated?
Are they generated locally by MT4 from each tick received or are they downloaded from the server?
I am trying to generate my own time frames from ticks and somehow cannot get same data as in M1, M5,...... modes.
Especially if there are more than one minute or more long gaps or ticks are not on same time origin boundary.
How does one fill these gaps?
If I want to generate M1 time frame and get tick every 3 minutes what value should I use in between?
Is there any algorithm available to create such data.
 
client terminal receives absentee history every time after connecting. then local and server history generated parallel.
for algorithm see 2-nd part of the period_converter script
 
client terminal receives absentee history every time after connecting. then local and server history generated parallel.
for algorithm see 2-nd part of the period_converter script

Thanks Slawa,
There is related post as to what is the best way to have same history files in two separate accounts.
"To Metaquotes - data discrepancy"
Please advise.
Reason: