PRV -Pro rated volume

#1
seniors.
can anybody convert this code to afl?
// PRV Pro Rated Volume
// author: unknown (previousely posted by TXUK)
// enhancements by TAMS
//
// This indicator projects the volume at the end of the bar.
// It calculates the PRV based on the current trade pace,
// and the time remaining in the bar.
//
// This information is useful to spot turning points
// ie. whether the money is drying up... or flooding in.
//
// This indicator is usable on minute charts only.
//
// Instructions:
// Set the volume to display as a thick histogram
// and the PRV to display either as a thin histogram, or as a thick point.//
//
// enhancemnts by TAMS:
// 20070102
// added user configurable colors
// auto detect chart resolution (original version can only be used on 5min chart)
// added delay, so that the PRV does not get overwhelmed at the beginning of the bar
// added the zero line, so that autoscale starts at zero instead of the lowest volume
//


inputs:
UpCol( black ),
DnCol( Red ),
UpPRV(green),
DnPRV(Darkcyan),
delay(10);

variables:
offset(0),
color(0);

vars:
CurrentTimeInSecs ( 0 ),
TotSecondsDiff( 0 ) ,
SecondsDiff( 0 ) ,
MinutesDiff( 0 ),
prv(0);

plot1(0, "Zero");

if date = date[1] then
begin
CurrentTimeInSecs = ( ComputerDateTime - DateToJulian( Date ) ) * 86400 ;
TotSecondsDiff = CurrentTimeInSecs - CurrentTimeInSecs[1] ;
end;

If TotSecondsDiff > delay then
begin
prv = (ticks/TotSecondsDiff) * 60 * barinterval ;
IF prv > ticks[1] THEN
setPlotColor( 2, UpPRV)
else
SetPlotColor(2, dnPRV);
Plot2 (prv, "PRV");
end;

if c > c[1] then
color = upcol
else
if c < c[1] then
color = dncol
else
color = color[1];

Plot2[1] (ticks[1], "PRV");
plot3(ticks, "Volume", color);
 

Similar threads