PROTECTED SOURCE SCRIPT

The real breakout indicator CCI + Money Flow + Buy / Sell

Par TheRealHawk
Mis à jour
Components of the indicator

1. CCI (Commodity Channel Index) https://www.tradingview.com/script/YYn8sDJ7/

The CCI component measures the deviation of the price from its statistical average. It is used to identify overbought or oversold conditions and is integrated into the trend logic to determine potential trend reversals. High values may indicate overbought conditions, while low values could signify oversold situations.

Detailed

The CCI (Commodity Channel Index) used in "The Real Breakout Indicator Hawk" is an enhanced version compared to the traditional CCI, offering several advantages:

1. Weighting and Smoothing Mechanism

In this version, the CCI values are weighted and smoothed using custom parameters (c1, c2, c3), which allows for greater flexibility in adjusting the sensitivity of the CCI to market conditions. This smoothing reduces noise and provides clearer signals compared to the standard CCI, which can be prone to whipsaws in volatile markets.

2. Multi-level Calculation
The indicator uses an array-based approach to calculate multiple variations of CCI values (with p as the parameter for different levels of calculation), which is then combined to create a more robust signal. This multi-level approach allows for capturing different market cycles, unlike the traditional CCI that only uses a single period for calculation.

3. Integration with Moving Averages and Trend Detection
Unlike the original CCI, which is often used in isolation, this version integrates with the trend detection logic by combining it with moving averages and money flow. The enhanced CCI contributes to the broader trend analysis, ensuring that buy/sell signals are not just based on CCI overbought/oversold levels but also validated by moving averages and slope calculations.

4. Trend-Weighted CCI
This version adds weight to recent price action trends, making it more adaptive to current market momentum. The CCI values are influenced by recent high and low prices, adding a trend-following aspect that is missing from the original CCI, which treats all price deviations equally.

This image of EURAD shows for example that when CCI component is green a strong trend is detected which can hold for up to 10 days in this example, ideal for swing trades;

snapshot EURAUD 2H



5. Improved Overbought/Oversold Detection

The script incorporates a dynamic overbought/oversold detection zone based on the enhanced CCI. It accounts for market volatility, allowing it to adjust its thresholds (such as the 200 level) more effectively in different market environments. This makes the enhanced CCI better suited for varying market conditions compared to the fixed thresholds of the original CCI.

You can see that the red diamond signal is generated at the absolute top of the price range after which price started to reverse, the detection is based on a cross over value together with Money Flow strength

snapshot BTCUSDT 2H

6. Strong Buy/Sell Confirmation
The enhanced CCI works in tandem with other components like Money Flow and Moving Averages to confirm buy or sell signals. This cross-validation makes the indicator less reliant on CCI alone and ensures that the signals generated are stronger and less prone to false positives, which is a common issue with the standalone CCI.

The green diamond buy signal in a strong downtrend is mostly a short retrace of price before continuing down further, yo can use this as an entry signal after the bounce up into an FVG for example. However when price is at a support, meaning price is not moving down further and this occurs this could be a potential reversal signal as shown on the right side on the chart below. FVG is not respected, retested and price continues up.

snapshot BTCUSDT 2H

Summary:
In summary, the enhanced CCI in this indicator improves over the original CCI by providing better noise reduction, multi-level analysis, trend integration, and adaptability to different market conditions. These improvements lead to more reliable and actionable trading signals.

2. Money Flow (MF) https://www.tradingview.com/support/solutions/43000502348/
The Money Flow component tracks the flow of capital in and out of an asset. Positive values indicate strong buying pressure, while negative values show selling pressure. This is smoothed to avoid noise and is used to confirm strong buy or sell conditions.

The Money Flow (MF) in "The Real Breakout Indicator Hawk" measures the flow of capital into or out of an asset, helping to assess the underlying buying or selling pressure in the market.

1. Positive Money Flow (Buying Pressure)
When the MF is positive, it indicates that more money is flowing into the asset, which suggests strong buying interest. This helps confirm that a price increase or breakout to the upside is supported by demand.

