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!











Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?