Hi,
Below is the AFL Code (Amibroker) which I would like to adopt for PRT Charts
The indicator simply calculate and histogram the cumulative volume of each zig-zag turn.
I would greatly appreciate the help here.
I am a long-time client of IG Markets
function SumSince2( condition, array )
{
CumA = Cum( array );
return CumA – ValueWhen( condition, CumA ) + ValueWhen( condition, array ) ;
}
//Plot( Close, “Close”, colorDefault );
Plot( Zig(Close,9), “Zig”, colorBlue, styleThick);
// count bars since last peak or trough
pkb = PeakBars( Close, 9 );
trb = TroughBars( Close, 9 );
// identify peaks
pk = pkb == 1;
tr = trb == 1;
// define Plot color
color = IIf( Ref(pkb < trb,-1), colorRed, colorGreen );
// calculate cumulated volume
cumVolume = SumSince2( pk OR tr, Volume);
Plot( cumVolume, “cumulated Volume”, color, styleHistogram | styleOwnScale, 2 );
dist = ATR(10);
for( i = 0; i < BarCount-1; i++ )
{
if( tr[ i+1 ] ) PlotText( NumToStr(CumVolume[ i ]/1000,1,1) +”k”, i, L[ i ] – dist[i], colorRed );
if( pk[ i+1 ] ) PlotText( NumToStr(CumVolume[ i ]/1000,1,1) +”k”, i, L[ i ] + dist[i], colorgreen );
}