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

Tom DeMark Trend Lines for Amibroker (AFL)
kaiji
almost 15 years ago
Amibroker (AFL)

Rating:
4 / 5 (Votes 8)
Tags:
amibroker, support, resistance

Just include this code in your chart that has your HLOC graph and adjust the percent field and it will draw TD Trend Lines, in any time frame. I started with the example code I found in the help section for “LineArray”.

Bullish Signals:

  • The previous price must have closed down for a potential upside breakout.
  • The current open must be greater than both the current TD Supply Line and the previous close and must then trade at least one tick higher.
  • The current price bar’s open must be above both the previous two price bars’ closes, and the current price bar’s TD Supply Line must be above the previous price bar’s high.
  • The previous close plus the previous bar’s ‘buying pressure’ must be below the current price bar’s TD Supply Line price level.

Bearish Signals:

  • The current open must be less than both the current TD Demand Line and the previous close and must then trade at least one tick lower.
  • The price bar prior to a downside breakout must be an up close.
  • The close minus the previous bar’s ‘selling pressure’ must be above the current price bar’s TD Demand Line price level.
  • The current open must be below both the previous two closing prices, and the current price bar’s TD Demand Line must be below the previous low.

Similar Indicators / Formulas

Intraday Trades
Submitted by vishalsbharati almost 13 years ago
Support & Resistance
Submitted by shyam242 over 13 years ago
Automatic Support and Resistance with Channel
Submitted by kaiji almost 15 years ago
Support/Resistance Modified
Submitted by dkeleher almost 14 years ago
Support and resistance range
Submitted by mediaworks almost 14 years ago

Indicator / Formula

Copy & Paste Friendly
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	THIS SECTION DRAWS TD TREND LINES */

percent  = 0.01 * 1; /* Adjust this percent as necessary, I use .01 because
FOREX is a 0.0000 number */
firstpointL = 2;
firstpointH = 2;

y0=LastValue(Trough(L,percent,firstpointL)); 
y1=LastValue(Trough(Ref(L,-1),percent,1));

for( i = 1; i < BarCount AND y0 >= y1; i++ )
{
		
		firstpointL++;	
		y0=LastValue(Trough(L,percent,firstpointL));		 
}

x0=BarCount - 1 - LastValue(TroughBars(L,percent,firstpointL)); 
x1=BarCount - 1 - LastValue(TroughBars(Ref(L,-1),percent,1)); 
LineL = LineArray( x0, y0, x1, y1, 1 ); 
/*
Plot(C, "C", colorBlack, styleCandle); 
*/
Plot( LineL, " Support Trend line", colorWhite,4 +8 ); 


yt0=LastValue(Peak(H,percent,firstpointH)); 
yt1=LastValue(Peak(Ref(H,-1),percent,1));

for(i = 1; i < BarCount AND yt0 <= yt1; i++ )
{
		
		firstpointH++;		
		yt0=LastValue(Peak(H,percent,firstpointH)); 
}
xt0=BarCount - 1 - LastValue(PeakBars(H,percent,firstpointH)); 
xt1=BarCount - 1 - LastValue(PeakBars(Ref(H,-1),percent,1)); 
LineH = LineArray( xt0, yt0, xt1, yt1, 1 ); 

Plot( LineH, "Resistance Trend line", colorBrown,4 + 8 ); 

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

8 comments

1. anandnst

Really useful…

2. morgen

Very good indeed!
Can somebody make a faster formula .afl for this?
Thank you

3. morgen

Very good indeed!
Can somebody make a more accurate, a faster formula .afl for this?
Thank you

4. morgen

Very good indeed!
Can somebody make a more accurate, a faster formula .afl for this?
Thank you

5. morgen

Very good indeed!
Can somebody make a more accurate, a faster formula .afl for this?
Thank you

6. morgen

Very good indeed!
Can somebody make a more accurate, a faster formula .afl for this?
Thank you

7. shariful

Thanks. such type of basic afl is a piece of gem indeed.

8. subrata chakraborty54

Dear Kaiji,

Very nice afl.I checked on eod basis working perfect. Thank you very much

Leave Comment

Please login here to leave a comment.

Back