Jan 4, 2025

Market Flow

The Uptrick: Market Flow indicator is a custom TradingView script that combines several concepts from technical analysis into one cohesive framework. Its primary purpose is to identify significant pivots in price, gauge the markets volatility, and plot potential reversal zones to help traders spot places on the chart where the price may shift direction. It is coded in Pine Script version 6, which is TradingViews proprietary scripting language.

1 Origin and motivation

The indicator originates from a desire to capture both the broad directional flow of the market and the precise entry points around potential reversals. Many traders look for confluence among pivots, support and resistance areas, and volatility-based signals. This script attempts to provide such confluence by merging stricter pivot detection methods with an ATR-based (Average True Range) buffer. The result is a visual overlay that can help filter out noise and highlight moments when price may be moving too far from its established flow, creating potential trading opportunities.

2 Strict pivot detection

Traditional pivot detection often relies on built-in functions like ta.pivothigh and ta.pivotlow, which can work well, but sometimes they may mark a bar as a pivot if it is only marginally higher or lower than its neighbors. The Uptrick: Market Flow indicator takes a more rigorous approach to pivot identification by checking that the middle bar of the inspected window stands out as a high or low when compared to all bars in that span. In practice, this means:

If you have a selected pivot length N, the script will look at N bars before and N bars after the current bar, giving a total window of 2N plus 1 bars. The middle bar is considered a pivot high only if it is the absolute highest among all bars in that window. Similarly, it is considered a pivot low only if it is the absolute lowest among all bars in the same window. Once the condition is satisfied, the pivot value is recorded on the middle bar, effectively shifting the detection forward N bars from the present. While this creates a small lag, it also helps ensure that only significant turning points are labeled as pivots.

3 Rolling flow highs and lows

After detecting these stricter pivots, the script calculates rolling highs and lows of the most recent pivot values over a fixed window (by default, 20 bars). These rolling extremes are referred to as the flowHigh and flowLow in the script. The idea is to keep track of how the market has been evolving by continuously monitoring the highest pivot high and lowest pivot low within the past few bars. This rolling perspective acts as a dynamic form of support and resistance. The flowHigh is not just any high; it is the highest identified pivot high over a certain range. Similarly, flowLow is the lowest identified pivot low over a certain range.

4 ATR-based buffer for reversal zones

Many traders find value in using the ATR as a measure of market volatility. It basically shows how much the price of an asset tends to move, on average, over a given period. In this indicator, the ATR is measured over a user-defined length (commonly 10 bars). Then the script multiplies this ATR value by a user-defined factor (for instance, 1.5). This multiplication creates a buffer around the most recent flowHigh and flowLow.

The script adds (atrMult x atrValue) to the flowHigh to form the upper reversal zone boundary, and it subtracts the same amount from the flowLow to form the lower reversal zone boundary. These two boundaries are plotted on the chart as colored lines. The upper boundary is typically drawn above the price action, while the lower boundary is drawn below it. The premise is that when price extends beyond these levels, it may be reaching into an overextended region, making a reversal or at least a pause in the prevailing trend more likely.

5 Potential reversal signals

With the boundaries established, the script looks for places where the close of the bar crosses either above the upper boundary or below the lower boundary. If the close crosses below the lower boundary, it is considered a potential long reversal signal because the market might have sold off too aggressively. Conversely, if the close crosses above the upper boundary, it is considered a potential short reversal signal because the market may have risen too strongly.

Specifically, it uses the ta.crossover function to detect a cross above or below a particular line. The logic is that such a crossover can indicate a change in direction. In the script, when price crosses below the lower buffer, a labelup shape is plotted below the bar to indicate a potential bullish reversal. When price crosses above the upper buffer, a labeldown shape is plotted above the bar to show a potential bearish reversal. Because the pivots are stricter and the ATR buffer is more significant, these signals aim to reduce false positives that occur in choppy or low-volatility conditions.

6 Visual aids and bar coloring

Along with plotting the upper and lower reversal zone lines, the indicator also changes the bar color based on where the close lies in relation to these lines. If the close is below the lower reversal boundary, the bar color is set to a bright color (for example, green). If the close is above the upper reversal boundary, the bar color is set to a different distinct color (for example, pink or magenta). Otherwise, if the price is between these two bounds, the bar is typically shown in a neutral color, such as gray.

These color changes let traders quickly see the current state of price in relation to the reversal boundaries without having to rely solely on shapes or lines. It is a visual highlight that can help with pattern recognition when scanning multiple charts or time frames.

7 Advantages and potential usefulness

A. Stricter pivots mean that the indicator does not generate pivot labels constantly. It waits for only the most pronounced turning points, enhancing signal reliability.

B. The ATR-based reversal zones adapt to changing market conditions. When volatility is high, the buffer is wider, which helps account for larger price swings. When volatility is low, the buffer is narrower, detecting reversals in a more compressed price environment.

