ZigZag with cumulative volume
Forums › ProRealTime English forum › ProBuilder support › ZigZag with cumulative volume
- This topic has 48 replies, 3 voices, and was last updated 2 years ago by Nicolas.
-
-
02/10/2017 at 12:31 PM #24650
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 );
}
02/10/2017 at 3:47 PM #24696Do you have any screenshots of how it should be displayed please? Amibroker and prorealtime don’t share the same graphical capabilities, so I’d like to know how you want it to give you the desired information (cumulative volume) before coding it. Thanks in advance!
02/11/2017 at 2:25 AM #2477102/16/2017 at 1:31 PM #25286Here is a simple code to make the same thing than MetaStock. The code you submitted use built-in instructions of MetaStock, so I think I have correctly recode it, please make your own tests and give feedbacks!
1234567891011121314151617181920zz = ZigZag[9](close)peak = zz<zz[1] and zz[1]>zz[2]tough = zz>zz[1] and zz[1]<zz[2]cumV = cumV[1]+volumeif peak thentext = cumV/1000drawtext("#text#K",barindex,cumV+(cumV/20),Dialog,Bold,12) coloured(0,200,0)cumV = 0color = -1elsif tough thentext = cumV/1000drawtext("#text#K",barindex,cumV+(cumV/20),Dialog,Bold,12) coloured(200,0,0)cumV = 0color = 1endifreturn cumV coloured by colorYou’ll find attached a sample screenshot of what we get on chart. I did not add the ZigZag lines on the Volumes, is it necessary? or do you want it too? If it’s ok, I certainly add this in the prorealtime code library.
1 user thanked author for this post.
02/16/2017 at 3:30 PM #2529402/16/2017 at 4:42 PM #2531002/17/2017 at 12:51 PM #2539002/17/2017 at 1:25 PM #2539502/17/2017 at 1:35 PM #2540002/17/2017 at 2:38 PM #2540702/17/2017 at 2:49 PM #25408If you believe that volume is important than this indicator is very helpful.
The theory is based on R Wyckoff works and refined by D Weis.
In the nutshell cumulative volume helps to asses the strength of the ZigZag section which
is difficult to measure if you looking at the individual volume bars only.
Your Amazon chart shows exactly the power of this indicator!
02/17/2017 at 2:53 PM #2540902/17/2017 at 3:22 PM #2541002/17/2017 at 4:28 PM #2542202/17/2017 at 4:46 PM #25424It does not change colour on UP/Down moves but this not a problem
You have to modify yourself the Up/Down (Positive/Negative) colors of the histogram in the indicator window.
the cumulative volume count is missing first volume after the top turn
Right, it’s fixed in this new version of the code:
1234567891011121314151617181920zz = ZigZag[9](close)peak = zz<zz[1] and zz[1]>zz[2]tough = zz>zz[1] and zz[1]<zz[2]cumV = cumV+volumeif peak thentext = cumV/1000drawtext("#text#K",barindex,cumV+(cumV/20),Dialog,Bold,12) coloured(0,200,0)cumV = Volumecolor = -1elsif tough thentext = cumV/1000drawtext("#text#K",barindex,cumV+(cumV/20),Dialog,Bold,12) coloured(200,0,0)cumV = Volumecolor = 1endifreturn cumV coloured by color -
AuthorPosts
Find exclusive trading pro-tools on