2. Negative Money Flow (Selling Pressure)
A negative MF indicates that capital is leaving the asset, reflecting selling pressure. This is a sign that the market is under bearish conditions, and prices are likely to decline or break down.

3. Confirmation of Buy and Sell Signals
The MF is used to confirm buy and sell signals generated by other components of the indicator. When the MF aligns with other bullish signals, it strengthens the buy condition, and similarly, when the MF shows strong selling pressure, it reinforces a sell signal.

4. Filtering Noise
The MF is smoothed to filter out noise, ensuring that only significant movements in buying or selling pressure are considered. This helps avoid false signals and makes the MF a reliable tool for detecting true market strength.

5. Range Sensitivity
The MF operates within defined ranges, ensuring that buy or sell signals are only triggered when the flow of money is strong enough, adding precision to signal generation.

In summary, the Money Flow component is crucial for validating market direction, enhancing signal reliability, and helping traders make more informed decisions based on the underlying capital movement in the market.

3. Moving Averages (MA)
Multiple types of moving averages (SMA, EMA, HMA, etc.) are used to smooth price action and highlight the trend direction. The script supports different types of moving averages, and their slopes are calculated to assist in identifying changes in trend momentum.

The Moving Averages (MA) section of "The Real Breakout Indicator Hawk" plays a critical role in smoothing price data, identifying trends, and generating buy/sell signals. Here’s a breakdown of what it does and how you can use it effectively without diving into the script:

1. Moving Average Types
This section allows the user to choose from different types of moving averages, each with unique characteristics:
SMA (Simple Moving Average): Takes the average of closing prices over a specific period. It’s slower and better suited for detecting long-term trends.
EMA (Exponential Moving Average): Gives more weight to recent prices, making it more responsive to new price action and suitable for short-term trading.
HMA (Hull Moving Average): A smoother and faster moving average, useful for reducing lag in fast-moving markets.
LVMA (Linear Weighted Moving Average): Places the most weight on recent prices, making it even more responsive than EMA.
Alma (Arnaud Legoux Moving Average): A smoother version that reduces noise while maintaining responsiveness to recent price action.

2. Smoothing and Trend Detection
The moving average smooths out price data to remove small fluctuations and focuses on the overall trend. When prices are trading above the moving average, it suggests that the market is in an uptrend. When prices are below the moving average, it indicates a downtrend.

3. Trend Confirmation
The moving average serves as a confirmation tool. When the price crosses above the moving average, it could signal the start of a bullish trend, and when the price crosses below, it may indicate the beginning of a bearish trend.

4. Buy and Sell Signals
Buy Signal: The system detects a buy signal when:
The moving average crosses above 0, indicating a potential upward momentum.
Other indicators like Money Flow and CCI align to confirm the trend.
Sell Signal: A sell signal is triggered when:
The moving average crosses below 0, signaling a potential downtrend.
This signal is further validated by other components such as Money Flow and CCI to reduce false signals.

5. Using Moving Averages in Trading
Crossover Strategy: One of the simplest ways to use moving averages is by employing a crossover strategy. For instance:

When the shorter-term moving average (e.g., 20-period) crosses above a longer-term moving average (e.g., 50-period), this is a bullish crossover, indicating a buy signal.
Conversely, when the shorter-term moving average crosses below the longer-term moving average, this is a bearish crossover, indicating a sell signal.
Trend Following: If you’re trading with the trend, you can use a moving average to stay in the trade as long as the price remains above (for long positions) or below (for short positions) the moving average.

Support and Resistance: Moving averages can also act as dynamic support or resistance levels. For example, in an uptrend, the CCI might bounce off the moving average, offering a good entry point for a long position. In a downtrend, the moving average could act as resistance where prices may reverse, offering a shorting opportunity.

To use the MA section effectively:

