OPEN-SOURCE SCRIPT
Better DEMA

The Better DEMA is a new tool designed to recreate the classical moving average DEMA, into a smoother, more reliable tool. Combining many methodologies, this script offers users a unique insight into market behavior.
How does it work?
First, to get a smoother signal, we need to calculate the Gaussian filter. A Gaussian filter is a smoothing filter that reduces noise and detail by averaging data with weights following a Gaussian (bell-shaped) curve.
Now that we have the source, we will calculate the following:
n2 = n/2 (half of the user defined length)
a = 2/(1+n)
ns
Now that we have that out of the way, it is time to get into the core.
Now we calculate 2 EMAs:
slow EMA => EMA over n
fast EMA => EMA over n2 period
Rather then now doing this:
DEMA = fast EMA * 2 - slow EMA
I found this to be better:
DEMA = slow EMA * (1-a) + fast EMA * a
As a last touch I took a little something from the HMA, and used a EMA with period of √n to smooth the entire the thing.
The Trend condition at base is the following (but feel free to FAFO with it):
Long = dema > dema yesterday and dema < src
Short = dema < dema yesterday and dema > src
Methodology
While the DEMA is an amazing tool used in many great indicators, it can be far too noisy.
This made me test out many filters, out of which the Gaussian performed best.
Then I tried out the non subtractive approach and that worked too, as it made it smoother.
Compacting on all I learned and smoothing it bit by bit, I think I can say this is worth looking into :).
Use cases:
Following Trends => classic, effective :)
Smoothing sources for other indicators => if done well enough, could be useful :)
Easy trend visualization => Added extra options for that.
Strategy development => Yes
Another good thing is it does not a high lookback period, so it should be better and less overfit.
That is all for today Gs,
Have fun and enjoy!
How does it work?
First, to get a smoother signal, we need to calculate the Gaussian filter. A Gaussian filter is a smoothing filter that reduces noise and detail by averaging data with weights following a Gaussian (bell-shaped) curve.
Now that we have the source, we will calculate the following:
n2 = n/2 (half of the user defined length)
a = 2/(1+n)
ns
Now that we have that out of the way, it is time to get into the core.
Now we calculate 2 EMAs:
slow EMA => EMA over n
fast EMA => EMA over n2 period
Rather then now doing this:
DEMA = fast EMA * 2 - slow EMA
I found this to be better:
DEMA = slow EMA * (1-a) + fast EMA * a
As a last touch I took a little something from the HMA, and used a EMA with period of √n to smooth the entire the thing.
The Trend condition at base is the following (but feel free to FAFO with it):
Long = dema > dema yesterday and dema < src
Short = dema < dema yesterday and dema > src
Methodology
While the DEMA is an amazing tool used in many great indicators, it can be far too noisy.
This made me test out many filters, out of which the Gaussian performed best.
Then I tried out the non subtractive approach and that worked too, as it made it smoother.
Compacting on all I learned and smoothing it bit by bit, I think I can say this is worth looking into :).
Use cases:
Following Trends => classic, effective :)
Smoothing sources for other indicators => if done well enough, could be useful :)
Easy trend visualization => Added extra options for that.
Strategy development => Yes
Another good thing is it does not a high lookback period, so it should be better and less overfit.
That is all for today Gs,
Have fun and enjoy!
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.