OPEN-SOURCE SCRIPT

Trend Counter [BigBeluga]

16 822
The Trend Counter indicator is designed to help traders identify trend conditions and potential reversals by counting the number of bars within a specified period that are above or below an average price level. By smoothing and averaging these counts, the indicator provides a clear visual representation of market trends and highlights key trend changes.


Key Features:

Trend Counting:
Counts bars above and below average price levels over a specified period.
Smooths and rounds the count for better visualization.
Pine Script®
// Count bars over length period above highest and lowest avg with offset loop float mid = math.avg(ta.highest(length), ta.lowest(length)) for offset = 0 to length -1 switch hl2 > mid[offset] => counter += 1.0 => counter := 0.0 // Smooth Count and Round counter := math.round(ta.ema(counter > 400 ? 400 : counter, smooth)) // Count Avg count.push(counter) avg = math.round(count.avg())


⦿ Color Indication:
Uses gradient colors to indicate the strength of the trend.
Colors the background based on trend strength for easier interpretation.
ảnh chụp nhanh

⦿ Trend Signals:
Provides visual cues for trend changes based on the counter crossing predefined levels.
ảnh chụp nhanh

⦿ Potential Tops:
Identifies potential market tops using a specified length and highlights these levels.
ảnh chụp nhanh

⦿ Additional Features:
Displays Trend Counter value with arrows to indicate the direction of the trend movement.
Displays average trend count and level for reference.
ảnh chụp nhanh

⦿ User Inputs Description
  • Length: Defines the period over which the trend counting is performed.
  • Trend Counter Smooth: Specifies the smoothing period for the trend counter.
  • Level: Sets the threshold level for trend signals.
  • Main Color: Determines the primary color for trend indication.



The Trend Counter indicator is a powerful tool for traders seeking to identify and visualize market trends.
By counting and smoothing price bars above and below average levels, it provides clear and intuitive signals for trend strength and potential reversals.
With customizable parameters and visual cues, the Trend Counter enhances trend analysis and decision-making for traders of all levels.

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.