| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Nyquist-Shannon Moving Average https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=2637 |
Page 1 of 2 |
| Author: | simplex [ Tue Jul 02, 2013 12:04 am ] |
| Post subject: | Nyquist-Shannon Moving Average |
Hi Everybody! Some days ago I came across a paper of Dr. Manfred Dürschner titled 'Moving Averages 3.0'. This title as well as the fact that in 2011 the author received a First prize of VTAD Award (German Association of Technical Analysts) for this particular paper got my attention. So I started to code the indicators Dr. Dürschner proposed in mq4. Find his paper here to download: http://www.vtad.de/sites/files/forschun ... itte_3.pdf I only found it in German - so good luck out there! Core indicator is a moving average that follows the Nyquist-Shannon sampling theorem (see: http://en.wikipedia.org/wiki/Nyquist%E2 ... ng_theorem). The Nyquist MA is being composed of a single smoothed and a double smoothed LWMA which finally are mapped by the formula NMAW = (alpha+1) * MA1 - alpha * MA2, where alpha is a function of the sampling frequencies of the LWMAs - see program code for details. Dr. Dürschner cites John Ehlers' 2001 paper 'Signal Analysis Concepts' and points out, that Ehlers' Zero Lag MA presented in this paper violates the Nyquist-Shannon sampling theorem. I will check this out later and code Ehlers' ZeroLag with a correction according to Nyquist-Shannon and see what happens as compared with the original. (Correction: I re-read Ehlers' article and did not find any MA described in detail here. On p. 3 there is only a theoretical concept for a zero lag MA. Ehlers describes a double smoothed MA where both stages produce the same amount of lag, i.e. must have the same averaging length. This really would be a violation of Nyquist-Shannon, but has nothing to do with the well-known Ehlers' ZeroLag MA. This is not based on a double smoothing concept, but on an adaptive error correction of a standard EMA. Sorry for the confusion - it was late last night! In short, the theorem says that when one MA is being sampled onto its own signal the sampling period of the second MA must not be larger that half the period of the first MA. A violation of this law can lead to 'ghost signals' like Moiré patterns some of you might know from digital photography (see wikipedia link for an example). Describing two 'Trading Systems' that consist only of one oscillator each Dr. Dürschner proposed the following algorithms: 1. An Aroon Oscillator(5) placed over a Nyquist MA(89, 21) output and sharpened by an Inverse Fisher Transform. 2. A Stochastic-RSI (Stoch 3, RSI 5) placed over Nyquist MA(8, 3) output and sharpened by an Inverse Fisher Transform. He proposed the Aroon for medium term trading on daily stock charts, the SRSI for short term trading on M15 DAX papers. The backtesting results he describes are outstanding (104 individual tests on stock titles over 11 years). Average net profits 4600% based on Nyquist MA, 1200% based on Ehlers' MA, 800% based on LWMA, 110% Buy&Hold. My personal opinion: I do not think that it's legitimate to compare the results in this manner, because he choose equal periodicity (89 cycles) for each of the MAs used. IMO the MAs should have been adjusted in a way that all of them show similar smoothing, which definitely is not the case for the above mentioned settings. Anyway ... ... to check usability for FX I also coded both oscillators based on a standard iMA so we can compare them with the Nyquist results. See following image: I chose AUDCHF on H1 because it showed a rather clear picture last week - didn't want things to become too complicated for a start. Then I placed a Nyquist MA(32, 8, LWMA, Close) on the chart - see green line. This may be compared with the standard LWMA(6, Close) - see violet line. There's not much of a difference, IMO. Next are both Stochastic RSI(Stoch 3, RSI 5): based on Nyquist(32, 8, Typical) in blue and LWMA(15, Typical) in green. I tuned both frequencies in a way that they fit the peak on June 27, 11:00 very timely. Doing so, the Nyquist variant gives most signals one or two bars before the iMA variant, but also shows significantly more whipsaw signals (grey rectangles). For the Aroon Oscillator I followed Dr. Dürschner's proposal for 89 periods primary smoothing and 21 periods secondary, both LWMA on Median. Then I tuned the iMA-based Aroon to the very same base frequency: LWMA(21, Median). Both Aroons show very similar results, the Nyquist variant signaling 1 bar earlier in average. My personal conclusion: I do not see a real added value in the Nyquist based oscillators as compared with the iMA based ones - which are easier to realize and consume fewer computer ressources. But the signals produced seem to be clear and timely, it might be possible to integrate them in a trading system successfully. Call for German speaking coders: if you like to, please have a closer look at the original paper, and compare the algorithm details with my code. Maybe I didn't get every detail correctly and we can further optimize the results. Any feedback appreciated! Experienced traders: I would be interested in your opinion about the usability of these indicators for practical trading, maybe in an EA. Indicators' details: General: priceUsed: price constant maMode: iMA constant Nyquist MA: priPeriod: Nyquist primary (if 0: set default = 4.0 * secPeriod) secPeriod: Nyquist secondary period Stochastic RSI: rsiPeriod: RSI period stochPeriod: stochastic fastK period useFisher: use inverse Fisher transform or don't useProxy: use price proxy or direct price array Aroon parameters: aroonPeriod: Aroon period showNyquistFisher: show Inverse Fisher Transform based on Aroon(Nyquist MA) showDirectFisher : show Inverse Fisher Transform based on Aroon(price array) showNyquistAroon : show Aroon(Nyquist MA) without IFT showDirectAroon : show Aroon(price array) without IFT Now: play with the tools & have fun! Jürgen Addendum: I found an English language version of Dr. Dürschner's paper in 2012 issue of IFTA Journal, downloadable here: http://www.ifta.org/publications/journal/ |
|
| Author: | Jemook [ Tue Jul 02, 2013 12:07 am ] |
| Post subject: | Re: Nyquist-Shannon Moving Average |
Jürgen love the detail you went into with this. German engineering at it's finest |
|
| Author: | garyfritz [ Tue Jul 02, 2013 12:20 am ] |
| Post subject: | Re: Nyquist-Shannon Moving Average |
Yikes! I thought you were going to translate it into English. I have a weak understanding of Nyquist-Shannon sampling, and some familiarity with Ehlers' ZeroLag, but not enough to comment very intelligently on your analysis, unfortunately. What exactly do you mean that it violates N-S sampling? Are you saying the ZeroLag calculation samples more than half the period of the first MA? Yes, definitely. Not all averages respond the same as an SMA. That was also my immediate impression. I suspect you could get similar quicker signals with more whipsaws just by using a shorter length on a more traditional MA. Gary |
|
| Author: | simplex [ Tue Jul 02, 2013 12:33 am ] |
| Post subject: | Re: Nyquist-Shannon Moving Average |
Dr. Dürschner doesn't really give much detail on this particular issue. That's what I meant when I stated I would take Ehlers' ZeroLag MA and check it out ... later this week ... now it's 2:30 am and I feel like catching some sleep! cu, Jürgen |
|
| Author: | simplex [ Tue Jul 02, 2013 11:16 am ] |
| Post subject: | Re: Nyquist-Shannon Moving Average |
Gary, I posted a correction in post 1 - this has nothing to do with the well known Ehlers ZeroLag MA. Just a theoretical concept Ehlers described and Dr. Dürschner relates to. Regards, Jürgen |
|
| Author: | Profitiser [ Wed Jul 10, 2013 9:38 am ] |
| Post subject: | Re: Nyquist-Shannon Moving Average |
Hi Simplex, thanx for these indis. It seems really that you are the first having implemented Duerschners indis in mq4. I also like your mqh - approach of function implementation. Nevertheless I couldn't start Nyquist the indis up to now. I could compile them in the editor but the ex4 file couldn't be opened in my Empty4 client (I am using an XTB client; as German you probably know the XTB broker). Any idea for a solution ? I'll check the maths once more as you requested. |
|
| Author: | simplex [ Tue Jul 16, 2013 2:57 pm ] |
| Post subject: | Re: Nyquist-Shannon Moving Average |
Hi Profitiser, sorry for my late answer - have been quite busy last week (non FX). Any messages after compilation? Did you try it on a different client? I didn't have any problems running them on Alpari UK and Global Prime. IMO there's nothing really special in my coding, so at the moment I have no idea why they don't run on your client. Let's stay in touch. I would also be interested in your proceedings to make it run. simplex |
|
| Author: | emiko [ Thu Nov 14, 2013 3:53 am ] |
| Post subject: | Re: Nyquist-Shannon Moving Average |
Thanks for provision i will give it a try, cheers. |
|
| Author: | forexlover [ Sun Oct 18, 2015 12:23 pm ] |
| Post subject: | Nyquist-Shannon Moving Average |
Hi all.. Thanks for the indicator.. I use mobing averages and this idea looks great. I downloaded your indicator but i cannot load it on my chart. I use hotforex platform. What am i missing? |
|
| Author: | renexxxx [ Sun Oct 18, 2015 11:44 pm ] |
| Post subject: | Nyquist-Shannon Moving Average |
Try it with the attached .mqh in the \Include folder. Since v600 and above, the compiler has changed dramatically. Eg. the enum type identifier was introduced and therefore it became a reserved word. I have just renamed the enum variable in the attached file, and all compiles well. There were a few compiler warnings in the StochRSI-indicators, and I have removed those as well. |
|
| All times are UTC | Page 1 of 2 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|