Choose the right type of moving average based on your trading style (e.g., use EMA for faster response or SMA for long-term trends).
Watch for crossovers as buy/sell signals, especially in combination with other indicators.
Follow the trend by observing whether the price is above or below the moving average.
Use the moving average as a dynamic support/resistance level to find optimal entry/exit points.
This approach makes the moving average a versatile tool for identifying trends, refining entry and exit points, and confirming overall market direction.

an example when MA crosses below 0, keep in mind that when it it starts curving up and turning green there is a reversal brewing, this could take time...

snapshot BTCUSDT 2H

4. Buy Signals
Buy signals are generated when the moving average crosses up, and the Money Flow and other trend-based conditions are met, including CCI levels confirming the strength of the breakout. Additionally, slope calculations and other momentum indicators provide extra confirmation for entries.

5. Sell Signals
Sell signals occur when the moving average crosses down, combined with negative Money Flow, confirming downward pressure. Other trend-based conditions, including the CCI, must also align to validate the signal, and slope calculations ensure that momentum is on the sell side.

6. Slope and Trend Detection
The script includes calculations for the slope of price action over a lookback period to measure trend strength and direction. The slope is normalized to help identify when the market is gaining or losing momentum. This slope is used in conjunction with the moving averages and Money Flow to give more accurate trend signals.

The Slope and Trend Detection component in "The Real Breakout Indicator Hawk" is designed to measure the direction and strength of the market’s trend by calculating the slope of the price action over a specific period. This helps to identify whether the market is gaining or losing momentum, and it is a key element in refining buy/sell signals.

Here’s how the Slope and Trend Detection works and how you can use it effectively without diving into the script:

1. Slope Calculation
Slope is essentially the rate of change of the moving average (or price) over a given number of bars. It measures how steeply the price is moving up or down.
The script calculates the slope by measuring the difference between the moving average over a defined number of bars (e.g., 12 bars in this case). A larger slope indicates a stronger trend, while a smaller slope suggests a weaker or consolidating trend.

2. Normalized Slope
The slope is normalized, meaning it is adjusted to fall within a range that makes it easier to compare across different time frames and markets. This normalization helps to gauge whether the slope is strong or weak relative to historical data.
Positive slopes (above 0) indicate an uptrend or rising price momentum, while negative slopes (below 0) indicate a downtrend or falling price momentum.

3. Trend Detection
The slope of the moving average is used to detect the current trend:
If the slope is positive, the market is in an uptrend.
If the slope is negative, the market is in a downtrend.
The stronger the slope (the steeper it is), the stronger the trend. A small slope indicates a weak trend or consolidation.

4. Slope Thresholds
The system uses thresholds to determine the significance of the slope. These thresholds are set as upper and lower bounds:
Upper Threshold: If the slope exceeds this threshold, the trend is considered strong, and it could trigger a buy signal.
Lower Threshold: If the slope falls below this threshold (into the negative range), it indicates a strong downtrend, and it could trigger a sell signal.
These thresholds help filter out weak or false signals that occur in sideways or low-momentum markets.

5. Positive and Negative Slope Arrays
The system keeps track of both positive and negative slopes over a defined lookback period (e.g., 500 bars). By storing these values, it creates a historical context that helps to assess the current slope in relation to past price movements.
It calculates the standard deviation and the average of these slopes to dynamically adjust the thresholds for each market condition, making the trend detection more adaptive to different types of assets or market phases.

6. Using Slope and Trend Detection in Trading
Buy Signal with Positive Slope: When the slope is positive and exceeds a certain threshold, it confirms that the market is in a strong uptrend. This can be used as a signal to enter a long position or add to existing long trades.

Sell Signal with Negative Slope: When the slope turns negative and falls below the lower threshold, it signals a strong downtrend, indicating a potential short-selling opportunity or the time to exit long positions.

Avoiding Flat Markets: If the slope remains close to zero (neither strongly positive nor negative), it suggests a lack of clear trend or a consolidating market. In these conditions, it might be better to avoid taking new trades or use additional filters to confirm signals.

