Attachments forums

List of attachments posted on this forum.


All files on forums: 136240

Re: Adaptive Indicators for MT4

Black Sheep, Mon Mar 16, 2020 12:03 pm

mladen wrote: Mon Mar 16, 2020 7:17 am

That would mean using unilateral Laplace transform (in the case of Laplace transform it would provide the causality of the calculated values) but I doubt that there will be anybody willing to post anything like that on any public forum (for reasons i have already attempted to clarify in numerous posts)
Well, this would be a starting point, a very crude one I must say.

I am not a coder, however, Dear Mladen, this could be your territory if you have some extra time to this project:

Nyquist-Shannon Moving Average

A certain paper of Dr Manfred Dürschner titled 'Moving Averages 3.0'. This title, as well as the fact that in 2011 the author received the First prize of VTAD Award (German Association of Technical Analysts) for this particular paper, got my attention.

I found an English language version of Dr Dürschner's paper in 2012 issue of IFTA Journal, downloadable here:

After some research on the matter, I come across Jürgen (aka Simplex Trader) as he started to code the indicators Dr Dürschner proposed in mq4. The following is from his own merit and I simply quote:

"Core indicator is a moving average that follows the Nyquist-Shannon sampling 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 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 adaptive error correction of a standard EMA. Sorry for the confusion - it was late last night! :roll: )

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 than 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 chooses 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 the following image:

screen_nyquist.JPG


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 the green line. This may be compared with the standard LWMA(6, Close) - see the 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 of 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 Aroon's show very similar results, the Nyquist variant signalling 1 bar earlier on 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 resources. 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!"

Perhaps somebody could have a crack at coding the indicator?
All files in topic