[MAD] Trigonometric TrendThis is a Multitimeframe Trendfinder
the basic math comes from alexgrovers
Trigonometric Oscillator
What it does:
30 times with different lengths
both for close and obj
Trendalerts based on direction
both obj and close must meet the
condition
Digital out signal for first analysis,
may upgrade to multibit later
This is a separate hidden plot
"Digitalsignal" which can get feeded
into a x8 Processor as example
Show the field of many as option to see how the avg. lines are built
have fun
Trigonometric
Fourier Extrapolator of Price [Loxx]Fourier Extrapolator of Price is a multi-harmonic (or multi-tone) trigonometric model of a price series xi, i=1..n, is given by:
xi = m + Sum( a *Cos(w *i) + b *Sin(w *i), h=1..H )
Where:
xi - past price at i-th bar, total n past prices;
m - bias;
a and b - scaling coefficients of harmonics;
w - frequency of a harmonic;
h - harmonic number;
H - total number of fitted harmonics.
Fitting this model means finding m, a , b , and w that make the modeled values to be close to real values. Finding the harmonic frequencies w is the most difficult part of fitting a trigonometric model. In the case of a Fourier series, these frequencies are set at 2*pi*h/n. But, the Fourier series extrapolation means simply repeating the n past prices into the future.
This indicator uses the Quinn-Fernandes algorithm to find the harmonic frequencies. It fits harmonics of the trigonometric series one by one until the specified total number of harmonics H is reached. After fitting a new harmonic, the coded algorithm computes the residue between the updated model and the real values and fits a new harmonic to the residue.
see here: A Fast Efficient Technique for the Estimation of Frequency , B. G. Quinn and J. M. Fernandes, Biometrika, Vol. 78, No. 3 (Sep., 1991), pp. 489-497 (9 pages) Published By: Oxford University Press
The indicator has the following input parameters:
src - input source
npast - number of past bars, to which trigonometric series is fitted;
nharm - total number of harmonics in model;
frqtol - tolerance of frequency calculations.
The indicator plots the modeled past values
The purpose of this indicator is to showcase the Fourier Extrapolator method to be used in future indicators. While this method can also prediction future price movements, for our purpose here we will avoid doing.
Trigonometric compare close vs obvTrigonometric compare
This is copy and mod of a script from alexgrower which did this great trigonometric math.
As there was this idea floating around from some unicorn doing it instead of close also with the ta.obv, why not compare them.
from a first idea:
green=bullish trend
red=baserish trend
blue=deciding and acceleration zone
or maybe SL hunting of whales
Plot1: trigonometrics for obv
Plot2: trigonometrics for close
Plot3: trigonometrics for obv-close
what to trade or how to trade no idea, just hat do post the basic idea of this compare.
have fun
MathTrigonometryLibrary "MathTrigonometry"
Trigonometric methods.
sinc(value) Normalized sinc function.
Parameters:
value : float, value.
Returns: float.
cot(value) Cotangent of value.
Parameters:
value : float, value.
Returns: float.
csc(value) Cosecant of value.
Parameters:
value : float, value.
Returns: float.
sec(value) Secant of value.
Parameters:
value : float, value.
Returns: float.
acot(value) Arc cotangent of value.
Parameters:
value : float, adjacent value.
Returns: float.
asec(value) Arc secant of value.
Parameters:
value : float, hypotenuse value.
Returns: float.
acsc(value) Arc cosecant of value.
Parameters:
value : float, hipotenuse value.
Returns: float.
sinh(angle) Hyperbolic sine of angle.
Parameters:
angle : float, value.
Returns: float.
cosh(angle) Hyperbolic cosine of angle.
Parameters:
angle : float, value.
Returns: float.
tanh(angle) Hyperbolic tangent of angle.
Parameters:
angle : float, value.
Returns: float.
coth(angle) Hyperbolic cotangent of angle.
Parameters:
angle : float, value.
Returns: float.
sech(angle) Hyperbolic secant of angle.
Parameters:
angle : float, value.
Returns: float.
csch(angle) Hyperbolic cosecant of angle.
Parameters:
angle : float, value.
Returns: float.
asinh(value) Hyperbolic area sine.
Parameters:
value : float, value.
Returns: float.
acosh(value) Hyperbolic area cosine.
Parameters:
value : float, value.
Returns: float.
atanh(value) Hyperbolic area tangent.
Parameters:
value : float, value.
Returns: float.
acoth(value) Hyperbolic area cotangent.
Parameters:
value : float, value.
Returns: float.
asech(value) Hyperbolic area secant.
Parameters:
value : float, value.
Returns: float.
acsch(value) Hyperbolic area cosecant.
Parameters:
value : float, value.
Returns: float.
Trigonometric On Balance Volume (OBV) OscillatorLove volume analysis but it's hard for you to implement a simple strategy by it?
Use OBV.
Is OBV still not quite as it should be for you to get it in your trading system?
Use OBV Oscillator.
Does OBV Oscillator give you too many false signals and when you smooth it, it lags by a ton?
Then this indicator is the answer to your problem.
Introducing the Trigonometric OBV Oscillator.
The Trigonometric OBV Oscillator or "Trig OBV" for short, uses an old, but uniquely extremely reliable mathematical formula to smooth the OBV, while eliminating more than 95% of its false signals (noises) and keeping with the real direction of the trend without introducing any lags.
It is very responsive, predictive even to some degree, very reliable, and keeps you out of false trades (like false breakouts, sudden changes in the price, etc).
To go long: wait until the white line crosses up the purple line and continues in that direction.
To go short: wait until the white line crosses down the blue line and continues in that direction.
To exit, do the opposite.
Better to be used with a baseline filter such as Kaufman's moving average.
Use it and let me know what you think about it.
Shapeshifting Moving Average - Switching From Low-Lag To SmoothThe term "shapeshifting" is more appropriate when used with something with a shape that isn't supposed to change, this is not the case of a moving average whose shape can be altered by the length setting or even by an external factor in the case of adaptive moving averages, but i'll stick with it since it describe the purpose of the proposed moving average pretty well.
In the case of moving averages based on convolution, their properties are fully described by the moving average kernel ( set of weights ), smooth moving averages tend to have a symmetrical bell shaped kernel, while low lag moving averages have negative weights. One of the few moving averages that would let the user alter the shape of its kernel is the Arnaud Legoux moving average, which convolve the input signal with a parametric gaussian function in which the center and width can be changed by the user, however this moving average is not a low-lagging one, as the weights don't include negative values.
Other moving averages where the user can change the kernel from user settings where already presented, i posted a lot of them, but they only focused on letting the user decrease or increase the lag of the moving average, and didn't included specific parameters controlling its smoothness. This is why the shapeshifting moving average is proposed, this parametric moving average will let the user switch from a smooth moving average to a low-lagging one while controlling the amount of lag of the moving average.
Settings/Kernel Interaction
Note that it could be possible to design a specific kernel function in order to provide a more efficient approach to today goal, but the original indicator was a simple low-lag moving average based on a modification of the second derivative of the arc tangent function and because i judged the indicator a bit boring i decided to include this parametric particularity.
As said the moving average "kernel", who refer to the set of weights used by the moving average, is based on a modification of the second derivative of the arc tangent function, the arc tangent function has a "S" shaped curve, "S" shaped functions are called sigmoid functions, the first derivative of a sigmoid function is bell shaped, which is extremely nice in order to design smooth moving averages, the second derivative of a sigmoid function produce a "sinusoid" like shape ( i don't have english words to describe such shape, let me know if you have an idea ) and is great to design bandpass filters.
We modify this 2nd derivative in order to have a decreasing function with negative values near the end, and we end up with:
The function is parametric, and the user can change it ( thus changing the properties of the moving average ) by using the settings, for example an higher power value would reduce the lag of the moving average while increasing overshoots. When power < 3 the moving average can act as a slow moving average in a moving average crossover system, as weights would not include negative values.
Here power = 0 and length = 50. The shapeshifting moving average can approximate a simple moving average with very low power values, as this would make the kernel approximate a rectangular function, however this is only a curiosity and not something you should do.
As A Smooth Moving Average
“So smooth, and so tranquil. It doesn't get any quieter than this”
A smooth moving average kernel should be : symmetrical, not to width and not to sharp, bell shaped curve are often appropriates, the proposed moving average kernel can be symmetrical and can return extremely smooth results. I will use the Blackman filter as comparison.
The smooth version of the moving average can be used when the "smooth" setting is selected. Here power can only be an even number, if power is odd, power will be equal to the nearest lowest even number. When power = 0, the kernel is simply a parabola:
More smoothness can be achieved by using power = 2
In red the shapeshifting moving average, in green a Blackman filter of both length = 100. Higher values of power will create lower negative values near the border of the kernel shape, this often allow to retain information about the peaks and valleys in the input signal. Power = 6 approximate the Blackman filter pretty well.
Conclusion
A moving average using a modification of the 2nd derivative of the arc tangent function as kernel has been presented, the kernel is parametric and allow the user to switch from a low-lag moving average where the lag can be increased/decreased to a really smooth moving average.
As you can see once you get familiar with a function shape, you can know what would be the characteristics of a moving average using it as kernel, this is where you start getting intimate with moving averages.
On a side note, have you noticed that the views counter in posted ideas/indicators has been removed ? This is truly a marvelous idea don't you think ?
Thanks for reading !
Trigonometric OscillatorIts a pretty old script and i have absolutely no idea how i did it, the code kinda look like the phase wrapping/unwrapping formula. This indicator is an oscillator, sometimes its reactivity is impressive so i think its a good idea to post it, feel free to experiment with it.