Skip to main content

IVolumeProfile / Profile2

IVolumeProfile defines the data contract for a single volume profile. Profile2 is the concrete implementation that calculates POC, Value Area, VWAP, standard deviations, TPO, and per-level volume data.

Namespace: MZpack Inheritance: IVolumeProfile : IModelItem2 Implementation: Profile2 : ProfileBase, IModelItem2, IVolumeProfile Source: MZpackBase/mzVolumeProfile/IVolumeProfile.cs, MZpackBase/mzVolumeProfile/Profile2.cs

Key Level Properties

PropertyTypeDescription
POCdoublePoint of Control — price with highest volume
TickPOCdoubleTick-level POC (finer than TicksPerLevel)
VAHdoubleValue Area High
VALdoubleValue Area Low
VWAPdoubleVolume Weighted Average Price
MIDdoubleMidpoint of the profile range

Standard Deviations

PropertyTypeDescription
DeviationdoubleStandard deviation value
_1StdDeviationPosdoubleVWAP + 1 standard deviation
_1StdDeviationNegdoubleVWAP - 1 standard deviation
_2StdDeviationPosdoubleVWAP + 2 standard deviations
_2StdDeviationNegdoubleVWAP - 2 standard deviations

OHLC and Range

PropertyTypeDescription
OpendoubleProfile open price
ClosedoubleProfile close price
HighdoubleProfile high price
LowdoubleProfile low price
RangeTicksintProfile range in ticks
DurationMsdoubleProfile duration in milliseconds

Volume and Delta

PropertyTypeDescription
VolumelongTotal volume
BuyVolumelongBuy (ask) volume
SellVolumelongSell (bid) volume
DeltalongDelta (BuyVolume - SellVolume)
DeltaPercentagedoubleDelta as percentage of volume
POCVolumelongVolume at POC
BuyPOCVolumelongBuy volume at POC
SellPOCVolumelongSell volume at POC
VAVolumelongTotal volume within Value Area
TradesNumberlongNumber of trades

TPO Properties

PropertyTypeDescription
TPO_POCdoubleTPO-based Point of Control
TPO_VAHdoubleTPO-based Value Area High
TPO_VALdoubleTPO-based Value Area Low
TPOLettersCountintNumber of TPO letters/periods
IBHighdoubleInitial Balance High
IBLowdoubleInitial Balance Low

Per-Level Data

PropertyTypeDescription
VolumesSortedDictionary<double, long>Total volume per price level
BuyVolumesSortedDictionary<double, long>Buy volume per price level
SellVolumesSortedDictionary<double, long>Sell volume per price level
DeltasSortedDictionary<double, long>Delta per price level

Developing Data (by bar index)

These dictionaries track how profile levels evolve over time:

PropertyTypeDescription
VWAPsSortedDictionary<int, double>VWAP at each bar index
DeviationsSortedDictionary<int, double>Standard deviation at each bar index
POCsSortedDictionary<int, double>POC at each bar index
VAHsSortedDictionary<int, double>VAH at each bar index
VALsSortedDictionary<int, double>VAL at each bar index

Time Range (from IModelItem2)

PropertyTypeDescription
BeginDateTimeProfile start time
EndDateTimeProfile end time
BeginBarIdxintFirst bar index
EndBarIdxintLast bar index
IsDevelopingboolWhether the profile is still being built
IsEmptyboolWhether the profile has no data

Methods

MethodReturn TypeDescription
IsRTH()boolWhether the profile is within Regular Trading Hours
IsETH()boolWhether the profile is within Extended Trading Hours
AssignRange(int beginBarIdx, int endBarIdx)boolAssign the profile to a bar range
AssignRange(DateTime begin, DateTime end)boolAssign the profile to a time range
Intersects(IVolumeProfile profile)boolCheck if two profiles overlap in time
RefreshViewModel()voidRefresh the visual representation

Example: Read POC and VWAP

IVolumeProfile profile = vpIndicator.GetProfile(0);

double poc = profile.POC;
double vwap = profile.VWAP;
double vah = profile.VAH;
double val = profile.VAL;

// Volume breakdown at POC
long pocBuyVol = profile.BuyPOCVolume;
long pocSellVol = profile.SellPOCVolume;

// Standard deviations around VWAP
double upper1SD = profile._1StdDeviationPos;
double lower1SD = profile._1StdDeviationNeg;
double upper2SD = profile._2StdDeviationPos;
double lower2SD = profile._2StdDeviationNeg;

// Iterate volume ladder
foreach (var kvp in profile.Volumes)
{
double price = kvp.Key;
long volume = kvp.Value;
long delta = profile.Deltas.ContainsKey(price) ? profile.Deltas[price] : 0;
}

See Also