OPEN-SOURCE SCRIPT

Trend Counter [BigBeluga]

12 425
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.
Snapshot

⦿ Trend Signals:
Provides visual cues for trend changes based on the counter crossing predefined levels.
Snapshot

⦿ Potential Tops:
Identifies potential market tops using a specified length and highlights these levels.
Snapshot

⦿ Additional Features:
Displays Trend Counter value with arrows to indicate the direction of the trend movement.
Displays average trend count and level for reference.
Snapshot

⦿ 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.

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.