OPEN-SOURCE SCRIPT

Range Average Retest Model [LuxAlgo]

The Range Average Retest Model tool highlights setups from the range average retest entry model, a model using the retest of the average between two opposite swing points as an entry.

This tool uses long-term volatility coupled with user-defined multipliers to filter out swing areas and set take profit and stop loss levels for all trades.

Key features include:

  • Draw up to 165 swing areas and their associated trades
  • Filter out swing areas using Pivot Length, Selection Mode and Threshold parameters
  • Filter out trades with Maximum Distance and Minimum Distance parameters
  • Enable or disable swing areas and select default colors
  • Enable or disable overlapping trades and change the default colors for Take Profit and Stop Loss zones


🔶 USAGE

imagen

The "Range Average Retest Model" is an entry model that enters a position when the price retests the average made between two swing points. Users can determine the period of the detected swing points from the "Pivot Length" setting.

The conditions for long or short trades, regardless of whether the swing area is bullish or bearish, are as follows:

  • Long positions: the current bar close is below the swing area average and the last bar close was above it.
  • Short positions: the current bar close is above the swing area average price and the last bar close was below it.


Each trade is displayed on the chart with a line connecting it to its swing area highlighting the range average, a green area for the take profit, and a red area for the stop loss.

Both the Take Profit and Stop Loss levels are calculated by applying your own multiplier in the settings panel to the long-term volatility measure, in this case, the average true range over the last 200 bars.

Trades will remain open until they reach either the Stop Loss or Take Profit price levels.

🔹 Filtering Swing Areas

imagen

The daily chart of the Nasdaq-100 futures (NQ) with pivot length 2 and bullish selection mode: it only detects bullish swing areas, but they are smaller and more numerous.

Traders can manipulate the behavior of the swing areas from the settings panel.

The Selection mode will filter areas by bias: it will detect bullish areas, bearish areas, or both.

The Threshold parameter is applied to the long-term volatility to filter out areas where the average prices are too close together; the higher the value, the greater the difference between the average prices must be.

🔹 Trades

imagen

3-minute chart of the Nasdaq-100 futures (NQ) with pivot length 5, bearish selection mode maximum distance 4, and stop loss 2: many trades detected with very asymmetric risk/reward.

The behavior of the trades is also manipulated from the settings panel.

The maximum and minimum distance parameters specify the number of bars a trade must be away from a swing area.

The Take Profit and Stop Loss parameters are applied to the long-term volatility to obtain their respective price levels.

🔹 Overlapping Trades

imagen

Same chart as before, but with overlapping trades: messy, right?

By default the tool does not show overlapping trades, this allows for a cleaner chart.

In the settings panel traders can enable overlapping mode, in which case the tool will show all available trades.

Traders must be aware that the chart can be very crowded.

🔶 SETTINGS

🔹 Swings

  • Pivot Length: How many bars are used to confirm a swing point. The larger this parameter is, the larger and fewer swing areas will be detected.
  • Selection Mode: Swing area detection mode, detect only bullish swings, only bearish swings, or both.
  • Threshold: Swing area comparator. This threshold is multiplied by a measure of volatility (average true range over the last 200 bars), for a new swing area to be detected it must have an average level that is sufficiently distant from the average level of any untouched swing area, this parameter controls that distance.


🔹 Trades

  • Maximum distance: Maximum distance allowed between a swing area and a trade.
  • Minimum distance: Minimum distance allowed between a swing area and a trade.
  • Take profit: The size of the take profit - this threshold is multiplied by a measure of volatility (the average true range over the last 200 bars).
  • Stop loss: The size of the stop-loss: this threshold is multiplied by a measure of volatility (the average true range over the last 200 bars).

entryentrymodelsentrypointluxalgorangerangetradingretestTrend Analysis

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?


Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
También en:

Exención de responsabilidad