Re: Ipolcycle

261
mrtools wrote: Sat Mar 14, 2020 8:56 am

Working on it made a drop down for the types and prices, haven't figured out yet exactly how to add the accessories to go with the different types.
Thank you, Mr Tools.
Like the quote attributed to Bohr says, “It is difficult to make predictions, especially about the future.”


Re: Adaptive Indicators for MT4

264
stanisic wrote: Sat Mar 14, 2020 8:29 pm How to use ipolycycle correctly? Thanks in advance.
Indeed, it's a post-analysis or sort of at a glance orientation while trading but doesn't yield trading directions as it's only a representation of the cycle phase. For trading maybe one can gather better indications/results by using the HilbertSineWave or the Schaff Trend Cycle.

As a note: Schaff Trend Cycle is an amazing oscillator to learn and add to your portfolio of useful indicators. The only thing to remember is that STC, like any other technical analysis tool, is not capable of providing accurate signals 100% of the time. Therefore, it will return false signals from time to time.

STC is a leading indicator, which means that it sends a signal before the price move has occurred. It also means that it lacks the accuracy of lagging indicators and should be used in conjunction with other technical analysis tools.

Here are some examples of trading using the Schaff Trend Cycle and the Stochastic Indicator as conformation.

[The examples were taken from this website https://www.mql5.com/en/code/7356]
Like the quote attributed to Bohr says, “It is difficult to make predictions, especially about the future.”

Re: Adaptive Indicators for MT4

265
Here is some reading regarding cycle phases and some of the calculations methods.
These users thanked the author Black Sheep for the post (total 2):
k_khan_bt, solarian
Like the quote attributed to Bohr says, “It is difficult to make predictions, especially about the future.”


Re: Adaptive Indicators for MT4

266
wojtek wrote: Sun Mar 15, 2020 7:37 am It's good for post-factum analysis only, I'm afraid, just as TMA, SSA (not end-pointed), Fourier and other stuff like that.
BTW, Laplace transform would be interesting to test as well as the Nyquist–Shannon sampling theorem
(Prof. Mladen, what do you think?)... :)
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)
These users thanked the author mladen for the post:
wojtek

Re: Adaptive Indicators for MT4

268
As we are on the theme of Cycles Analysis applied to trading, here is something worth mentioning IHMO.

