Welcome to the Traders Laboratory Forums.
Trading Indicators Post your custom trading indicators. If you download, remember to click INSTALL.

Reply
Zero Lag Moving Averages Details »»
Zero Lag Moving Averages
Platform: , by phase21 phase21 is offline
Developer Last Online: Sep 2011 Show Printable Version Email this Page

Platform: Other Rating:
Released: 07-29-2009 Last Update: Never Installs: 1
 
No support by the author.

Hi All,

Having looked at the thread on Hull MA, I thought this might be of interest to others.

When I got interested in technical analysis, I was very keen on using indicators, etc, like most newbies, and came across the following formula for significantly reducing the lag inherent in moving averages.

That was a while ago, and am now more interested in reading price and volume, but thought others might be able to make better use of it than I have.

The basic formula is:
&EMAOne := MovingAvgMethod (Close , Periods , 2)
&EMATwo := MovingAvgMethod (&EMAOne , Periods , 2)
&Diff := &EMAOne - &EMATwo
&EMAOne + &Diff

Replace "MovingAvgMethod" with whatever MA you prefer.

And here's a pic comparing several different MAs with/out Zero Lag, including Hull:


Regards,

Screenshots

Zero Lag Moving Averages-zerolagmas.png  

Show Your Support

  • If you like to thanks you by the author -> Click Thanks to the Author
  • This modification may not be copied, reproduced or published elsewhere without the author's permission.

Similar Indicator
Mod Developer Type Replies Last Post
Ergodic ImXotep Trading Indicators 6 02:06 PM 12-12-2009
Screaming Fast Moving Average Minetoo Trading Indicators 47 12:46 PM 04-10-2011
Hull Moving Average Strategy Minetoo Trading Indicators 25 05:23 PM 07-02-2009
Various Indicators (Squeeze,2FastMa's,etc) Blu-Ray Trading Indicators 242 01:16 PM 03-22-2012
Quick MA zdo Trading Indicators 17 10:05 AM 04-06-2009
Moving Average with Extension Tams Trading Indicators 2 05:04 PM 02-27-2011
BWI - BB Band Width Indicator Tams Trading Indicators 4 03:21 PM 04-22-2009
Red Light / Green Light Tams Trading Indicators 16 01:05 PM 05-14-2010
MAMA Combo Tams Trading Indicators 6 10:10 PM 01-24-2011
Simple Indicator pimind Trading Indicators 0 03:02 PM 05-07-2009
The Following 3 Users Say Thank You to phase21 For This Useful Post:
cmetrader (03-31-2011), Nirvana (08-26-2009), simterann22 (08-12-2009)

Comments
Old 08-13-2009, 04:57 PM   #2

Minetoo's Avatar

Join Date: Jan 2007
Location: xgmjxdyd
Posts: 140
Ignore this user

Thanks: 5
Thanked 30 Times in 14 Posts

Re: Zero Lag Moving Averages

phase21, please post the eld's (or code) for your zero lag Hull and EMAs.
Minetoo is offline  
Reply With Quote
Old 08-14-2009, 02:54 AM   #3

Join Date: Nov 2007
Location: ...
Posts: 12
Ignore this user

Thanks: 4
Thanked 5 Times in 2 Posts

Re: Zero Lag Moving Averages

Hello Minetoo,

The code I posted above is a direct copy from a function in Trade Navigator. I use TN for trading and quick prototyping of ideas. You can define functions in TN, but it doesn't have a programming language to speak of.

However, you should be able to plonk this code/algorithm into a template you use for defining functions in your favourite software, hence no "*.eld".

But, below is some code which does the same thing in AmiBroker. AB has a "C"-like programming language.

Define the function:
/*======================== ========================= ========================= ===
Zero-Lag Moving Averages

This AFL contains functions to calc moving averages with minimal lag.
========================= ========================= ========================= ==*/

//-----------------------------------------------------------------------------
function ZeroLagMovingAvg(ValToSmo oth, BarsToUse)
/*
This AFL smooths the input data, and then removes as much lag as possible.

Note: Original source of the formula not known.
-----------------------------------------------------------------------------*/
{
// Declare local variables
local result ;
local MAOne ;
local MATwo ;
local MADiff ;

// Initialise the local variables.
result = Null ;

// Your code goes in here
MAOne = MA(ValToSmooth , BarsToUse) ;
MATwo = MA(MAOne , BarsToUse) ;
MADiff = MAOne - MATwo ;
result = MAOne + MADiff ;

// Declare which variable/value to be returned to the user/calling function
return result ;
}



Call the function:
/*======================== ========================= ========================= ===
Zero-Lag Moving Averages

This AFL plotts the moving averages with minimal lag.
========================= ========================= ========================= ==*/

#pragma nocache ;
#include_once <ZeroLagMovingAvg.afl> ;

ValToSmooth = ParamField("Price field", 3) ;
BarsToUse = Param("Bars to use", 13, 2, 1000, 1, 1) ;
SmoothedVal = ZeroLagMovingAvg(ValToSmo oth, BarsToUse) ;

Plot(SmoothedVal, "ZeroLagMovingAvg", colorBlue, styleLine | styleDots | styleThick, 0, 0, 0) ;



Note: I tend to define things as componentised as possible, a-la building blocks, and draw them all together as late as possible/appropriate. That way I can separate the visuals from the calcs.


Regards,
phase21 is offline  
Reply With Quote
The Following 2 Users Say Thank You to phase21 For This Useful Post:
Llizzet (08-16-2009), Minetoo (08-14-2009)

Reply

Tags
moving average, zero lag

Thread Tools
Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
How moving averages can be effectively used for day trading E-mini? sudha78 Beginners Forum 6 06-30-2010 11:52 AM
Moving Averages 4 Part Video Series Soultrader Trading Videos 0 01-21-2009 03:16 AM
Moving Averages Again... TacTrader Technical Analysis 5 01-12-2009 02:16 PM
MACD with Hull Moving Averages Soultrader Trading Indicators 2 09-06-2007 05:52 PM
Moving Averages: Which one should I use? Blaze Technical Analysis 7 08-27-2006 08:04 AM

All times are GMT -4. The time now is 10:57 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.