Within Mladen's indicator, "Dynamic zone pa adaptive Rsx nrp_alerts_lines_divergence nmc.mq4" that I attached below there is the iHilbertPhase() function that calculates the Length variable then the Kg and Hg variables are derived as below.
However, I would like to know what is the instantaneous amplitude, momentum as shown in the image below, plus the phase and the length in bars of the dominant cycle that is calculated by your "Dynamic zone pa adaptive Rsx nrp_alerts_lines_divergence nmc.mq4" indicator. It may be that all those values are already calculated by the iHilbertPhase() function in this indicator but with variable names I don't understand so I don't know what the variables such as Length, Kg and Hg are referring to. So if those values are already calculated then please let me know which variables are actually referring to these 4 values: the instantaneous amplitude, the momentum, the phase and the length in bars of the dominant cycle. Otherwise, can you please add these 4 values to the iHilbertPhase function so the current 4 values can be displayed as a comment, or better than that, as 4 additional buffers so we can know these 4 values at any bar in the past?
Code: Select all
double Length = iHilbertPhase(wrkBuffer[r],PaFilter,PaCycles,i);
double Kg = (3.0)/(2.0+Length);
double Hg = 1.0-Kg;
My idea is to use these 4 values to understand how much of the current amplitude we have already traveled so far within the current dominant cycle, or more important, how much amplitude is left before we reach the full amplitude so we can know if there are enough pips left to make a good profit, or at least for our trailing stop to break even plus a small profit. Also, with the amplitude and momentum values we can know whether the market is in cycling or trending mode and if trending by how much.
Thank you very much Mladen for writing the attached indicator and we hope you or one of your associates can add those 4 values or post the code to add those values to the iHilbertPhase() function. We are looking forward to hearing from you all. Thanks.
mrtools wrote: Mon Dec 24, 2018 11:42 am
Can't explain it better than Mladen, this is his explanation:::
And now the reason for posting at this thread :
John Ehlers made also an indicator called Phase accumulation. I did not find a working version of it for metatrader 4 (the ones I found are with too much deviations from the original, so the usage of those is rather limited) so made one. The idea (in short) is to find how many bars does it take to add up every bars phases and to reach certain cycle (Ehlers uses only 1 full cycle but I decided to make it as a parameter where you can choose for how many cycles do you want to check the phases for - the "why" I did it will be explained later)
So, the way it is calculated, it gives a kind of a "perfect" period that should be applied to some indicator. And now the "why" variable cycles parameter : if we test just 1 full cycle then the speed of an indicator can not be changed (it will depend solely on data) and that way some indicators that could use this way of calculating periods could not benefit from it : averages, MACD, and so on ... But with variable cycles they become "controllable" and in that way, much more usable. So here are two offsprings of the Phase accumulation : Phase accumulation EMA (so adaptive) and Phase accumulation MACD (adaptive again). On the picture : Half cycle EMA and full cycle EMA, and the same cycles MACD
PS: Ehlers uses default value 7 for filter (smoothing) but I decided to set it to no smoothing (when filter is set to 1 or less there is no smoothing)) in order to make it clearer what exactly does the Phase accumulation do
And more from him
The Hilbert Transform itself, is an all-pass filter used in digital signal processing. By using present and prior price differences, and some feedback, price values are split into their complex number components of real (inPhase) and imaginary (quadrature) parts.
This version :
We are using the Hilbert transform in a phase accumulation mode in order to calculate how many bars are needed to accumulate enough one bar "inPhases" to reach the desired cycle. That way it adjusts / adapts to the market conditions. As such you can not adjust the parameters to get a "classical" counterpart - simply it is not going to be as anything based on fixed periods and one should forget classical periods term for this one and get used to the cycles term