AliSignals

MA total distance on chart

NOTE:
The name I used for this indicator was created by me and I’m not sure if it has been used or created by any other trader/creator in the past or not!


Motivation to create:
One of the most important uses of “moving averages” is indicating the trend! There are different ways you can distinguish trend by using moving averages and one of the most popular type of it is comparing closing price to a MA. In this case if close is higher than the MA, trend is bullish and if close is lower than MA, it’s bearish. This method is really useful and I see great results in my long-term back-tests, especially SMA-100 in 1H chart filter so many fake signals in many different indicator-based strategies (Personal experience). There are so many problems with using indicators that sometimes have difficult solutions but one of them is fake breakout!


Looking at the top picture, you’ll get a breakout has happened but trend did not change!
A super bearish trend is obviously visible in the chart and we know a small break out might be a fake one, but what if we have an indicator make conditions of a trend change a little harder?


Introduction:
I was careful about how I used moving averages and I got that I will take not only the last candle close price into consideration, so in these kind of false breakouts I will not fall into trap of them, On the contrary, I find a good opportunity to enter the market opposite of the MA break! (In this case short trade). I calculate the total distance of last 40 candles and divide them to 40, to get the average distance, to each a mathematical score for power of our trend comparing to the MA!
Number are just default you can change them.
In the picture below you can see how well it filtered the false breakout.


As it is obvious, Timeframe, MA length, MA source and MA type are editable.

Since I do not tested this indicator enough (for me enough means more than 5000 trades and 10 years) I can’t suggest any settings as the best one.
The distance length, which means number of candles that their distance to MA is considered in our calculations, the distance source and also smoothing of the MATD is editable too.

And without editing it will look like something like this!











Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?