| Trading Indicators Post your custom trading indicators. If you download, remember to click INSTALL. |
![]() | | Tweet | |
Zero Lag Moving Averages Details »» | |||||||||||||||||||||||||
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 Show Your Support
| |||||||||||||||||||||||||
| ∧ 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: | ||
| Comments |
| | #2 | ||
![]() | Re: Zero Lag Moving Averages | ||
| |
|
| | #3 | ||
![]() | Re: Zero Lag Moving Averages 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, | ||
| |
|
![]() |
| Tags |
| moving average, zero lag |
| Thread Tools | |
| 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 |