For example on EURUSD when selecting BarPeriod=240, sometimes the 4H Bar will take into account for instance the minute Bars from 00:01 to 4:00, sometimes the ones from 00:00 to 3:59, sometimes from 00:01 to 3:59,
Do you have a repeatable means to demonstrate this behavior?
By the way, this is how historical data is normally stored:
typedef struct T6
{
DATE time;
float fHigh, fLow;
float fOpen, fClose;
float fVal, fVol; // optional data, like spread and volume
} T6; // 6-stream tick, .t6 file content
The DATE format is a double value, where a full day is equal to 1.0. How an actual date is converted into a double value depends on both your broker plugin and what the broker itself provides the plugin.
The precision is about 2 microseconds.
1 day = 1.0.
2 microseconds = 2 / (24 hr * 60 min * 60 sec * 1,000,000 micro) = 2.31e-11
Bars have nothing to do with it.