I'd like the "classical"
Volume Average indicator ie. Volume histogram with simple moving average
and
the histogram bars in different colour depending on
if High > High[1] and Low >= Low[1] then
SetPlotColor( 1, UpColor )
else if Low < Low[1] and High <= High[1] then
SetPlotColor( 1, DownColor ) ;
This is the complete Tradestation code:
inputs:
AvgLength( 10),
AlertPct( 50),
UpColor( darkmagenta),
DownColor( darkcyan) ;
variables:
VVol( 0 ),
AvgVVol( 0 ),
TVol( 0 ),
AvgTVol( 0 ),
AlertFactor( 1 + AlertPct * .01 ),
AlertStr( NumToStr( AlertPct, 2 ) ) ;
if BarType >= 2 then { ie, not tick/minute data }
begin
VVol = Volume ;
AvgVVol = AverageFC( Volume, AvgLength ) ;
Plot1( VVol, "Vol" ) ;
Plot2( AvgVVol, "VolAvg" ) ;
{ Alert criteria }
if VVol crosses over AvgVVol * AlertFactor then
Alert( "Volume breaking through " + AlertStr + "% above its avg" ) ;
end
else { if tick/minute data; in the case of minute data, also set the "For volume,
use:" field in the Format Symbol dialog to Trade Vol or Tick Count, as desired }
begin
TVol = Ticks ;
AvgTVol = AverageFC( Ticks, AvgLength ) ;
Plot1( TVol, "Vol" ) ;
Plot2( AvgTVol, "VolAvg" ) ;
{ Alert criteria }
if TVol crosses over AvgTVol * AlertFactor then
Alert( "Volume breaking through " + AlertStr + "% above its avg" ) ;
end ;
{ Color criteria }
if H > H[1] and L >= L[1] then
SetPlotColor( 1, UpColor )
else if L < L[1] and H <= H[1] then
SetPlotColor( 1, DownColor ) ;

Comment