Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Gap Up and Down for Amibroker (AFL)

Copy & Paste Friendly
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();


//Visit Market<no space>logy.com for strategy and unique AFL codes.

period = Param("Lookback Period", 250, 15, 500);
if( BarCount - period - 1 < 0 ) period = BarCount - 2;
bIsGapUp = ( L > Ref(H, -1) );		// Identify GapUp bars
bIsGapDn = ( H < Ref(L, -1) );		// Identify GapDown bars
for( i = 0 ; i < (BarCount - 1 - period) ; i++ )
{
	bIsGapUp[i] = False;
	bIsGapDn[i] = False;
}
PlotShapes(IIf(bIsGapUp, shapeSmallUpTriangle, shapeNone), colorBlue, 0, L, -12 );
PlotShapes(IIf(bIsGapDn, shapeSmallDownTriangle, shapeNone), colorRed, 0, H );
for( i = (BarCount - period - 1) ; i <= (BarCount - 1) ; i++ )
{
	dUpper = 0.0; dLower = 0.0; bFilled = True;
	
	if( bIsGapUp[i] == True )
	{
		dUpper = L[i]; dLower = H[i-1]; bFilled = False;
		
		for( j = i+1; j <= (BarCount - 1) ; j++ )
		{
						if( L[j] < dUpper )
			{
				dUpper = L[j];			
				
				if( dUpper <= dLower ) bFilled = True;
			}
			if( bFilled == True ) break;
		}
	}
	else if( bIsGapDn[i] == True )
	{
		
		dUpper = L[i-1]; dLower = H[i]; bFilled = False;
		for( j = i+1; j <= (BarCount - 1) ; j++ )
		{
			if( H[j] > dLower )
			{
				dLower = H[j];
				if( dLower >= dUpper ) bFilled = True;
			}
			if( bFilled == True ) break;		
		}
	}
	if( bFilled == False )		
	{
		pLine = LineArray(i-1, dLower, BarCount-1,dLower, 1);
		Plot(pLine, "", colorRed, styleDashed);
		pLine = LineArray(i-1, dUpper, BarCount-1, dUpper, 1);
		Plot(pLine, "", colorBlue, styleDashed);
	}
}
_SECTION_END();
Back