/*

	File Name	= Bar_Size.AFL
	File Type	= Chart Indicator

	Objective
	The idea is to alert of oversized bars. Typically based on the Close-Open
	Large bars typical Start and End trend Movements.
	These alerts are in the form of Stars on the indicator as well as audio alerts.
	Adjust the Period to suite yourself.
 
	Written By = Neil Wrightson

	Ver		Date			Reason
	1		23/08/2009		Creation


*/

_SECTION_BEGIN("Bar Size");
Period = Param("Period",5);
BarSize = abs(Close-Open);
//BarSize = High-Low;
MABarSize = MA(BarSize,Period);
StanDev = StDev( MA(BarSize,Period), Period ); 

Plot( BarSize, _DEFAULT_NAME(), IIf( C > O, 	ParamColor("Up Color", colorGreen ), 
  													ParamColor("Down Color", colorRed ) ), 
													ParamStyle( "Style", styleHistogram | styleThick, maskHistogram  ) );
Plot(MABarSize,_DEFAULT_NAME(),colorBlack,styleLine| styleThick);

Plot(MABarSize+(2*StanDev),_DEFAULT_NAME(),colorRed,styleLine| styleThick);

BigBar = IIf(BarSize > MABarSize+(2*StanDev),1,0) ;


PlotShapes(BigBar * shapeStar, colorBlue, 0, BarSize+(2*StanDev)) ;
//AlertIf( Bigbar, "SOUND C:\\Windows\\Media\\Tada.wav", "Audio alert", 2 );

AlertIf( Bigbar, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );


_SECTION_END();