OPEN-SOURCE SCRIPT

Smart Money Oscillator [ChartPrime]

The "Smart Money Oscillator [ChartPrime]" is a premium and discount zone oscillator with BOS and CHoCH built in for further analysis of price action. This indicator works by first determining the the premium and discount zones by using pivot points and high/lows. The top of this oscillator represents the current premium zone while the bottom half of this oscillator represents the discount zone. This oscillator functionally works like a stochastic oscillator with more sophisticated upper and lower bounds generated using smart money concept theories. We have included a moving average to allow the user to visualize the currant momentum in the oscillator. Another key feature we have included lagging divergences to help traders visualize potential reversal conditions.

Understanding the concepts of Premium and Discount zones, as well as Break of Structure (BoS) and Change of Character (CHoCH), is crucial for traders using the Smart Money Oscillator. These concepts are rooted in market structure analysis, which involves studying price levels and movements.


snapshot

Premium Zone is where the price is considered to be relatively high or 'overbought'. In this zone, prices have risen significantly and may indicate that the asset is becoming overvalued, potentially leading to a reversal or slowdown in the upward trend.

The Discount Zone represents a 'discount' or 'oversold' area. Here, prices have fallen substantially, suggesting that the asset might be undervalued. This could be an indicator of a potential upward reversal or a pause in the downward trend.

Break of Structure (BoS) is about the continuation of a trend. In a bullish trend, a BoS is identified by the break of a recent higher high. In a bearish trend, it's the break of a recent Lower Low. BoS indicates that the trend is strong and likely to continue in its current direction. It's a sign of strength in the prevailing trend, whether up or down.

Change of Character (CHoCH) is an indication of a potential end to a trend. It occurs when there's a significant change in the market's behavior, contradicting the current trend. For example, in an uptrend characterized by higher highs and higher lows, a CHoCH may occur if a new high is formed but then is followed by an impulsive move downwards. This suggests that the bullish trend may be weakening and a bearish reversal could be imminent. CHoCH is essentially a sign of trend exhaustion and potential reversal.

With each consecutive BoS, the signal line of the oscillator will deepen in color. This allows you to visually see the strength of the current trend. The maximum strength of the trend is found by keeping track of the maximum number of consecutive BoS's within a window of 10. This calculation excludes periods without any BoS's to allow for a more stable max.

Quick Update is a feature that implements a more aggressive algorithm to update the highs and lows. Instead of updating the pivot points exclusively to update the range levels, it will attempt to use the current historical highs/lows to update the bounds. This results in a more responsive range at the cost of stability. There are pros and cons for both settings. With Quick Update disabled, the indicator will allow for strong reversals to register without the indicator maxing out. With Quick Update enabled, the indicator will show shorter term extremes with the risk of the signal being pinned to the extremities during strong trends or large movements. With Quick Update disabled, the oscillator prioritizes stability, using a more historical perspective to set its bounds. When Quick Update is enabled, the oscillator becomes more responsive, adjusting its bounds rapidly to reflect the latest market movements.

The Scale Offset feature allows the indicator to break the boundaries of the oscillator. This can be useful when the market is breaking highs or lows allowing the user to identify extremities in price. With Scale Offset disabled the oscillator will always remain inside of the boundaries because the extremities will be updated instantly. When this feature is enabled it will update the boundaries one step behind instead of updating it instantly. This allows the user to more easily see overbought and oversold conditions at the cost of incurring a single bar lag to the boundaries. Generally this is a good idea as this behavior makes the oscillator more sensitive to recent price spikes or drops, reflecting sudden market movements more accurately. It accentuates the extremities of the market conditions, potentially offering a more aggressive analysis. The main trade-off with the Scale Offset feature is between sensitivity and potential overreaction. It offers a more immediate and exaggerated reflection of market conditions but might also lead to misinterpretations in certain scenarios, especially in highly volatile markets.

Divergence is used to predict potential trend reversals. It occurs when the price of an asset and the reading of an oscillator move in opposite directions. This discrepancy can signal a weakening of the current trend and possibly indicate a potential reversal.