7. Slope-Based Trend Strength Indicator
You can also use the slope as a measure of trend strength:
Strong Trend: When the slope is steep (either positive or negative), it indicates strong momentum, and you can be more confident in holding a trade in that direction.
Weak Trend or Consolidation: When the slope is flat, it indicates weak price momentum, which may signal a period of consolidation or indecision in the market.

8. Visual Representation
The slope is often visually represented as a gradient or line that fluctuates around a central point (usually zero). Positive values are shown in one color (e.g., green for an uptrend), while negative values are shown in another color (e.g., red for a downtrend). This allows traders to quickly identify the current trend direction and its strength.
Summary:
To use Slope and Trend Detection effectively:

Monitor the slope to determine the trend direction (positive = uptrend, negative = downtrend).
Look for thresholds to identify strong trends. For instance, a steep positive slope signals a strong uptrend, while a steep negative slope signals a strong downtrend.
Use slope changes to confirm buy/sell signals. For example, if you receive a buy signal and the slope is positive and increasing, it confirms that momentum is behind the trade.
Avoid low-slope periods when the slope is close to zero, indicating a lack of trend or sideways market conditions.
This approach helps traders stay on the right side of the trend while avoiding periods of low momentum, enhancing the accuracy of trade signals.

7. Banker Fund Flow Trend
Splirus SuperTrend

This component identifies potential large institutional moves by tracking specific patterns in price and volume data. When the institutional or "banker" entry or exit conditions are met, it highlights these moments with candles and generates alerts.

The Banker Fund Flow Trend in "The Real Breakout Indicator Hawk" helps detect the flow of institutional (or "smart money") into and out of the market by tracking price trends and large player activity. It uses red and yellow candles to signal when institutional money is influencing the market.

Key Points:
Yellow Candles (Banker Entry):

A yellow candle is plotted when institutional money starts flowing into the market.
This signals a potential buy opportunity, as large market players are likely pushing prices upward.
Red Candles (Banker Exit):

A red candle appears when institutional money starts exiting the market.
This is a signal to consider selling or exiting long positions, as institutional selling could drive prices lower.

Usage:
Yellow candles: Use these as signals to enter long trades or add to existing positions, confirming upward momentum driven by institutional buyers.

Red candles: Treat these as signals to exit long trades or consider short positions, as institutional selling may lead to further downside.

snapshot BTCUSDT 2H

The yellow and red candles provide clear, actionable signals for aligning trades with institutional flows, ensuring you’re following the "smart money."

8. Dynamic Buy/Sell Calculations
A dynamic component is designed to refine the buy and sell signals further based on additional conditions like price patterns, volatility, and Money Flow. This ensures that signals are more responsive to changing market conditions.

The Dynamic Buy/Sell Calculations in "The Real Breakout Indicator Hawk" are designed to refine entry and exit points for trades by using additional conditions beyond simple crossovers. These calculations adapt to the current market conditions, making them more responsive to changes in volatility, trend strength, and momentum.

Key Features:
Dynamic Buy Calculation:

The indicator generates a buy signal when multiple conditions align. These conditions include the money flow (MF) being within a favorable range, the moving average (MA) confirming upward momentum, and the CCI and other trend components indicating strength.
This makes the buy signal more reliable, as it considers multiple aspects of market behavior (price, momentum, and money flow) to avoid false entries.

Dynamic Sell Calculation:
Similarly, the sell signal is triggered when the dynamic conditions indicate downward momentum.

This includes:
The moving average crossing down.
Negative money flow, suggesting selling pressure.
Other trend signals confirming a bearish move.
The dynamic nature of these conditions ensures that sell signals are only generated when there’s a high probability of continued downside movement.

Adaptive to Market Conditions:
The dynamic nature of these calculations means that the buy/sell signals adapt to market changes, like volatility spikes or sudden trend reversals. Instead of relying on static conditions, the system adjusts to current price movements and volatility.
Avoiding Noise:

