Skip to main content

3 bar reversal eliminates noise for Amibroker (AFL)

benzenechain almost 12 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 3)
  • Tags:
    amibroker, trend

This afl eliminates time and also market noise based on pure price action.
As the time factor is eliminated much of the range bound price which creates noise is eliminated. Simple but effective for trend catching.

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("3 bar reversal -eliminates time");


 SetBarsRequired(10000,10000);

// initialize first element
NumBar = 0;
LastHigh=Close[1];
LastLow=Close[1];
LastStartHigh=Close[1];
LastStartLow=Close[1];

// Loop to produce the TLB values 

for( i=1; i<BarCount-1; i++ )
{
if (numbar > 3 )
{
	M1=Max(TLBCB[numbar],TLBCE[numbar]);
	M2=Max(TLBCB[numbar-1],TLBCE[numbar-1]);
	M3=Max(TLBCB[numbar-2],TLBCE[numbar-2]);
	m4=Max(m1,m2);
	LastHigh=Max(m4,m3);

	M1=Min(TLBCB[numbar],TLBCE[numbar]);
	M2=Min(TLBCB[numbar-1],TLBCE[numbar-1]);
	M3=Min(TLBCB[numbar-2],TLBCE[numbar-2]);
	m4=Min(m1,m2);
	LastLow=Min(m4,m3);
}

if( Close[i]> Lasthigh)
	{
	numbar++;
	TLBCB[numbar]=LastStartHigh; // TLBCB Three Line Break Chart Begin (of bar)
	TLBCE[numbar]=Close[i]; // TLBCB Three Line Break Chart End (of bar)
	LastStartlow=LastHigh;
	LastHigh=Close[i];
	LastStartHigh=Close[i];
	}

if( Close[i]< LastLow)
	{
	numbar++;
	TLBCB[numbar]=LastStartLow;
	TLBCE[numbar]=Close[i];
	LastStartHigh=LastStartLow;
	Lastlow=Close[i];
	LastStartlow=Close[i];
	}

} // for

// move the chart to right end of chart space, ie last brick on last bar
//position
delta =  BarCount-1 - numbar;

TLBCB = Ref( TLBCB, -delta );
TLBCE = Ref( TLBCE, -delta );

rO = TLBCB;
rC = TLBCE;
rH = Max(rC,rO);
rL = Min(rC,rO);

// plot chart
PlotOHLC( rO, rH, rL, rC, "TLB" , colorBlack, styleCandle);
GraphXSpace=1;

Title = Name() + " - {{INTERVAL}} {{DATE}} - TLB Chart : ";
_SECTION_END();

2 comments

almost 12 years ago

Dear,

wt timeframe it should be used?…

kindly share some of ur experience

Leave Comment

Please login here to leave a comment.