What I have below is what I had hoped to be the firs step in making VPCI into a PaintBar Study....it will verify, but just paints every bar.
The end result was supposed to be GREEN colored vbars for when VPCI is greater than Ave VPCI (or VPCI Smooth) AND greater than Zero.
RED when VPCI is less than VPCI Smooth AND less than zero.
WHITE or not painted when VPCI and its relation to zero are not in sync.
I am new as can be at this and am hoping someone can point me in the right direction.
Thank You.
inputs:
Price( Close ),
Length1( 5 ),
Length2( 20 ),
VPCIAvgLen( 20 ) ;
variables:
VolValue( 0 ),
VolumeSum1( 0 ),
VolumeSum2( 0 ),
VWMA1( 0 ),
VWMA2( 0 ),
VP( 0 ),
VPR( 0 ),
VM( 0 ),
VPCI( 0 ),
AvgVPCI( 0 ) ;
if BarType >= 2 then { not tick/minute data }
VolValue = Volume
else
VolValue = Ticks ;
VolumeSum1 = Summation( VolValue, Length1 ) ;
if VolumeSum1 > 0 then
VWMA1 = Summation( Price * VolValue , Length1 ) /
VolumeSum1 ;
VolumeSum2 = Summation( VolValue, Length2 ) ;
if VolumeSum2 > 0 then
VWMA2 = Summation( Price * VolValue , Length2 ) /
VolumeSum2 ;
VP = VWMA2 - Average( Price, Length2 ) ;
if Average( Low, Length1) > 0 then
VPR = VWMA1 / Average( Low, Length1 ) ;
if Average( VolValue, Length2 )> 0 then
VM = Average( VolValue, Length1 ) / Average( VolValue, Length2 ) ;
VPCI = VP * VPR * VM ;
AvgVPCI = Average( VPCI, VPCIAvgLen ) ;
If (VPCI > AvgVPCI) and (VPCI > 0)
Then PlotPaintBar (High, Low);