N Reversal Detector

N Reversal Detector

The N Reversal Detector is a technical indicator developed to detect market trend reversal points. This indicator combines multiple approaches to identify both trends and potential market reversals, integrating the use of moving averages, the Supertrend indicator, and Donchian Channels. Its primary goal is to alert traders of potential changes in market direction, both in bullish and bearish trends.

Unlike other indicators that focus on a single method to identify market direction, the N Reversal Detector uses a multi-filter system. Depending on the selected configuration, the indicator can identify aligned or opposing trends, providing clear signals for traders looking for entries based on trend reversals.

In addition to filtering trends, the indicator also implements a reversal pattern detection system for both bullish and bearish reversals, making it highly versatile for use in multiple trading styles, whether on daily, intraday, or long-term charts.

Key Features:

  • Uses multiple trend filters (moving averages, Supertrend, and Donchian Channels).
  • Detects three-bar reversal patterns.
  • Provides clear visual signals for trading decisions.
  • Highly configurable, allowing adjustments according to the trader’s strategy.

2. Indicator Components

The N Reversal Detector consists of several key elements that work together to identify trends and potential reversal points. Below are the main components of the indicator:

2.1 Trend Filters

The indicator offers three types of trend filters that can be selected through the trendType variable. These filters allow you to adjust how the indicator detects trends and how it interprets reversal signals:

  • Moving Average (MA Trend): This filter uses two moving averages of different lengths to identify the trend. When the fast moving average (shorter period) is above the slow moving average (longer period), it is considered a bullish trend, and vice versa for a bearish trend.
    • Variables:
      • maFlength (default 50): Length of the fast moving average.
      • maSLength (default 200): Length of the slow moving average.
      • maType (default 7): Type of moving average (e.g., simple, exponential, etc.).
  • Supertrend (ST Trend): Uses the Supertrend indicator, which is based on the Average True Range (ATR) to determine whether the market is in a bullish or bearish trend. The Supertrend bands adjust according to volatility, making it particularly useful in volatile markets.
    • Variables:
      • atrPeriod (default 10): Period for the ATR.
      • factor (default 3): Multiplier for the ATR to determine trend bands.
  • Donchian Channels (Donchian Trend): This filter uses the highs and lows over a specified period to identify the trend. If prices are hitting new highs or lows, the trend is detected in that direction.
    • Variables:
      • length (default 13): Period for the Donchian Channels.

2.2 Reversal Pattern Detection

The indicator includes a reversal pattern detection module based on the last three bars of the chart. This module identifies conditions where the price has reached an extreme (high or low) and has started to reverse:

  • Bullish Reversal: A bullish reversal pattern is detected when the price has consistently dropped over several bars and begins to show signs of recovery. To confirm the bullish signal, the indicator also checks whether the overall trend supports the reversal.
    • Variables:
      • numBars (default 7): Number of bars used to detect the pattern.
      • minBars (default 50): Minimum percentage of bearish bars required to validate the reversal.
  • Bearish Reversal: Similar to the bullish reversal, this pattern identifies situations where the price has steadily risen and begins to retrace. It also requires that the overall trend is bearish to confirm the signal.
    • Variables:
      • numBars and minBars are also used for bearish reversals.

2.3 Trend Filter

The TrendFilter parameter is used to further refine the signals generated by the indicator. This filter allows the user to choose whether reversal signals should align with the overall trend or if they can be contrary:

  • TrendFilter enabled (True): Reversal signals are only generated when they align with the prevailing trend (bullish for bullish signals and bearish for bearish signals).
  • TrendFilter disabled (False): Reversal signals are allowed even if they are contrary to the main trend, which may generate more signals but also increases the risk of false alarms.

3. Indicator Configuration

The N Reversal Detector offers a range of adjustable parameters that allow users to tailor the indicator’s behavior to their preferences and trading strategies. Below are the main configuration variables and how they affect the indicator’s performance.

3.1 Input Variables

  • trendType (default 0): Defines the type of trend filter to use.
    • 0: No trend filter. The indicator will detect reversal signals without considering the overall market trend.
    • 1: Filter based on moving averages (MA).
    • 2: Filter based on the Supertrend indicator (ST).
    • 3: Filter based on Donchian Channels.
  • TrendFilter (default 1): Controls whether signals should align with the detected trend.
    • 1 (True): Only signals aligned with the trend will be allowed.
    • 0 (False): Reversal signals are allowed even if they go against the main trend.
  • Moving Averages:
    • maFlength (default 50): Defines the period for the fast moving average.
    • maSLength (default 200): Defines the period for the slow moving average.
    • maType (default 7): Determines the type of moving average (simple, exponential, etc.).
  • Supertrend:
    • atrPeriod (default 10): Number of periods used to calculate the Average True Range (ATR), which is key for determining the Supertrend bands.
    • factor (default 3): Multiplier applied to the ATR to set the Supertrend bands.
  • Donchian Channels:
    • length (default 13): Number of bars used to calculate the highs and lows for the Donchian channel.
  • Reversal Pattern Detection:
    • numBars (default 7): Number of bars analyzed to detect a bullish or bearish reversal. A higher number of bars provides more conservative signals.
    • minBars (default 50): Defines the minimum percentage of bars that must be bullish or bearish for the reversal pattern to be considered valid.

