OPEN-SOURCE SCRIPT

Bullish/Bearish Reversal Bars Indicator [Skyrexio]

Introduction
Bullish/Bearish Reversal Bars Indicator [Skyrexio] leverages the combination of candlestick reversal bar pattern and the Williams Alligator indicator to help traders in understanding where there is a high probability of market reversal or correction. Indicator works for both bearish and bullish cases. It visualizes the bearish and bullish reversal bars with red and green dots and also plots the Alligator's lips to make it more convenient for traders to understand if price is above or below lips line (more information in "Methodology and it's justification" paragraph).

Features
  • Market Facilitation Index(MFI) filter: with the specified parameter in settings user can choose to filter bullish and bearish reversal bars which passed the MFI condition.
  • Awesome Oscillator(AO) filter: with the specified parameter in settings user can choose to filter bullish and bearish reversal bars which passed the AO condition.
  • Alerts: user can set up the alert and have notifications when bullish/bearish reversal bar has been printed.


Methodology and it's justification
In the script’s methodology, we apply the concepts of bullish and bearish reversal bars introduced by Bill Williams in his book Trading Chaos. So, what exactly is a bullish or bearish reversal bar? At its core, it’s a candlestick pattern. A bullish reversal bar is a bar that closes in its upper half, while a bearish reversal bar closes in its lower half.

Why is this type of bar significant? Let’s look at the bullish reversal bar as an example. When the price is trending upward, forming higher highs with each candle, and we suddenly see a bullish bar that makes a new high but ultimately closes in its lower half, it signals a shift in control. Bears have taken control toward the end of that candle's period, pushing the price back down. This can be interpreted as a sign of trend weakness and a potential reversal (or at least a correction).

An additional key point is that a reversal bar often indicates a possible end to the trend. Therefore, for a reversal bar to be valid, several preceding candles should show lower highs (for bullish bars) or higher lows (for bearish bars), reinforcing the likelihood of a trend change.

The second step on methodology is the location of the bar related to Williams Alligator. The Williams Alligator Indicator, developed by Bill Williams, is a technical analysis tool that helps traders identify trends and potential turning points in the market. It consists of three lines, often called the jaw, teeth, and lips of the alligator, each representing different moving averages:

  • Jaw (Blue Line): A slower moving average, typically a 13-period smoothed moving average shifted 8 bars into the future.
  • Teeth (Red Line): A medium moving average, typically an 8-period smoothed moving average shifted 5 bars into the future.
  • Lips (Green Line): A faster moving average, usually a 5-period smoothed moving average shifted 3 bars into the future.


When the three lines are spread out and moving in the same direction, it suggests a strong trend (the "alligator" is "awake and feeding"). When they intertwine, the indicator suggests that the market is moving sideways, or in a range, signaling a lack of clear trend (the "alligator" is "sleeping"). Traders use the Alligator Indicator to enter trades in trending markets and avoid trades in choppy, non-trending markets.

If bullish reversal bar's high is not below and bearish reversal bar's low is not above all three Alligator's lines (jaw, lips, teeth) they cannot be interpreted as these types of bars. It can be explained as following: if we are waiting for the bullish reversal bar it shall be reversal from downtrend. If price is not below all three lines it can't be interpret as the downtrend according to this method. The opposite is true for the bearish reversal bar.

All described above are obligatory conditions for reversal bar, now let's discuss two not obligatory conditions. The first one is Market Facilitation Index (MFI) restriction. Let's briefly look what is MFI. The Market Facilitation Index (MFI) is a technical indicator that measures the price movement per unit of volume, helping traders gauge the efficiency of price movement in relation to trading volume. Here's how you can calculate it:

MFI = (High−Low)/Volume

MFI can be used in combination with volume, so we can divide 4 states. Bill Williams introduced these to help traders interpret the interaction between volume and price movement. Here’s a quick summary:

  • Green Window (Increased MFI & Increased Volume): Indicates strong momentum with both price and volume increasing. Often a sign of trend continuation, as both buying and selling interest are rising.
  • Fake Window (Increased MFI & Decreased Volume): Shows that price is moving but with lower volume, suggesting weak support for the trend. This can signal a potential end of the current trend.
  • Squat Window (Decreased MFI & Increased Volume): Shows high volume but little price movement, indicating a tug-of-war between buyers and sellers. This often precedes a breakout as the pressure builds.
  • Fade Window (Decreased MFI & Decreased Volume): Indicates a lack of interest from both buyers and sellers, leading to lower momentum. This typically happens in range-bound markets and may signal consolidation before a new move.


For our purposes we are interested in squat bars. This is the sign that volume cannot move the price easily. This type of bar increases the probability of trend reversal. In this indicator we added to enable the MFI filter of reversal bars. If potential reversal bar or two preceding bars have squat state this bar can be interpret as a reversal one.

The second additional filter is Awesome Oscillator. The Awesome Oscillator (AO), developed by Bill Williams, is a momentum indicator that measures market momentum by comparing recent price action to a longer historical context. It helps traders identify potential trend reversals and the strength of trends. Formula:

AO = SMA5(Median Price) − SMA34(Median Price)

where:
Median Price = (High + Low) / 2
SMA5 = 5-period Simple Moving Average of the Median Price
SMA 34 = 34-period Simple Moving Average of the Median Price

If AO is decreasing momentum is bearish, if increasing - bullish. According to Bill Williams approach reversal bars are the potential trades against the trend. As a result we added second filter for bullish reversal bars AO shall be decreasing, for bearish increasing.

How to use indicator
  1. Apply it to desired chart and time frame. It works on every time frame.
  2. Setup the filters with the "Enable MFI" and "Enable AO" checkboxes in the settings. By default they are turned on.
  3. Analyze the price action. Indicator plotted the white line, this is the lips of an Alligator. It will help you to understand how price is moving in comparison to lips line. Indicator will print the green dot and text "BULL" below it current bar is bullish reversal. It will print the red dot and text "BEAR" above it if current bar is interpreted by algorithm as a bearish reversal.
  4. Set up the alerts if it's needed. Indicator has two custom alerts called "Bullish reversal bar has been printed" and "Bearish reversal bar has been printed"


Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test indicators before live implementation.
Alligator Indicatorawesome_oscillatorbearishbarbullishbarCandlestick analysisMarket Facilitation IndexMFI

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?


Access private PineScript strategies and turn alerts into orders with easy-to-set up bots

Trade smarter:
skyrexio.com

🔥 Win share of 20,000 USDT in Skyrexio x Bybit competition
bit.ly/skyrexiobybit
Мои профили:

Отказ от ответственности