Hi All,
I would like to see the developing value area and the developing point of control in the volume profile.
Before Implementing i would like to get the opinion from the experts who used/created it , i learnt and learning many from this forum, i hope i learn this too .
Below is the Code provided in the Example of PriceVolDistribuition Function().
bi = BarIndex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );
mx = PriceVolDistribution( H, L, V, 100, False, fvb, lvb );
GfxSetCoordsMode( 1 );
GfxSelectPen( colorRed );
bins = MxGetSize( mx, 0 );
for( i = 0; i < bins; i++ )
{
price = mx[ i ][ 0 ]; // price level
relvolume = mx[ i ][ 1 ]; // relative volume 0..1
relbar = relvolume * (lvb-fvb+1);
GfxMoveTo( fvb, price );
GfxLineTo( fvb + relbar, price );
}
Here what i am planning is in the PriceVolDistribution() , i need to put another loop like below ....
for (i=fvb+1;i<lvb;i++)
mx = PriceVolDistribution( H, L, V, 100, False, fvb, i);
mat_sort = MxSortRows( mx0, False, 1 );
MaxVolume = mat_sort[0][1];
Here is the Value Area Finding AFL from the experts of this Forum ,
So I have pass the the matrix from the above to the following value area code to calculate VAH and VAL for every bar Right ?
/// Value Area Calcluation Starts here
mxTimeBinIdx = poc_idx;
totTime = TotalMxVol;
tmx = mx0;
// mxTimeBinIdx - This is POC Bin's Index
// bins - This is Total Bin Size
//mx - This is Matrix for which the value area needs to be calculated
// totTime - The Entire Total Volume
mxih = mxil = mxTimeBinIdx;
// mxih is the index number for Value Area High , initally it is set to POC's Index Number
// mxil is the index number for Value Area Low, initally it is set to POC's Index Number
tvol = tmx[mxTimeBinIdx][1]; // tvol represents the POC Volume
for( j = 0; j < bins; j++ ) // Looping all the Bins
{
if( mxih + 1 < bins AND mxil - 1 >= 0 ) // Checking whether VAH index is less than the Bin and
{
relvolumeh = tmx[mxih + 1][1]; // High Volume
relvolumel = tmx[mxil - 1][1];// Low Volume
if( relvolumeh > relvolumel ) //
{
mxih = mxih + 1;
tvol = tvol + relvolumeh;
}
else
if( relvolumeh < relvolumel )
{
mxil = mxil - 1;
tvol = tvol + relvolumel;
}
else
if( relvolumeh == relvolumel )
{
mxih = mxih + 1;
mxil = mxil - 1;
tvol = tvol + relvolumeh + relvolumel;
}
}
else
if( mxih + 1 >= bins AND mxil - 1 >= 0 )
{
relvolumel = tmx[mxil - 1][1];
mxil = mxil - 1;
tvol = tvol + relvolumel;
}
else
if( mxih + 1 < bins AND mxil - 1 < 0 )
{
relvolumeh = tmx[mxih + 1][1];
mxih = mxih + 1;
tvol = tvol + relvolumeh;
}
if( ( tvol / totTime ) >= volumeValueArea )
{
vp_vd_in_va = tvol;
break;
}
}
/// Value Area Calculation Stops here
Note : The Code Shown here are from AmiBroker Help / Forum , Thanks to those mentors.
i feel it is bit time consuming and looping a lot ?
Is there any other ways ? to do this efficiently...
Thanks in Advance,
Kaeswar
