I need help determining how current price is converted into historical prices

Hi, after much thought I figured this is a rather newbie question so I decided to post here instead of other forums, I hope it is the correct place.

I am in the process of converting real-time metatrader 4 prices into historical prices for my website created for this community. However, I have came across a problem I am unsure of :

There is another issue regarding the compilation of current prices into historical prices.

If you notice,

current price:
datetime time; // Time of the last prices update
double bid; // Current Bid price
double ask; // Current Ask price
double last; // Price of the last deal (Last)
ulong volume; // Volume for the current Last price

historical price:
datetime time; // Period start time
double open; // Open price
double high; // The highest price of the period
double low; // The lowest price of the period
double close; // Close price
long tick_volume; // Tick volume
int spread; // Spread
long real_volume; // Trade volume

Supposed I now want to compile the H1 bar for the previous hour.
In one H1 bar, we will have a set of current prices.
Notice each current price consists a time, bid, ask, last and volume.

We will need to compile this set of current prices into one historical price for H1 bar, consisting time, open, high, low, close, tick_volume, spread and real_volume.

I know for the open, it is the opening ask price right at the beginning of that H1 bar.
For the high, it is the high the current ask price reached during that hour.
For the low, it is the low the current ask price reached during that hour.
Close is simple, just the last ask price of that hour.

But how do I determine tick volume, spread and real volume?

Would appreciate any help that I can get! Thanks in advance oh kind souls! :smiley:

Warmest regard,
Desmond

I am unsure I understand exactly what you need but here’s my tought.

I dont think you can get real volume, otherwise the VSA guys would have it easy :smiley:

in an EA the function Volume[i] would give you the tick volume of the bar.
Volume [0] would give you the volume of the current bar and your EA should run at each tick.
So, you can make a tick counter and you can verify this count by monitoring the change of Volume[0] maybe.

There are functions such as Bid() Ask() and spread()

All the info you ll get is limited to your broker, it is not the whole forex market.

Otherwise just use the M1 data, and you can simply get the same info from the 1MN chart with iHigh[] iLow[] and such.