OPEN-SOURCE SCRIPT

Sequencer [LuxAlgo]

Updated
The Sequencer indicator is a tool that is able to highlight sequences of prices based on their relative position to past prices, which allows a high degree of customization from the user.

Two phases are included in this script, a "Preparation" phase and a "Lead-Up" phase, each with a customizable amount of steps, as well as other characteristics.

Users can also highlight the last step leading to each phase completion with a level, this level can eventually be used as a key price point.

🔶 USAGE

snapshot

The script highlights two phases, each being based on a sequence of events requiring prices to be higher/lower than prices various bars ago.

The completion of the preparation phase will lead to the evaluation of the lead-up phase, however, it isn't uncommon to see a reversal occurring after the completion of a preparation phase. In the script, bullish preparations are highlighted in green, while bearish preparations are highlighted in red.

snapshot

Completion of a "Lead-Up" phase is indicative of a potential reversal, with a bullish reversal for the completion of a bullish lead-up (in blue), and a bearish reversal for the completion of a bearish lead-up (in orange).

snapshot

Using a higher length for the preparation/lead-up phases can allow the detection of longer-term reversals.

snapshot

Users wishing to display levels based on specific phases completion can do so from the settings in the "Preparation/Lead-Up Completion Levels" settings group.

The "Show Last" settings determine the amount of respective levels to display on the chart.

🔶 PREPARATION PHASE

The "Preparation" phase precedes the "Lead-Up" phase. The completion of this phase requires N successive prices to be lower than the closing price P bars ago for a bullish phase, and for prices to be higher than the closing price P bars ago for a bearish phase, where N is the user set "Preparation Phase Length" and P the user set "Comparison Period".

🔹Refined Preparations

snapshot

Sequences of the preparation phase can either be "Standard" or "Refined". Unlike the standard preparation previously described a refined preparation requires the low prices from the user-specified steps in "Refined Preparation Steps" to be above the low price of the last step for a bullish preparation phase, and for the high prices specified in the refined preparation steps to be below the high price of the last step for a bearish preparation phase.

🔶 LEAD-UP PHASE

The "Lead-Up" phase is initiated by the completion of the "Preparation" phase.

Completion of this phase requires the price to be lower than the low price P bars ago N times for a bullish phase, and for prices to be higher than the high price P bars ago N times for a bearish phase, where N is the user set "Lead-Up Phase Length" and P the user set "Comparison Period".

Unlike with the "Preparation" phase these conditions don't need to be successive for them to be valid and can occur at any time.

🔹Lead-Up Cancellation

snapshot

Incomplete "Lead-Up" phases can be canceled and removed from the chart once a preparation of the opposite sentiment is completed, avoiding lead-ups to be evaluated after completion of complete preparations.

This can be disabled by toggling off "Apply Cancellation".

🔹Lead-Up Suspension

snapshot

Like with refined preparations, we can require specific steps from the lead-up phase to be higher/lower than the price on the last step. This can be particularly important since we do not require lead-up steps to be successive.

For a bullish lead-up, the low of the last step must be lower than the minimum closing prices of the user-specified steps for it to be valid, while for a bearish lead-up, the high of the last step must be higher than the maximum closing prices of the user-specified steps for it to be valid.

This effectively allows for eliminating lead-up phases getting completed on opposite trends.

🔶 SETTINGS

🔹Preparation Phase

  • Preparation Phase Length: Length of the "Preparation" phase.
  • Comparison Period: Offset used to compare current prices to past ones.
  • Preparation Type: Type of preparation to evaluate, options include "Standard" or "Refined"
  • Refined Preparations Steps: Steps to evaluate when preparation type is "Refined"


🔹Lead-Up Phase

  • Lead-Up Phase Length: Length of the "Lead-Up" phase.
  • Comparison Period: Offset used to compare current prices to past ones.
  • Suspension: Applies suspension rule to evaluate lead-up completion.
  • Suspension Steps: Specifies the steps evaluated to determine if the lead-up referral is respected. Multiple steps are supported and should be comma-separated.
  • Apply Cancellation: Cancellation will remove any incomplete lead-up upon the completion of a new preparation phase of the opposite sentiment.


🔹Levels

  • Bullish Preparations Levels: When enabled display price levels from completed bullish preparations.
  • Show Last: Number of most recent bullish preparations levels to display.
  • Bearish Preparations Levels: When enabled display price levels from completed bearish preparations.
  • Show Last: Number of most recent bearish preparations levels to display.
Release Notes
- Added the option to change the size of the displayed numbers for the preparation and leadup phases
Chart patternscycleCyclesluxalgopatternreversalsequencesequencersupportandresitancetrendtrading

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?


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.
Also on:

Disclaimer