Search
× Search
Tuesday, November 19, 2024

Archived Discussions

Recent member discussions

The Algorithmic Traders' Association prides itself on providing a forum for the publication and dissemination of its members' white papers, research, reflections, works in progress, and other contributions. Please Note that archive searches and some of our members' publications are reserved for members only, so please log in or sign up to gain the most from our members' contributions.

Greetings! Anyone here knows how to create a Zero-Lag Moving Average in Trading? Thanks in advance.

photo

 Favio P., Foreign Exchange Trader at Saxo Bank, Technical Analyst of Charts

 Thursday, January 8, 2015

Greetings! Anyone here knows how to create a Zero-Lag Moving Average in Trading? Thanks in advance.


Print

9 comments on article "Greetings! Anyone here knows how to create a Zero-Lag Moving Average in Trading? Thanks in advance."

photo

 Jack M., Trader at Seven Points Capital

 Friday, January 9, 2015



For what platform? Shoot me an email at contact@investingware.com


photo

 Favio P., Foreign Exchange Trader, Technical Analyst of Charts

 Sunday, January 11, 2015



Thanks everyone for sharing.

In fact, I have read some very 'ancient' (back to 1987) articles regarding the Zero-Lag Moving Averages and was astonished by their discovery. Indeed, it exists a trade-off when using MA, smoothing and lagging, but Zero_Lag MA have proved to give correct and fast signals compared to just simple MA (using MT4 platform).

Thanks @Brian & @Guy for the John Ehlers' IIR smoother.


photo

 Alex Krishtop, trader, researcher, consultant in forex and futures

 Monday, January 12, 2015



"Zero lag" MAs, as well as any other indicator, can indeed give "correct and fast" signals. The point is whether they are tradable.

In reality any (sic!) MA is a high order digital filter. This means that if we compare output with input we can see a phase shift. This phase shift is often called "lag" in books on trading. You cannot remove the phase shift completely, or "remove the lag" in technical trading terms, therefore it's impossible to create a "zero lag" MA or anything else "zero lag". It's just common sense: you need first to process data and then transform it into an output, you cannot do it concurrently with input.

So, what is a "zero lag" MA then? It is a filter with a variable cutoff frequency and feedback. This basically means that it filters out different parts of spectrum of the input signal depending on changes in this very spectrum. In this case the phase shift is also not constant. Visually it may create an illusion that the output signal, if drawn in form of a waveform along with the input, "follows" the input more "adaptively". However the phase shift and the lag is still there, only in a different form — and more complex to handle than that of a "regular" MA.

Regardless of what said above, I am always maintaining that no indicator by itself can "give correct and fast signals": we need to have a trading idea first, and only then select the right tools to describe this idea formally. Besides that you cannot say anything about the correctness of the signals generated by anything without exit rules. Entries do not exist without exits.

Long as world discussion, and yet it appears once and again here and there.


photo

 Asim Mahmood, Vice President at Nomura

 Monday, January 12, 2015



If you are hands on with Matlab of any other programming language where you can use matrix libraries easily, you may want to consider the model given in:

http://www.lce.hut.fi/~ssarkka/pub/neuro-ks-preprint.pdf


Equations 34,35,36 define the state-space model. This is a well studied model where you need to tune in two parameters - q^x and sigma_x. You can play around with these to see the effects of filtering and smoothing. These parameters control your signal to noise ratio in this model, basically.


Equations 13-19 describe the standard (forward) filter and the set of equations in 21 describe the (backward) smoother.


It might be slightly tricky to code this in the first instance if you are not familiar with the theory, but in my view this framework embodies the basic principle for creating "zero-lag" filters (through backward smoothing). Also, note that the "smoothed" estimate from the last (or latest) data point is only as good as the filter estimate!


Finally, as Guy has said above, close to "zero-lag" averaging is not enough for a strategy to perform!


PS: you might just be able to use excel/vba to code this.


photo

 Guy R. Fleury, Independent Computer Software Professional

 Monday, January 12, 2015



Anyone wishing to test on their own how different filters behave with the same lag might be interested in the following:


.


http://wl4.wealth-lab.com/cgi-bin/WealthLab.DLL/editsystem?id=19038



Explanations are provided by the author: DrKoch. In the stock symbol box, enter a stock ticker, press 'execute chartscript' to see the results. The 2 includes at the beginning of the script can be found in the 'code library'.


photo

 tim higgs, manager at fulford heath golf club

 Tuesday, January 13, 2015



Having tested and used john Ehlers filters including his zero lag one and Jurik research filters (JMA) i can say i find jurik to be the more superior but as Alex and others have stated that there is always a trade off between smoothness and lag or timeliness of the signal (whether it is tradeable or not ).

Zero lag smoothers can still create false signals just like a kalman filter when it overshoots and does not turn quick enough when prices have reversed . All moving average filters attempt to do is to try and filter out certain frequencies , if you are interested send me a private message as there is a way to combine a super-position style chart and a certain type of filter to create something close to a zero lag filter.


photo

 Boris Anderer, Partner Booster Ventures

 Friday, January 16, 2015



When applying MA smoothing it is always a trade-off between lag and repainting of the latest smoothing data. If you want no repainting of once calculated data you always have to accept a certain lag and vice versa. Another example of a non-repainting low lag MA is at http://fx-tips.net/?s=Duerschner+New+moving+average . Next to the digital Zero Lag Low-Pass filter of Ehlers you can also consider Empiric Mode Decomposition filter as described in https://www.mql5.com/en/articles/439 . The related MA implementation works pretty well. And finally as already said: a pure cross-over MA solution using such indis is not sufficient for a successful system. E.g. there should be considered at least also dominant cycle period adapted indis as described here https://www.mql5.com/en/articles/288 .


photo

 Jian Gong, Futures Trader

 Monday, January 19, 2015



Technically, you can have MA filters with zero lags--symmetric filters will do, but you have to know future prices. Needless to say, it is useless in trading.

If you limit your choice to MA filters, which are finite-impulse-response low-pass filters, then best you can get is low lag at certain frequencies, with a nonlinear phase response (the shape of the filtered prices may not resemble that of the unfiltered prices).

If you use band-pass filters (a simple example is the MACD indicator), then you can even get a leading signal (MACD is a leading indicator). Then you will get overshoots and undershoots.

The fundamental thing, I believe, is that you cannot get perfect (i.e., causal) point estimates, although that is every trader's dream. It is going to be a distribution and a density estimator should be more appropriate.


photo

 private private,

 Thursday, January 22, 2015



You'd have to rephrase the question. As stated, simple rolling average or exponential moving averages will need an activation time.

What you might be looking for is a nonlinear transform that allows for rapid action on large events, however you define it.

In that case wavelets is an excellent tool to work with. More specifically, denoising by soft thresholding. This is the literature reference:

http://www.fceia.unr.edu.ar/~jcgomez/wavelets/Donoho_1995.pdf

You can also use splines under tension. This is an old technique but really widespread.

http://www-num.math.uni-wuppertal.de/fileadmin/mathe/www-num/theses/ma_werneburg.pdf

These are common problems in signal processing in engineering but they are somewhat sophisticated to be implemented in your average excel/VBA subroutine.

Please login or register to post comments.

TRADING FUTURES AND OPTIONS INVOLVES SUBSTANTIAL RISK OF LOSS AND IS NOT SUITABLE FOR ALL INVESTORS
Terms Of UsePrivacy StatementCopyright 2018 Algorithmic Traders Association