C. Rolling flow highs and lows provide a context for how far the most recent pivots extend. This rolling flow concept offers a dynamic range that can mimic support and resistance zones.

D. The colored bars and plotted shapes act as easy visual cues. Traders can quickly gauge whether price is near or in a potential reversal zone or if it is trading comfortably within the zones.

E. The signals can be combined with other forms of analysis. Some traders pair this approach with momentum indicators, candlestick patterns, or fundamental analysis. The result might be more confidence in trade entries and exits, thanks to the synergy between different methods.

8 Points of caution

No indicator can guarantee profitable trades, and reliance on one indicator alone is risky. Here are some considerations:

A. Because this script uses pivot-based logic, which shifts signals N bars into the past, it can lag behind fast-moving market developments. This means you may miss the earliest part of a strong move in exchange for waiting for more conclusive evidence of a pivot.

B. ATR-based thresholds can produce fewer signals in high-volatility environments where the price can swing above and below these extremes rapidly. Conversely, in low volatility markets, the signals could become more frequent but not always more reliable. Therefore, the settings must be tailored carefully to each markets behavior.

C. The 20-bar rolling window for flow highs and lows is a default value and may or may not suit every instrument or time frame. Some instruments might respond better to a shorter or longer window, so it is important to experiment with different settings.

D. While crossing above or below the upper or lower zone can signal a potential reversal, the market can also experience strong trends that keep pushing beyond these areas. A crossabove might not always result in an immediate move downward if fundamental drivers continue to push price higher, and vice versa.

9 Customization tips

Since this is a Pine Script indicator, many parameters can be adjusted:

A. The pivot length can be tuned to detect turning points of varying significance. A shorter pivot length will catch more minor pivots, while a longer pivot length will focus on more important swing highs and lows.

B. The ATR length can be adjusted to capture volatility over different periods. For swing trading, you might use a longer period to get a more stable measure of volatility. For intraday trading, a shorter period might give more reactive signals.

C. The ATR multiplier has a huge influence on when signals appear. A larger multiplier (for example, 2 or 3) will push the boundaries farther from the flow highs and lows, reducing the frequency of reversal signals but potentially increasing their strength. A smaller multiplier (for example, 1 or 1.2) will bring the boundaries closer, increasing the frequency of signals but also the risk of whipsaws.

D. The rolling window of 20 bars can be changed. Some traders prefer a shorter window like 10 bars if they are looking for more frequent redefinitions of flow highs and lows. Others might go for 30 bars or more for a broader perspective of the recent trend.

10 Practical application

Suppose you are an intraday trader looking at a 15-minute chart. You might set the pivot length to 5, ATR length to 10, and ATR multiplier to 1.5. Each time the script detects a substantial pivot, it will update the rolling flow highs and lows. Then the script will plot the reversal zones based on 1.5 times the ATR. If you see a bar close below the lower zone, that might be a clue to go long, especially if you have other confirmations like a bullish divergence on an oscillator. Conversely, if you see a close above the upper zone, you might consider a short position if market structure and other indicators align.

For swing traders on a daily chart, you might choose a pivot length of 10 and an ATR multiplier of 2 to accommodate the larger daily swings. This reduces the number of signals but can help capture more robust reversals. By monitoring the colors of the bars and the placement relative to the upper and lower zones, you can quickly see when price action is becoming overstretched from its rolling pivot-based flow, and decide if it is time to fade that move or wait for further confirmation.

11 Concluding thoughts

The Uptrick: Market Flow indicator is by design both simple and comprehensive. It simplifies broader market flow tracking using rolling pivot highs and lows, then adds a volatility-based layer to help detect when price could be setting up for a reversal. The strict pivot logic aims to reduce noise by requiring a bar to truly stand out in its lookback window before naming it a pivot. The ATR buffer then gives this method an adaptable edge, making the indicator potentially useful in a range of market environments, from low volatility consolidations to more volatile breakout scenarios.

Like all tools, however, it has limitations and should be used alongside other forms of analysis, risk management, and market awareness. The signals will not always be accurate, and strong trends can remain intact longer than expected. Moreover, the user must calibrate the parameters to suit the specific instrument and time frame, as there is no one-size-fits-all approach in trading.

In summary, the Uptrick: Market Flow indicator offers a structured way to blend pivot analysis with volatility considerations. It can provide insights into potential support and resistance levels, highlight overextensions in price, and generate reversal signals when there is strong evidence that price might turn around. Its unique aspects are the strict detection of pivots and the dynamic ATR buffer, which together can reduce some of the common pitfalls of standard pivot-based indicators. By combining these ideas into a single overlay, traders may find it easier to understand the broader market context and make more informed decisions.Pivot points and levelsSupport and ResistanceVolatility