3.2 Parameter Adjustments

The N Reversal Detector is highly customizable, meaning traders can adjust the parameters according to market conditions or their risk preferences. Below are some common adjustment examples:

  • Moving Average Trend: If the trader prefers to use moving averages to define the trend, they can select trendType = 1 and adjust maFlength and maSLength according to the timeframe they are analyzing. For intraday charts, it may be more effective to reduce the moving averages periods (e.g., maFlength = 20 and maSLength = 50).
  • Supertrend for Volatile Markets: In highly volatile markets, the Supertrend can provide more dynamic signals. In this case, adjusting atrPeriod = 14 and factor = 2 can help produce tighter bands that react to price fluctuations.
  • Donchian Channels for Range-Bound Markets: If the market is in a sideways range, using the Donchian Channels (trendType = 3) may be more appropriate. Adjusting the length to 20 or more can help capture significant breakout movements.

3.3 Usage Considerations

  • No Trend Filter: For traders who prefer to trade against the trend or look for quick reversals, they can disable the trend filters by selecting trendType = 0 and TrendFilter = 0. This will generate more signals but may increase the number of false signals.
  • Trend Alignment: If the priority is to trade in the direction of the prevailing trend, it is advisable to keep TrendFilter = 1. This will reduce the number of signals generated but increase the likelihood that they are reliable.

4. How the Indicator Works

The N Reversal Detector works by combining different technical analysis techniques to detect both trends and potential reversals. In this section, we will break down the code to explain how buy and sell signals are generated and how the different components of the indicator interact.

4.1 Trend Filters

4.1.1 Moving Average

When trendType = 1 is selected, the indicator uses two moving averages to identify the trend:

  • Fast moving average (maFast): Calculated with the maFlength parameter, which defines the number of periods.
  • Slow moving average (maSlow): Calculated with the maSLength parameter.

If the fast moving average (maFast) is above the slow moving average (maSlow), it is considered a bullish trend, and an area between the two moving averages is colored in green (RGB: 8, 153, 129). Otherwise, it is considered a bearish trend, and the area is colored in red (RGB: 242, 54, 69).


This code draws the area between the two moving averages using colors to indicate whether the trend is bullish or bearish, enhancing trend visualization on the chart.

4.1.2 Supertrend

With trendType = 2, the Supertrend indicator is activated, which uses the ATR (Average True Range) to calculate trend bands:

  • Upper band (up): Calculated by subtracting the ATR multiplied by the adjustment factor (factor) from the bar’s high.
  • Lower band (dn): Calculated by adding the ATR multiplied by the factor to the bar’s low.

The Supertrend follows the price action, adjusting dynamically according to volatility. If the current price crosses above the upper band, it is considered a bullish trend, while crossing below the lower band indicates a bearish trend.

Here, the indicator colors the area between the Supertrend line and the close price to visualize the prevailing trend.

4.1.3 Donchian Channels

When trendType = 3 is selected, the indicator uses Donchian Channels, which plot the highest and lowest values over a period defined by the length parameter to determine whether there is a bullish or bearish trend.


If the price is reaching new highs, the indicator detects a bullish trend; if it is reaching new lows, it detects a bearish trend. Like the other trend filters, the area between the Donchian channel lines is colored using green for bullish trends and red for bearish trends.

4.2 Reversal Pattern Detection

4.2.1 Bullish Reversal

The indicator looks for a bullish reversal pattern based on the last numBars bars. It evaluates whether the price has consistently dropped and has started to reverse. A minimum percentage of bearish bars (defined by minBars) is required to validate the pattern.

If the bullish reversal pattern is confirmed, and the overall trend is also bullish, the indicator generates a buy signal.

4.2.2 Bearish Reversal

The process for detecting a bearish reversal is similar, but this time the indicator looks for a series of bullish bars followed by a reversal to the downside.

If the bearish reversal pattern is confirmed and the overall trend is bearish, a sell signal is generated.