By adding multiple filters like MF thresholds, slope, and moving averages, the dynamic calculations help reduce false signals that occur in noisy, sideways markets. This helps traders avoid entering trades during periods of low momentum or unclear trends.

How to Use:
Buy Signals: Use these signals to enter long trades when the dynamic conditions align, confirming that upward momentum is strong and backed by institutional flows.
snapshot BTCUSDT 2H

Aqua marker/cross signals (price manipulation/continuation)

snapshot BTCUSDT 2H

Sell Signals: Use the sell signals to exit long positions or enter short trades when the market shows signs of bearish momentum, confirmed by multiple conditions like MA crossovers and negative money flow.
snapshot BTCUSDT 2H

In summary, the Dynamic Buy/Sell Calculations provide a more sophisticated approach to generating trade signals by combining various trend and momentum indicators, helping traders make more informed decisions in different market conditions.

This part of the code is identifying two key trading signals: moments to buy and moments to sell based on the behavior of a calculated trend line.

Buy Condition:

The system looks for a situation where the trend has been moving downward but has started to reverse upward. Specifically, it checks if the trend was declining a little while ago, then stopped falling, and is now starting to rise. If these conditions are met and the trend is still below a certain level, the system considers this a possible time to buy.
Sell Condition:

The opposite happens for selling. The system monitors for a situation where the trend has been moving upward but starts to turn downward. It checks if the trend was rising, leveled off, and now seems to be starting to fall. If these conditions are met and the trend is above a certain level, this could indicate a good time to sell.
Visual Markers:

To help the user easily see these signals on a chart, the system places symbols at specific points. A marker appears on the chart where the conditions for buying or selling are met, allowing the trader to quickly spot potential entry or exit points in the market.
In summary, this logic is designed to detect possible changes in trend direction and signal appropriate times to consider buying or selling, with clear visual markers on the chart for quick identification.

9. Alerts for Buy and Sell
The indicator provides built-in alert conditions for both buy and sell signals. When these conditions are met, the system generates alerts, making it suitable for automated monitoring.
Each of these components works together to detect potential breakout opportunities, trend continuations, and reversals, making the indicator suitable for both short-term and long-term trading strategies.



Notes de version
Updated chart
Notes de version
After restructuring the code I have found many opportunities to improve.

Visuals
  • Added diverse buy/sell signals, I will explain below each and their calculation.
  • Added options to enable or disable all signals.
  • Added gradient moving average based on it slope for visual enhancement.
  • Added trigger signals, these signals are to detect price manipulations early.
  • Added squeeze detection, which signals that a large price move is around the corner.


Internal
  • Improved the internal helper calculations for slope and signaling.
  • Removed redundant code


buy/sell signals

  1. Red / Green triangle


The green and red triangles in your indicator provide visual cues for potential buy and sell signals, and they are based on a combination of Heikin Ashi wave trend candles, and price action, and market momentum. Here's a more detailed breakdown:

Green Triangle (Buy Signal)
snapshot BTCUSDT1H
Purpose: Indicates a potential buying opportunity.

When it appears:
Internal Heikin Ashi candles are showing swift positive price movement, reflecting continuation of upward trend.

Interpretation: A green triangle signals that the market might be continuing moving upward and could present a good entry point for traders.

Red Triangle (Sell Signal)
snapshot BTCUSDT1H
Purpose: Indicates a potential selling opportunity.
When it appears:
The price has likely peaked in the pullback and started to continue in the direction of price structure, reflecting a shift in momentum.

Interpretation: A red triangle suggests exiting a long position (selling) or possibly entering a short position. It signals that the market may be turning downward.

Blue buy circle (Confirmed Buy Signal) (Improved previously Green buy circles)

snapshot BTCUSDT1H
Purpose: To indicate a confirmed buying opportunity based on specific market conditions.