Any experimental physicist would tell you that the number one tool for analyzing an electric signal is a Fast Fourier Transform (FFT). For those of you not familiar with the concept, an FFT can take a signal in the time domain, and break it apart into a frequency domain. Since electric signals are very much like price data (they oscillate and they're full of noise), I was wondering if anybody has ever tried to analyze price data using Fourier Analysis.

On a separate topic, there are also lots of noise-reducing techniques in experimental physics, like dithering, and adding white noise to a signal (in this case, price movement). Has anybody tried either of these techniques?

The Fourier Transform analysis can only be applied to periodic functions.

A periodic function is defined as a function which repeats itself every certain period of time. This, of course, is not applicable to the price action of any known financial instrument, simply because the price action does not repeat equally during certain time periods.

So, from the theoretical point of view, the Fourier Transform can't be used to analyze the price action of currencies or any other financial instrument.

However, I believe that it can be managed to apply the Fourier transform analysis but to portions of price actions. Let me explain this a little bit.

If the price action of a certain currency pair is considered, it must be cut down in which each piece must be confined within a certain known limit. For example, cutting the price action of the EUR/USD for 2 days based on the 1-hour chart provided that the price during these 2 days was oscillating between 1.1900 and 1.2000 for example.

Then applying a smoothing moving average for the extracted data, and then getting the time function of the moving average, and after all applying the Fourier Transform for the time function of the moving average.

The step of the moving average is important, as it will be very difficult to get the time function of the price data itself. It can be done by using curve fitting, but it's a very difficult and time-consuming issue. I don't even know if there is any software out there that do curve fitting for inserted data or not.

When you apply the Fourier Transform, you will get another time function which consists of only Sines and/or Cosines. The function will contain an infinite number of terms. The first term is called the fundamental component, and the rest are called the harmonics. That's what the Fourier Transform function is called when analyzing the Alternating Electric Current or any other waveform.

The Fundamental component is usually the most effective component, with the 3rd, 5th & the 7th components being taken into consideration. Usually, all the higher-order harmonics are neglected due to their minimal effect. Of course, I don't know what will be the analysis of the price action of currencies will result in.

Now the real question is: How can this improve trading and speculation?

If you are analyzing the most recent data, this can be a very useful tool to project price targets as well as defining market trend. Simply insert the required future time in the Fourier time function, calculate the fundamental, 3rd, 5th and 7th components, and you get a price. This price relative to what the price is right now will give an idea about the market next move.

Why this won't work as expected?

1- I don't believe that this will work as expected, just because the pair doesn't move in completely identical cycles. This deviation will result in errors in the Fourier Transform projections.

2- The market is trending during 60-70% of the time. These trending periods can't be analyzed using the Fourier Transform Analysis.

3- The Fourier Transform was created to analyze the behaviour of waves, electric signals and electric current. These phenomena are completely natural and are moving without any kind of emotions. On the other hand, the currencies and any financial market is being affected by many things, and emotions drive the markets sometimes, so there can be no fixed formula for the market, that's why trading systems that used to work in the past do not work in the future, because people change, but waves and electricity do not change their attitude because they don't like the way of their life for example, or because of terrorist attacks.

Again, IMHO, Mark Jurik has brought a substantial signal processing background from his military career developing missile tracking algorithms and other noise filtering techniques to processing price/time data for the financial markets. He currently builds the best smoothing algorithms I've seen in the financial industry. Whereas most indicators lag the more you add smoothing characteristics Juriks don't suffer the same problems. Quite clever really and you don't have to spend a lot of your time reinventing the wheel. He also references some other notables such as Kauffman. Also, Ehlers applied plenty of sound processing techniques used in filtering sound in amplifiers to his work and uses a lot of sound processing jargon as metaphors for filtering market noise.

http://www.jurikres.com/about/company.htm#top

For example, here is a chart of the current EURUSD M15 with the Mladen's Holt_double_exponential_smoothing_2.2, the red dotted line projecting the price trajectory for the next couple of hours also on the same chart as a matter of comparison I have placed a Fourier Extrapolator represented by the solid orange bold line.

By observing the predictions we should have the EURUSD appreciating at the beginning of the Asian Session, let's see how that unfolds in reality!
Like the quote attributed to Bohr says, “It is difficult to make predictions, especially about the future.”

Re: Adaptive Indicators for MT4

269
As we are on the theme of Cycles Analysis applied to trading, here is something worth mentioning IHMO.

Any experimental physicist would tell you that the number one tool for analyzing an electric signal is a Fast Fourier Transform (FFT). For those of you not familiar with the concept, an FFT can take a signal in the time domain, and break it apart into a frequency domain. Since electric signals are very much like price data (they oscillate and they're full of noise), I was wondering if anybody has ever tried to analyze price data using Fourier Analysis.

On a separate topic, there are also lots of noise-reducing techniques in experimental physics, like dithering, and adding white noise to a signal (in this case, price movement). Has anybody tried either of these techniques?

The Fourier Transform analysis can only be applied to periodic functions.

A periodic function is defined as a function which repeats itself every certain period of time. This, of course, is not applicable to the price action of any known financial instrument, simply because the price action does not repeat equally during certain time periods.

So, from the theoretical point of view, the Fourier Transform can't be used to analyze the price action of currencies or any other financial instrument.

However, I believe that it can be managed to apply the Fourier transform analysis but to portions of price actions. Let me explain this a little bit.

If the price action of a certain currency pair is considered, it must be cut down in which each piece must be confined within a certain known limit. For example, cutting the price action of the EUR/USD for 2 days based on the 1-hour chart provided that the price during these 2 days was oscillating between 1.1900 and 1.2000 for example.

Then applying a smoothing moving average for the extracted data, and then getting the time function of the moving average, and after all applying the Fourier Transform for the time function of the moving average.

The step of the moving average is important, as it will be very difficult to get the time function of the price data itself. It can be done by using curve fitting, but it's a very difficult and time-consuming issue. I don't even know if there is any software out there that do curve fitting for inserted data or not.

When you apply the Fourier Transform, you will get another time function which consists of only Sines and/or Cosines. The function will contain an infinite number of terms. The first term is called the fundamental component, and the rest are called the harmonics. That's what the Fourier Transform function is called when analyzing the Alternating Electric Current or any other waveform.

The Fundamental component is usually the most effective component, with the 3rd, 5th & the 7th components being taken into consideration. Usually, all the higher-order harmonics are neglected due to their minimal effect. Of course, I don't know what will be the analysis of the price action of currencies will result in.

Now the real question is: How can this improve trading and speculation?

If you are analyzing the most recent data, this can be a very useful tool to project price targets as well as defining market trend. Simply insert the required future time in the Fourier time function, calculate the fundamental, 3rd, 5th and 7th components, and you get a price. This price relative to what the price is right now will give an idea about the market next move.

Why this won't work as expected?

1- I don't believe that this will work as expected, just because the pair doesn't move in completely identical cycles. This deviation will result in errors in the Fourier Transform projections.

2- The market is trending during 60-70% of the time. These trending periods can't be analyzed using the Fourier Transform Analysis.

3- The Fourier Transform was created to analyze the behaviour of waves, electric signals and electric current. These phenomena are completely natural and are moving without any kind of emotions. On the other hand, the currencies and any financial market is being affected by many things, and emotions drive the markets sometimes, so there can be no fixed formula for the market, that's why trading systems that used to work in the past do not work in the future, because people change, but waves and electricity do not change their attitude because they don't like the way of their life for example, or because of terrorist attacks.

Again, IMHO, Mark Jurik has brought a substantial signal processing background from his military career developing missile tracking algorithms and other noise filtering techniques to processing price/time data for the financial markets. He currently builds the best smoothing algorithms I've seen in the financial industry. Whereas most indicators lag the more you add smoothing characteristics Juriks don't suffer the same problems. Quite clever really and you don't have to spend a lot of your time reinventing the wheel. He also references some other notables such as Kauffman. Also, Ehlers applied plenty of sound processing techniques used in filtering sound in amplifiers to his work and uses a lot of sound processing jargon as metaphors for filtering market noise.

For example, here is a chart of the current EURUSD M15 with the Mladen's Holt_double_exponential_smoothing_2.2, the red dotted line projecting the price trajectory for the next couple of hours also on the same chart as a matter of comparison I have placed a Fourier Extrapolator represented by the solid orange bold line.

By observing the predictions we should have the EURUSD appreciating at the beginning of the Asian Session, let's see how that unfolds in reality!
These users thanked the author Black Sheep for the post (total 2):
rudiarius, solarian
Like the quote attributed to Bohr says, “It is difficult to make predictions, especially about the future.”

Re: Adaptive Indicators for MT4

270
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?
Like the quote attributed to Bohr says, “It is difficult to make predictions, especially about the future.”


Who is online

Users browsing this forum: Amazon [Bot], ChatGPT [Bot], IBM oBot [Bot], Majestic-12 [Bot], ralf_dias, rudiarius, snoopyzam and 86 guests