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

Gann Trend for Amibroker (AFL)

Rating:
2 / 5 (Votes 5)
Tags:
amibroker, gann

// 2 bar Gann Trend Swing Chart
// Developed by DollarHeineken
// Contact me at dollarheineken@gmail.com
// Parameters allow you to choose bar/candle type and color intensity.
// And display of Bollinger band
//trend line beg

Indicator / Formula

Copy & Paste Friendly
// 2 bar Gann Trend Swing Chart
// Developed by DollarHeineken
// Contact me at dollarheineken@gmail.com
// Parameters allow you to choose bar/candle type and color intensity.
// And display of Bollinger band
//trend line beg
SetBarsRequired(1000);
BarLum1 		= Param("Bar Color Intensity", 8, 0, 10,01);
UpBarColor		= ColorBlend(ColorRGB(5,36,5), ColorRGB(10,75,10), BarLum1);
DnBarColor		= ColorBlend(ColorRGB(36,5,5), ColorRGB(75,10,10), BarLum1);
BarColor		= IIf(Close > Open, UpBarColor, DnBarColor);
SetBarFillColor(BarColor);
stylecndl=ParamList("Bar or Candle chart?","Bar|Candle");
Showboll=ParamList("Show Bollinger Bands","Yes|No");

if (stylecndl=="Bar")stylec=styleBar;
else stylec=styleCandle;

Plot(C,"close",colorWhite,stylec);
tline=tlinebs=barhi=barlo=beglo=beghi=endi=begi=0;
for (i=1;i<BarCount;i++)
{

if (i>=4)
{
//if (i>begi+1)PlotText(WriteVal(I>begi+1,1.0),i,H[i]+15,colorOrange);	


	if (H[i]>H[i-1]AND H[i-1]>H[i-2] AND i>beglo)
	{
		tline[i]=H[i];
		barhi=1;
		barlo=0;
		prevhi=beghi;
		beghi=i;
	}
	if (L[i]<L[i-1]AND L[i-1]<L[i-2] AND i>beghi)
	{
		tline[i]=L[i];
		barlo=1;
		barhi=0;
		prevlo=beglo;
		beglo=i;
	}
}


	if (i==beglo)
	{
		if (prevlo>beghi)
		{
			begi=prevlo; begval=L[prevlo];
			endi=beglo;endval=L[beglo];
		}
		else if (beghi>prevlo)
		{
			begi=beghi; begval=H[beghi];
			endi=beglo;endval=L[beglo];
		}
	}
	if (i==beghi)
	{
		if (prevhi>beglo)
		{
			begi=prevhi; begval=H[prevhi];
			endi=beghi;endval=H[beghi];
		}
		else if (beglo>prevhi)
		{
			begi=beglo; begval=L[beglo];
			endi=beghi;endval=H[beghi];
		}
	}

	if (endi-begi>1)
	{
		incr=(endval-begval)/(endi-begi);
		for (j=begi;j<=endi;j++)
		{
			tline[j]=begval+(j-begi)*incr;
		}
	}	

if (tline[i]==0)tline[i]=Null;
//trend line end
}
tline=IIf(tline>0,tline,Null);
Plot(tline,"Trendline",colorWhite,styleLine);

if (showboll=="Yes")
{
	_SECTION_BEGIN("Bollinger Bands");
	P = ParamField("Price field",-1);
	Periods = Param("Periods", 15, 2, 300, 1 );
	Width = Param("Width", 2, 0, 10, 0.05 );
	Color = ParamColor("Color", colorCycle );
	Style = ParamStyle("Style");
	Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style ); 
	Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style ); 
	_SECTION_END();


	_SECTION_BEGIN("MA");
	P = ParamField("Price field",-1);
	Periods = Param("Periods", 15, 2, 300, 1, 10 );
	Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
	_SECTION_END();
}

0 comments

Leave Comment

Please login here to leave a comment.

Back