Conditions: The market is showing a combination of bullish indicators, suggesting a strong potential for price increase. This signal is more robust compared to other signals as it requires confirmation from multiple indicators aligning in favor of a buy.

Interpretation: The blue circle appears when the market conditions suggest a highly favorable time to enter a long position. This signal is designed to help traders identify when the market is not just showing temporary strength but is likely entering a more sustained upward trend. It is a strong indication to buy and take advantage of the bullish momentum.
In summary, the blue buy circle signals a confirmed and stronger buy condition, offering a clear cue to traders that the market is primed for an upward move based on multiple confirming factors.

Fuchsia Sell circle (Confirmed Sell Signal) (Improved previously red circles)

snapshot BTCUSDT1H

The fuchsia sell signal in your indicator represents a condition where the market is indicating a potential sell opportunity. Here’s how it works:


Purpose: To signal a potential selling opportunity, suggesting that the market may be turning bearish.

Conditions: The fuchsia color is triggered when specific bearish conditions are met:
The market shows signs of weakening upward momentum.
Certain indicators, such as moving averages, trendlines, or oscillators, confirm a shift towards a downtrend or loss of bullish strength.
This signal typically appears when the price starts to reverse from a recent high or when bearish momentum is growing.

Interpretation: The fuchsia sell signal alerts traders that it may be a good time to exit a long position or prepare for a potential price drop. It suggests that the market has entered or is about to enter a bearish phase, signaling a reversal of the prior bullish trend. Keep in mind when Moving Average is neon green these are small retracements

In summary, the fuchsia sell signal is a visual cue to exit long positions or consider selling, as the market conditions are shifting toward a downturn based on key technical indicators.


Cross (Buy/Sell Signal with CCI and High Volume) (New)
snapshotBTCUSDT1H

Purpose: To signal a potential buy or sell opportunity based on the crossing of the Commodity Channel Index (CCI) over or under the moving average (MA), with the added confirmation of high volume.

High Volume Condition: The signal is only confirmed when the volume is higher than a certain threshold, which validates the strength of the move. The increased volume indicates strong market activity, reinforcing the reliability of the signal.

Interpretation:
Buy Cross: When the CCI crosses above the MA with high volume, it indicates that bullish momentum is building, and the market could be starting a strong upward trend.

Sell Cross: When the CCI crosses below the MA with high volume, it indicates bearish pressure is increasing, suggesting the market could be heading lower.

The black diamonds in your indicator represent signals related to potential price manipulation in the market. These signals are designed to help traders identify moments when the market may be experiencing unnatural or exaggerated price movements. Here’s a detailed explanation:

Black Diamond (Price Manipulation Signal) (New)

Purpose: To signal potential buy or sell opportunities that may be influenced by price manipulation or sudden market shifts. These black diamonds alert traders to possible moments when large market players or unusual trading activity might be affecting the price.
Conditions:

Price Manipulation Detection: The black diamonds are triggered by specific conditions, including a combination of indicators such as sudden price changes, volume spikes, and technical signals that hint at potential market manipulation. These conditions point to unnatural price movements, where large orders or manipulative trading practices could be influencing the market.

Squeeze (SQZ) Signal Logic (New)

Added SQZ logic based on Bollinger Band width (bandwidth), which checks for squeeze conditions before expansion.
Plots filled background in cyan color when bandwidth is below a threshold, and an alert is triggered for "Bandwidth Alert."

You would be looking for expansions after the squeeze and follow the price, any signal printed at that moment may be inaccurate due to manipulation
snapshotBTCUSDT1H

Banker Fund Flow Signals (improved)
Improved by adding a filter for volume and more precise entry/exit conditions based on the MA and fund trend relationship.
Commodity Channel Index (CCI)Price Volume Trend (PVT)Trend Analysis
TheRealHawk

Script protégé

Ce script est publié en code source fermé et vous pouvez l'utiliser librement. Vous pouvez le préférer pour l'utiliser sur un graphique. Vous ne pouvez pas visualiser ou modifier son code source.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité