PINE LIBRARY
SequencerLibrary

Library "SequencerLibrary"
SequencerLibrary v1 is a Pine Script™ library for identifying, tracking, and visualizing
sequential bullish and bearish patterns on price charts.
It provides a complete framework for building sequence-based trading systems, including:
• Automatic detection and counting of setup and countdown phases.
• Real-time tracking of completion states, perfected setups, and exhaustion signals.
• Dynamic support and resistance thresholds derived from recent price structure.
• Customizable visual highlighting for both setup and countdown sequences.
method doSequence(s, src, config, condition)
Updates the sequence state based on the source value, and user configuration.
Namespace types: Sequence
Parameters:
s (Sequence): <Sequence> The sequence object containing bullish and bearish setups.
src (float): <float> The source value (e.g., close price) used for evaluating sequence conditions.
config (SequenceInputs): <SequenceInputs> The user-defined settings for sequence analysis.
condition (bool): <bool> When true, executes the sequence logic.
Returns: <void>
highlight(s, css, condition)
Highlights the bullish and bearish sequence setups and countdowns on the chart.
Parameters:
s (Sequence): <Sequence> The sequence object containing bullish and bearish sequence states.
css (SequenceCSS): <SequenceCSS> The styling configuration for customizing label appearances.
condition (bool): <bool> When true, the function creates and displays labels for setups and countdowns.
Returns: <void>
SequenceState
A type representing the configuration and state of a sequence setup.
Fields:
setup (series int): <int> Current count of the setup phase (e.g., how many bars have met the setup criteria).
countdown (series int): <int> Current count of the countdown phase (e.g., bars meeting countdown criteria).
threshold (series float): <float> The price threshold level used as support/resistance for the sequence.
priceWhenCompleted (series float): <float> The closing price when the setup or countdown phase is completed.
indicatorWhenCompleted (series float): <float> The indicator value when the setup or countdown phase is completed.
setupCompleted (series bool): <bool> Indicates if the setup phase has been completed (i.e., reached the required count).
countdownCompleted (series bool): <bool> Indicates if the countdown phase has been completed (i.e., reached exhaustion).
perfected (series bool): <bool> Indicates if the setup meets the "perfected" condition (e.g., aligns with strict criteria).
highlightSetup (series bool): <bool> Determines whether the setup phase should be visually highlighted on the chart.
highlightCountdown (series bool): <bool> Determines whether the countdown phase should be visually highlighted on the chart.
Sequence
A type containing bullish and bearish sequence setups.
Fields:
bullish (SequenceState): <SequenceState> Configuration and state for bullish sequences.
bearish (SequenceState): <SequenceState> Configuration and state for bearish sequences.
SequenceInputs
A type for user-configurable input settings for sequence-based analysis.
Fields:
showSetup (series bool): <bool> Enables or disables the display of setup sequences.
showCountdown (series bool): <bool> Enables or disables the display of countdown sequences.
setupFilter (series string): <string> A comma‐separated string containing setup sequence counts to be highlighted (e.g., "1,2,3,4,5,6,7,8,9").
countdownFilter (series string): <string> A comma‐separated string containing countdown sequence counts to be highlighted (e.g., "1,2,3,4,5,6,7,8,9,10,11,12,13").
lookbackSetup (series int): <int> Defines the lookback period for evaluating setup conditions (default: 4 bars).
lookbackCountdown (series int): <int> Defines the lookback period for evaluating countdown conditions (default: 2 bars).
lookbackSetupPerfected (series int): <int> Defines the lookback period to determine a perfected setup condition (default: 6 bars).
maxSetup (series int): <int> The maximum count required to complete a setup phase (default: 9).
maxCountdown (series int): <int> The maximum count required to complete a countdown phase (default: 13).
SequenceCSS
A type defining the visual styling options for sequence labels.
Fields:
bullish (series color): <color> Color used for bullish sequence labels.
bearish (series color): <color> Color used for bearish sequence labels.
imperfect (series color): <color> Color used for labels representing imperfect sequences.
SequencerLibrary v1 is a Pine Script™ library for identifying, tracking, and visualizing
sequential bullish and bearish patterns on price charts.
It provides a complete framework for building sequence-based trading systems, including:
• Automatic detection and counting of setup and countdown phases.
• Real-time tracking of completion states, perfected setups, and exhaustion signals.
• Dynamic support and resistance thresholds derived from recent price structure.
• Customizable visual highlighting for both setup and countdown sequences.
method doSequence(s, src, config, condition)
Updates the sequence state based on the source value, and user configuration.
Namespace types: Sequence
Parameters:
s (Sequence): <Sequence> The sequence object containing bullish and bearish setups.
src (float): <float> The source value (e.g., close price) used for evaluating sequence conditions.
config (SequenceInputs): <SequenceInputs> The user-defined settings for sequence analysis.
condition (bool): <bool> When true, executes the sequence logic.
Returns: <void>
highlight(s, css, condition)
Highlights the bullish and bearish sequence setups and countdowns on the chart.
Parameters:
s (Sequence): <Sequence> The sequence object containing bullish and bearish sequence states.
css (SequenceCSS): <SequenceCSS> The styling configuration for customizing label appearances.
condition (bool): <bool> When true, the function creates and displays labels for setups and countdowns.
Returns: <void>
SequenceState
A type representing the configuration and state of a sequence setup.
Fields:
setup (series int): <int> Current count of the setup phase (e.g., how many bars have met the setup criteria).
countdown (series int): <int> Current count of the countdown phase (e.g., bars meeting countdown criteria).
threshold (series float): <float> The price threshold level used as support/resistance for the sequence.
priceWhenCompleted (series float): <float> The closing price when the setup or countdown phase is completed.
indicatorWhenCompleted (series float): <float> The indicator value when the setup or countdown phase is completed.
setupCompleted (series bool): <bool> Indicates if the setup phase has been completed (i.e., reached the required count).
countdownCompleted (series bool): <bool> Indicates if the countdown phase has been completed (i.e., reached exhaustion).
perfected (series bool): <bool> Indicates if the setup meets the "perfected" condition (e.g., aligns with strict criteria).
highlightSetup (series bool): <bool> Determines whether the setup phase should be visually highlighted on the chart.
highlightCountdown (series bool): <bool> Determines whether the countdown phase should be visually highlighted on the chart.
Sequence
A type containing bullish and bearish sequence setups.
Fields:
bullish (SequenceState): <SequenceState> Configuration and state for bullish sequences.
bearish (SequenceState): <SequenceState> Configuration and state for bearish sequences.
SequenceInputs
A type for user-configurable input settings for sequence-based analysis.
Fields:
showSetup (series bool): <bool> Enables or disables the display of setup sequences.
showCountdown (series bool): <bool> Enables or disables the display of countdown sequences.
setupFilter (series string): <string> A comma‐separated string containing setup sequence counts to be highlighted (e.g., "1,2,3,4,5,6,7,8,9").
countdownFilter (series string): <string> A comma‐separated string containing countdown sequence counts to be highlighted (e.g., "1,2,3,4,5,6,7,8,9,10,11,12,13").
lookbackSetup (series int): <int> Defines the lookback period for evaluating setup conditions (default: 4 bars).
lookbackCountdown (series int): <int> Defines the lookback period for evaluating countdown conditions (default: 2 bars).
lookbackSetupPerfected (series int): <int> Defines the lookback period to determine a perfected setup condition (default: 6 bars).
maxSetup (series int): <int> The maximum count required to complete a setup phase (default: 9).
maxCountdown (series int): <int> The maximum count required to complete a countdown phase (default: 13).
SequenceCSS
A type defining the visual styling options for sequence labels.
Fields:
bullish (series color): <color> Color used for bullish sequence labels.
bearish (series color): <color> Color used for bearish sequence labels.
imperfect (series color): <color> Color used for labels representing imperfect sequences.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.