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

Zero lag indicator for Amibroker (AFL)
konidena
about 14 years ago
Amibroker (AFL)

Rating:
3 / 5 (Votes 6)
Tags:
amibroker, moving average, zero lag

FRom S& C mag of November 2010. Hope You will like it
Subrahmanyam

Similar Indicators / Formulas

Hull Moving Average (HMA)
Submitted by kaiji almost 15 years ago
Beauty
Submitted by sbtc555 over 11 years ago
Smoothed MA (SSMA)
Submitted by kelvinhand over 11 years ago
Trend Scalping System
Submitted by esnataraj over 14 years ago
Buff Volume Weighted Moving Averages
Submitted by kaiji almost 15 years ago
Volume wieghted moving average
Submitted by kaiji almost 15 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Zero Lag Indicator");
// Zero-Lag Indicator for AmiBroker 
// TASC Traders Tips November 2010 
// 

Length = Param("Length", 32, 0, 100 ); 
GainLimit = Param("Gain limit", 22, 1, 100 ); 
Threshold = Param("Threshold", 0.75, 0.1, 10, 0.01 ); 

alpha = 2 / ( Length + 1 ); 

iEMA = AMA( Close, alpha ); 

EC = Close[ 0 ]; 

for( bar = 0; bar < BarCount; bar++ ) 
{ 
 EC1 = EC; 

 LeastError = 1e9; 
 BestEC = 0; 

 for( gain = -0.1 * GainLimit; gain < 0.1 * GainLimit; gain += 0.1 ) 
 { 
   EC = alpha * ( iEMA[ bar ] + gain * ( Close[ bar ] - EC1 ) ) + 
       ( 1 - alpha ) * EC1; 

   Error = abs( Close[ bar ] - EC ); 

   if( Error < LeastError ) 
   { 
    LeastError = Error; 
    BestEC = EC; 
   } 
 } 
 iEC[ bar ] = BestEC;   
 iLeastError[ bar ] = LeastError; 
} 
Plot( iEMA, "EMA", colorRed ); 
Plot( iEC, "EC" + _PARAM_VALUES(), colorYellow, styleThick ); 
Plot( C, "Close", ParamColor("Color", colorGreen ), ParamStyle("Style") | GetPriceStyle() ); 

// strategy rules 
Buy = Cross( iEC, iEMA ) AND 100 * iLeastError / Close > Threshold; 
Short = Cross( iEMA, iEC ) AND 100 * iLeastError / Close > Threshold; 
Sell = Short; 
Cover = Buy; 
PlotShapes( IIf( Buy, shapeDigit9 + shapePositionAbove, shapeNone ), colorGreen ); 
// trade on next bar open 
SetTradeDelays( 1, 1, 1, 1 ); 
BuyPrice = SellPrice = CoverPrice = ShortPrice = Open; 
_SECTION_END();

3 comments

1. Ayuraveda

Today is OCT 2010
How can u get the formula of next month?

2. Pascal SAMSON

Hello Ayuraveda,

Magazines are prepared at least 1 month in advance, for reasons that you might guess.
Traders’tips (from S & C mag), provides nearly every month some interesting formulas.
Here is the link for Zero lag indicator: http://www.traders.com/Documentation/FEEDbk_docs/2010/11/TradersTips.html

Thank you Konidena for this formula.

Regards,

3. iwan

It’s a good AFL. I’like to combine with one of the Gupp AFl.
So, very powerfull. Thank’s a lot for contribution AFL.

Regards,

Leave Comment

Please login here to leave a comment.

Back