4.3 Visual Signals on the Chart

When a bullish or bearish reversal is confirmed, the indicator plots the corresponding signals on the chart, along with lines and rectangles highlighting key support and resistance levels.

  • Bullish Signals:
  • Bearish Signals:

5. Conclusion

The N Reversal Detector is a versatile and comprehensive indicator designed to detect both bullish and bearish reversals using a combination of trend filters and price patterns. This indicator allows traders to adapt their analysis to different market conditions, whether the market is trending or range-bound.

Key features of the indicator include:

  • Trend Filters: Moving averages, Supertrend, and Donchian Channels, allowing traders to adjust trend detection based on their preferences.
  • Reversal Pattern Detection: Identifies potential trend changes based on customizable settings that analyze recent bar behavior.
  • Flexibility: The indicator is highly configurable, allowing users to adjust parameters like moving average lengths, ATR periods, and trend filters to optimize it for their strategy.
  • Clear Visual Signals: Buy and sell signals are clearly displayed on the chart, helping traders make quick and accurate decisions.

In summary, the N Reversal Detector is a powerful tool for traders seeking to identify entry and exit points based on potential trend reversals, and who require flexibility to tailor the indicator to various market conditions.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

avatar
Register or

Likes

avatar
Related users ' posts
Javier Goberna Hola Iván muchas gracias por todo tu trabajo y por tus videos. Estoy dado de alta en la plat...
Iván Hola javier gracias! es importante realizar buenos backtest antes de lanzarse al mercado y ...
elcortijoverde Gracias Iván,...sigo tus videos en Youtube. Ya estoy con la V12 y se descarga, pero algo est...
elcortijoverde Bueno, ya aparecen las velas, pero ahora, cada fin de vela aparece un nuevo pronóstico y no ...
Roger Gracias por compartir, pero no tengo ninguna predicción. @Ivan @elcortijoverde ¿qué modifica...
ARNAUD20 J'ai, télécharger le logiciel : falling-and-rising-3-methods.itf : rien se passe sur le grap...
DeathMetal C'est un modèle assez rare, essayez-le sur un petit laps de temps, par exemple 5 minutes et ...
okeus Ciao, il tuo lavoro è incredibile, ti chiedo una cortesia è possibile veder un grafico con ...
Gaspare Ciao Ivan si puo' inserire una strategia su questo indicatore per ottimizzare le variabil...
philippe59139 Bravo super travail
Fgats quelques explications en Français ici : Some explanations in French here : https://www.p...
Nicolas Merci pour cette contribution, j'apprécie ! :)
Fgats Merci Nicolas pour ces encouragements et merci aussi pour le commentaire en Anglais accompa...
Goldotor Thank you for sharing this indicator. That's a great work.
Stefano1234 there is an error: Define the variable: prd, showBreak, showPattern, showPvts
romanelli4 molto interessante e grazie ma come faccio a trasformarlo in trading system? grazie per l...
Nicolas
2 years ago
ipbvba Quelqu'un a t il pu créer un screener pour cet indicateur, cela serait très utile. Merci bea...
Nicolas Je pense que le code ci-dessous doit fonctionner pour un screener: //PRC_Wick Pressure | i...
Nicolas la dernière ligne doit être: screener[signal>0 or signal<0](signal)
Finning Hi JuanJ, just a question about the tollerance*pointsize. I know what it is/what it does (in...
JOKAMAURICE Hi I am looking to number bars in a chart to ease analysis. Any idea if a program has been d...
goldenfish67 Hi guys just copied the code but I keep getting an error message: "Line 15 one of the fo...
idunnomuch IS this working in the latest version of prorealtime? I get the indicator, but not over my c...
bernardmorel egalement apparait en dessous du graphique mais vide
bernardmorel Bonjour est t il possible de remettre en ligne the strat car il y a une indication qui d...
jimkn0pf Christopher, wie saehe denn die Formel ohne Kontrollkerze (3. Kerze) aus?
joguemon Buenas, he instalado el screener pero no me aparecen los números que indicas...tengo que mon...
enriquem Hola, No, los numeros no aparecen, Proscreener no permite rotular, Lo que devuelve el sc...
PeytoLake Hi Enriquem, How do I change the timeframe from 'Daily' to "5 min"? Thank you.
Balmora74 thanks for this code Philippo ! So if i understand well a Positive (+) EntryOK x ROC means a...
Dritan Hi Philippo,thanks for sharing this code.Can You add please Volume more than 250.00?Thanks
robertogozzi I suggest that you open a new topic in the ProScreener support forum. Thank you.
massimo.g. questo screener si può usare anche sul mercato Azinario ?

Top