Divergence doesn't always lead to a trend reversal, but it's a warning sign that the current trend might be weakening. Divergence can sometimes give false signals, particularly in strongly trending markets where the oscillator may remain in overbought or oversold conditions for extended periods. The lagging nature of using pivot points to calculate divergences means that all divergences are limited by the pivot look forward input. The upside of using a longer look forward is that the divergences will be more accurate. The obvious con here is that it will be more delayed and might be useless by the time it appears. Its recommended to use the built in divergences as a way to learn how these are formed so you can make your own in real time.

By default, the oscillator uses a smoothing of 3 to allow for a more price like behavior while still being rather smooth compared to raw price data. Conversely, you can increase this value to make this indicator behave smoother. Something to keep in mind is that the amount of delay from real time is equal to half of the smoothing period.

We have included a verity of alerts in this indicator. Here is a list of all of the available alerts: Bullish BOS, Bearish BOS, Bullish CHoCH, Bearish CHoCH, Bullish Divergence, Hidden Bullish Divergence, Bearish Divergence, Hidden Bearish Divergence, Cross Over Average, Cross Under Average.

Below are all of the inputs and their tooltips to get you started:

Settings:
  • Smoothing: Specifies the degree of smoothing applied to the oscillator. Higher values result in smoother but potentially less responsive signals.
  • Average Length: Sets the length of the moving average applied to the oscillator, affecting its sensitivity and smoothness.
  • Pivot Length: Specifies the forward-looking length for pivot points, affecting how the oscillator anticipates future price movements. This directly impacts the delay in finding a pivot.
  • Max Length: Sets the maximum length to consider for calculating the highest values in the oscillator.
  • Min Length: Defines the minimum length for calculating the lowest values in the oscillator.
  • Quick Update: Activates a faster update mode for the oscillator's extremities, which may result in less stable range boundaries.
  • Scale Offset: When enabled, delays updating minimum and maximum values to enhance signal directionality, allowing the signal to occasionally exceed normal bounds.
  • Candle Color: Enables coloring of candles based on the current directional signal of the oscillator.


Labels:
  • Enable BOS/CHoCH Labels: Activates the display of BOS (Break of Structure) and CHoCH (Change of Character) labels on the chart.
  • Visual Padding: Turns on additional visual padding at the top and bottom of the chart to accommodate labels. Determines the amount of visual padding added to the chart for label display.


Divergence:
  • Divergence Pivot: Defines the number of bars to the right of the pivot in divergence calculations, influencing the oscillator's responsiveness.
  • Divergence Pivot Forward: Directly impacts latency. Longer periods results in more accurate results at the sacrifice of delay.
  • Upper Range: Sets the upper range limit for divergence calculations, influencing the oscillator's sensitivity to larger trends.
  • Lower Range: Determines the lower range limit for divergence calculations, affecting the oscillator's sensitivity to shorter trends.
  • Symbol: Allows selection of the label style for divergence indicators, with options for text or symbolic representation.
  • Regular Bullish: Activates the detection and marking of regular bullish divergences in the oscillator.
  • Hidden Bullish: Enables the identification and display of hidden bullish divergences.
  • Regular Bearish: Turns on the feature to detect and highlight regular bearish divergences.
  • Hidden Bearish: Activates the functionality for detecting and displaying hidden bearish divergences.


Color:
  • Bullish: Determines the minimum/maximum color gradient for bullish signals, impacting the chart's visual appearance.
  • Bearish: Defines the minimum/maximum color gradient for bearish signals, affecting their visual representation.
  • Average: Specifies the color for the average line of the oscillator, enhancing chart readability.
  • CHoCH: Sets the color for bullish/bearish CHoCH (Change of Character) signals.
  • Premium/Discount: Determines the color for the premium/discount zone in the oscillator's visual representation.
  • Text Color: Sets the color for the text in BoS/CHoCH labels.
  • Regular Bullish: Defines the color used to represent regular bullish divergences.
  • Hidden Bullish: Specifies the color for hidden bullish divergences.
  • Regular Bearish: Determines the color for hidden bearish divergences.
  • Divergence Text Color: Specifies the color for the text in divergence labels.

Bands and ChannelsOscillators

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer