Trend Type Indicator by BobRivera990


The purpose of this indicator is to programmatically determine the type of price trend using technical analysis tools.
You can do a quick check on the asset’s higher and lower time frames. For example, if you are trading on an H1 chart, you can check the m5 chart to ensure that the trend is in the same direction and similarly check the H4 chart to ensure that the higher time frame price is also moving in the same direction.
If multiple time frame charts confirm a similar trend, then it is considered a very strong trend and ideal for Trend trading.

By default, the last status is related to 8 periods before the latest closing price.

Related definitions:

The three basic types of trends are up, down, and sideways.

1. Uptrend
An uptrend describes the price movement of a financial asset when the overall direction is upward. The uptrend is composed of higher swing lows and higher swing highs.
Some market participants ("long" trend traders) only choose to trade during uptrends.

2. Downtrend
A downtrend refers to the price action of a security that moves lower in price as it fluctuates over time.
The downtrend is composed of lower swing lows and lower swing highs.

3. Sideways
A sideways trend is the horizontal price movement that occurs when the forces of supply and demand are nearly equal. This typically occurs during a period of consolidation before the price continues a prior trend or reverses into a new trend.

How it works:

Step 1: Sideways Trend Detection
In this step we want to distinguish the sideways trend from uptrend and downtrend. For this purpose, we use two common technical analysis tools: ATR and ADX

1. Average True Range (ATR)
The average true range (ATR) is a technical analysis indicator that measures market volatility .
We also use a 20-period moving average of the ATR.
When the ATR is below the average of its last 20-periods, it means that the rate of price volatility has decreased and we conclude that the current trend is sideways

2. Average Directional Index ( ADX )
The average directional index ( ADX ) is a technical analysis indicator used by some traders to determine the strength of a trend.
The trend has strength when ADX is above 25.
So when the ADX is less than or equal to 25, there is no strong trend, and we conclude that the current type of trend is sideways.

Step 2: Detect uptrend from downtrend
If it turns out that the current price trend is not sideways, then it is either uptrend or downtrend.
For this purpose, we use plus and minus directional Indicators (+ DI & -DI ).
A general interpretation would be that during a strong trend, when +DI is higher than -DI , it is an uptrend. When -DI is higher than +DI , it is a downtrend.


"Use ATR …" ________________________// Use Average True Range (ATR) to detect Sideways Movements
"ATR Length"_______________________ // length of the Average True Range (ATR) used to detect Sideways Movements
"ATR Moving Average Type" ___________// Type of the moving average of the ATR used to detect Sideways Movements
"ATR MA Length" ____________________// length of the moving average of the ATR used to detect Sideways Movements
"Use ADX ..."_______________________ // Use Average Directional Index ( ADX ) to detect Sideways Movements
"ADX Smoothing”____________________// length of the Average Directional Index ( ADX ) used to detect Sideways Movements
"DI Length"_________________________// length of the Plus and Minus Directional Indicators ( +DI & -DI ) used to determine the direction of the trend
"ADX Limit" ________________________// A level of ADX used as the boundary between Trend Market and Sideways Market
"Smoothing Factor"__________________// Factor used for smoothing the oscillator
"Lag"______________________________// lag used to match indicator and chart

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


200 เหรียญ
+1 ตอบกลับ
100 เหรียญ
+1 ตอบกลับ
500 เหรียญ
@PineCoders, Do you guys even check something before putting in editors pick? This runs on delay.

Have you guys even read the description?
By default, the last status is related to 8 periods before the latest closing price. What do you think it means? It has minimum lag of 8 periods which can be extended to 15.

This indicator is a stupid joke on the name of this community. I mean there are far more better indicators out there. I guess I,m not supposed to any links here other wise I'd posted a video showing each and everything here. If it had the option of switching on/off lag this may be considered but I guess doing that the author wont be able to find a single screenshot.
No offence to the author ,I have no hard feeling for ya man.
+8 ตอบกลับ
PineCoders TitanQred
@TitanQred, We not only we read the description and code of our Editors Picks, we do it for ALL open-source scripts published on the platform. There is nothing inherently wrong with the fact that the indicator displays late information; it's what most pivot, zig zag and many other indicators do, and contrary to many other authors of those scripts, this one mentions it.

Our Editors' Picks strive to achieve a diversity reflecting that of TradingViewers, which necessarily entails that not all our selections will be useful or interesting to all traders. While you may not find this selection suitable for you, we hope you can allow us to entertain the hope that others will.
+4 ตอบกลับ
TitanQred PineCoders
@PineCoders, Just like what you said, my comment will certainly help others.
BobRivera990 TitanQred
I think you did not understand the meaning of lag.
lagging indicators are SMA, EMA, MACD
And many of the indicators we work with every day.
Do not you use them?
Do you not believe in ema because it lags behind the price chart?
I used offset to match the indicator and the chart.
Results are not displayed after the trend is done
Only 8 bars are shifted to the left
You can try this
I hope you understand
TitanQred BobRivera990
@BobRivera990, Hey man, Yes I do understand but what you are not trying to understand is that criticisms are good for you. If you think everyone would like your indicator I guess you are not trying to be realistic.

I said what I felt about it and it doesn't mean I'm disregarding your effort or something and you should not pay attention to such people who just come and appreciate just because you made something. If you talk about MA's people these days are working with KAMA's to make their stuff more effective, same goes for MACD and every other thing out there that lags.

BobRivera990 TitanQred
Lag is not a bad thing and by examining two moving averages with less and more Lag, we can determine the direction of the trend.
All the useful information that the MACD indicator gives us is based on this logic. KAMA is also a lagging indicator and its use is not common.
I am not looking for your likes. I love criticism but I hate insults.
Criticism must be based on logic and respect. You likened my indicator to a joke.
But I wish you good health.
หน้าแรก ตัวช่วยคัดกรองหุ้น ตัวคัดกรองฟอเร็กซ์ ตัวคัดกรองคริปโต ปฏิทินเศรษฐกิจ เกี่ยวกับ ฟีเจอร์ของชาร์ต อัตราค่าบริการ แนะนำเพื่อน กฎระเบียบการใช้งาน ศูนย์ช่วยเหลือ โซลูชั่นสำหรับเว็บไซต์ & โบรกเกอร์ วิดเจ็ต ชาร์ตโซลูชั่น Lightweight ชาร์ตไลบรารี บล็อก & ข่าว Twitter
โปรไฟล์ ตั้งค่าโปรไฟล์ บัญชีและการเรียกเก็บเงิน เพื่อนที่ชวนมา เหรียญ ตั๋วการขอความสนับสนุนของฉัน ศูนย์ช่วยเหลือ ข้อความส่วนตัว แชท ออกจากระบบ