loxxmasLibrary   "loxxmas" 
TODO:loxx moving averages used in indicators
 kama(src, len, kamafastend, kamaslowend) 
  KAMA Kaufman adaptive moving average
  Parameters:
     src (float) : float
     len (int) : int
     kamafastend (int) : int
     kamaslowend (int) : int
  Returns: array
 ama(src, len, fl, sl) 
  AMA, adaptive moving average
  Parameters:
     src (float) : float
     len (int) : int
     fl (int) : int
     sl (int) : int
  Returns: array
 t3(src, len) 
  T3 moving average, adaptive moving average
  Parameters:
     src (float) : float
     len (simple int) : int
  Returns: array
 adxvma(src, len) 
  ADXvma - Average Directional Volatility Moving Average
  Parameters:
     src (float) : float
     len (int) : int
  Returns: array
 ahrma(src, len) 
  Ahrens Moving Average
  Parameters:
     src (float) : float
     len (int) : int
  Returns: array
 alxma(src, len) 
  Alexander Moving Average - ALXMA
  Parameters:
     src (float) : float
     len (int) : int
  Returns: array
 dema(src, len) 
  Double Exponential Moving Average - DEMA
  Parameters:
     src (float) : float
     len (simple int) : int
  Returns: array
 dsema(src, len) 
  Double Smoothed Exponential Moving Average - DSEMA
  Parameters:
     src (float) : float
     len (int) : int
  Returns: array
 ema(src, len) 
  Exponential Moving Average - EMA
  Parameters:
     src (float) : float
     len (simple int) : int
  Returns: array
 fema(src, len) 
  Fast Exponential Moving Average - FEMA
  Parameters:
     src (float) : float
     len (int) : int
  Returns: array
 hma(src, len) 
  Hull moving averge
  Parameters:
     src (float) : float
     len (simple int) : int
  Returns: array
 ie2(src, len) 
  Early T3 by Tim Tilson
  Parameters:
     src (float) : float
     len (int) : int
  Returns: array
 frama(src, len, FC, SC) 
  Fractal Adaptive Moving Average - FRAMA
  Parameters:
     src (float) : float
     len (int) : int
     FC (int) : int
     SC (int) : int
  Returns: array
 instant(src, alpha) 
  Instantaneous Trendline
  Parameters:
     src (float) : float
     alpha (float) 
  Returns: array
 ilrs(src, len) 
  Integral of Linear Regression Slope - ILRS
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 laguerre(src, alpha) 
  Laguerre Filter
  Parameters:
     src (float) : float
     alpha (float) 
  Returns: array
 leader(src, len) 
  Leader Exponential Moving Average
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 lsma(src, len, offset) 
  Linear Regression Value - LSMA (Least Squares Moving Average)
  Parameters:
     src (float) : float
     len (simple int) 
     offset (simple int) 
  Returns: array
 lwma(src, len) 
  Linear Weighted Moving Average - LWMA
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 mcginley(src, len) 
  McGinley Dynamic
  Parameters:
     src (float) : float
     len (simple int) 
  Returns: array
 mcNicholl(src, len) 
  McNicholl EMA
  Parameters:
     src (float) : float
     len (simple int) 
  Returns: array
 nonlagma(src, len) 
  Non-lag moving average
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 pwma(src, len, pwr) 
  Parabolic Weighted Moving Average
  Parameters:
     src (float) : float
     len (int) 
     pwr (float) 
  Returns: array
 rmta(src, len) 
  Recursive Moving Trendline
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 decycler(src, len) 
  Simple decycler - SDEC
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 sma(src, len) 
  Simple Moving Average
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 swma(src, len) 
  Sine Weighted Moving Average
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 slwma(src, len) 
  linear weighted moving average
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 smma(src, len) 
  Smoothed Moving Average - SMMA
  Parameters:
     src (float) : float
     len (simple int) 
  Returns: array
 super(src, len) 
  Ehlers super smoother
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 smoother(src, len) 
  Smoother filter
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 tma(src, len) 
  Triangular moving average - TMA
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 tema(src, len) 
  Tripple exponential moving average - TEMA
  Parameters:
     src (float) : float
     len (simple int) 
  Returns: array
 vwema(src, len) 
  Volume weighted ema - VEMA
  Parameters:
     src (float) : float
     len (simple int) 
  Returns: array
 vwma(src, len) 
  Volume weighted moving average - VWMA
  Parameters:
     src (float) : float
     len (simple int) 
  Returns: array
 zlagdema(src, len) 
  Zero-lag dema
  Parameters:
     src (float) : float
     len (simple int) 
  Returns: array
 zlagma(src, len) 
  Zero-lag moving average
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 zlagtema(src, len) 
  Zero-lag tema
  Parameters:
     src (float) : float
     len (simple int) 
  Returns: array
 threepolebuttfilt(src, len) 
  Three-pole Ehlers Butterworth
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 threepolesss(src, len) 
  Three-pole Ehlers smoother
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 twopolebutter(src, len) 
  Two-pole Ehlers Butterworth
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
 twopoless(src, len) 
  Two-pole Ehlers smoother
  Parameters:
     src (float) : float
     len (int) 
  Returns: array
Techindicator
LibVPrfLibrary   "LibVPrf" 
This library provides an object-oriented framework for volume
profile analysis in Pine Script®. It is built around the `VProf`
User-Defined Type (UDT), which encapsulates all data, settings,
and statistical metrics for a single profile, enabling stateful
analysis with on-demand calculations.
Key Features:
1.  **Object-Oriented Design (UDT):** The library is built around
the `VProf` UDT. This object encapsulates all profile data
and provides methods for its full lifecycle management,
including creation, cloning, clearing, and merging of profiles.
2.  **Volume Allocation (`AllotMode`):** Offers two methods for
allocating a bar's volume:
- **Classic:** Assigns the entire bar's volume to the close
price bucket.
- **PDF:** Distributes volume across the bar's range using a
statistical price distribution model from the `LibBrSt` library.
3.  **Buy/Sell Volume Splitting (`SplitMode`):** Provides methods
for classifying volume into buying and selling pressure:
- **Classic:** Classifies volume based on the bar's color (Close vs. Open).
- **Dynamic:** A specific model that analyzes candle structure
(body vs. wicks) and a short-term trend factor to
estimate the buy/sell share at each price level.
4.  **Statistical Analysis (On-Demand):** Offers a suite of
statistical metrics calculated using a "Lazy Evaluation"
pattern (computed only when requested via `get...` methods):
- **Central Tendency:** Point of Control (POC), VWAP, and Median.
- **Dispersion:** Value Area (VA) and Population Standard Deviation.
- **Shape:** Skewness and Excess Kurtosis.
- **Delta:** Cumulative Volume Delta, including its
historical high/low watermarks.
5.  **Structural Analysis:** Includes a parameter-free method
(`getSegments`) to decompose a profile into its fundamental
unimodal segments, allowing for modality detection (e.g.,
identifying bimodal profiles).
6.  **Dynamic Profile Management:**
- **Auto-Fitting:** Profiles set to `dynamic = true` will
automatically expand their price range to fit new data.
- **Manipulation:** The resolution, price range, and Value Area
of a dynamic profile can be changed at any time. This
triggers a resampling process that uses a **linear
interpolation model** to re-bucket existing volume.
- **Assumption:** Non-dynamic profiles are fixed and will throw
a `runtime.error` if `addBar` is called with data
outside their initial range.
7.  **Bucket-Level Access:** Provides getter methods for direct
iteration and analysis of the raw buy/sell volume and price
boundaries of each individual price bucket.
---
**DISCLAIMER**
This library is provided "AS IS" and for informational and
educational purposes only. It does not constitute financial,
investment, or trading advice.
The author assumes no liability for any errors, inaccuracies,
or omissions in the code. Using this library to build
trading indicators or strategies is entirely at your own risk.
As a developer using this library, you are solely responsible
for the rigorous testing, validation, and performance of any
scripts you create based on these functions. The author shall
not be held liable for any financial losses incurred directly
or indirectly from the use of this library or any scripts
derived from it.
 create(buckets, rangeUp, rangeLo, dynamic, valueArea, allot, estimator, cdfSteps, split, trendLen) 
  Construct a new `VProf` object with fixed bucket count & range.
  Parameters:
     buckets (int) : series int        number of price buckets ≥ 1
     rangeUp (float) : series float      upper price bound (absolute)
     rangeLo (float) : series float      lower price bound (absolute)
     dynamic (bool) : series bool       Flag for dynamic adaption of profile ranges
     valueArea (int) : series int        Percentage of total volume to include in the Value Area (1..100)
     allot (series AllotMode) : series AllotMode  Allocation mode `classic` or `pdf`  (default `classic`)
     estimator (series PriceEst enum from AustrianTradingMachine/LibBrSt/1) : series LibBrSt.PriceEst PDF model when `model == PDF`. (deflault = 'uniform')
     cdfSteps (int) : series int        even #sub-intervals for Simpson rule (default 20)
     split (series SplitMode) : series SplitMode  Buy/Sell determination (default `classic`)
     trendLen (int) : series int        Look‑back bars for trend factor (default 3)
  Returns: VProf             freshly initialised profile
 method clone(self) 
  Create a deep copy of the volume profile.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf  Profile object to copy
  Returns: VProf  A new, independent copy of the profile
 method clear(self) 
  Reset all bucket tallies while keeping configuration intact.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf  profile object
  Returns: VProf  cleared profile (chaining)
 method merge(self, srcABuy, srcASell, srcRangeUp, srcRangeLo, srcCvd, srcCvdHi, srcCvdLo) 
  Merges volume data from a source profile into the current profile.
If resizing is needed, it performs a high-fidelity re-bucketing of existing
volume using a linear interpolation model inferred from neighboring buckets,
preventing aliasing artifacts and ensuring accurate volume preservation.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf         The target profile object to merge into.
     srcABuy (array) : array  The source profile's buy volume bucket array.
     srcASell (array) : array  The source profile's sell volume bucket array.
     srcRangeUp (float) : series float  The upper price bound of the source profile.
     srcRangeLo (float) : series float  The lower price bound of the source profile.
     srcCvd (float) : series float  The final Cumulative Volume Delta (CVD) value of the source profile.
     srcCvdHi (float) : series float  The historical high-water mark of the CVD from the source profile.
     srcCvdLo (float) : series float  The historical low-water mark of the CVD from the source profile.
  Returns: VProf         `self` (chaining), now containing the merged data.
 method addBar(self, offset) 
  Add current bar’s volume to the profile (call once per realtime bar).
classic mode: allocates all volume to the close bucket and classifies
by `close >= open`. PDF mode: distributes volume across buckets by the
estimator’s CDF mass. For `split = dynamic`, the buy/sell share per
price is computed via context-driven piecewise s(u).
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf       Profile object
     offset (int) : series int  To offset the calculated bar
  Returns: VProf       `self` (method chaining)
 method setBuckets(self, buckets) 
  Sets the number of buckets for the volume profile.
Behavior depends on the `isDynamic` flag.
- If `dynamic = true`: Works on filled profiles by re-bucketing to a new resolution.
- If `dynamic = false`: Only works on empty profiles to prevent accidental changes.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf       Profile object
     buckets (int) : series int  The new number of buckets
  Returns: VProf       `self` (chaining)
 method setRanges(self, rangeUp, rangeLo) 
  Sets the price range for the volume profile.
Behavior depends on the `dynamic` flag.
- If `dynamic = true`: Works on filled profiles by re-bucketing existing volume.
- If `dynamic = false`: Only works on empty profiles to prevent accidental changes.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf         Profile object
     rangeUp (float) : series float  The new upper price bound
     rangeLo (float) : series float  The new lower price bound
  Returns: VProf         `self` (chaining)
 method setValueArea(self, valueArea) 
  Set the percentage of volume for the Value Area. If the value
changes, the profile is finalized again.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf       Profile object
     valueArea (int) : series int  The new Value Area percentage (0..100)
  Returns: VProf       `self` (chaining)
 method getBktBuyVol(self, idx) 
  Get Buy volume of a bucket.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf         Profile object
     idx (int) : series int    Bucket index
  Returns: series float  Buy volume ≥ 0
 method getBktSellVol(self, idx) 
  Get Sell volume of a bucket.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf         Profile object
     idx (int) : series int    Bucket index
  Returns: series float  Sell volume ≥ 0
 method getBktBnds(self, idx) 
  Get Bounds of a bucket.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf       Profile object
     idx (int) : series int  Bucket index
  Returns:  
up  series float  The upper price bound of the bucket.
lo  series float  The lower price bound of the bucket.
 method getPoc(self) 
  Get POC information.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf  Profile object
  Returns:  
pocIndex  series int    The index of the Point of Control (POC) bucket.
pocPrice. series float  The mid-price of the Point of Control (POC) bucket.
 method getVA(self) 
  Get Value Area (VA) information.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf  Profile object
  Returns:  
vaUpIndex  series int    The index of the upper bound bucket of the Value Area.
vaUpPrice  series float  The upper price bound of the Value Area.
vaLoIndex  series int    The index of the lower bound bucket of the Value Area.
vaLoPrice  series float  The lower price bound of the Value Area.
 method getMedian(self) 
  Get the profile's median price and its bucket index. Calculates the value on-demand if stale.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf         Profile object.
  Returns:     
medianIndex  series int    The index of the bucket containing the Median.
medianPrice  series float  The Median price of the profile.
 method getVwap(self) 
  Get the profile's VWAP and its bucket index. Calculates the value on-demand if stale.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf         Profile object.
  Returns:     
vwapIndex    series int    The index of the bucket containing the VWAP.
vwapPrice    series float  The Volume Weighted Average Price of the profile.
 method getStdDev(self) 
  Get the profile's volume-weighted standard deviation. Calculates the value on-demand if stale.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf         Profile object.
  Returns: series float  The Standard deviation of the profile.
 method getSkewness(self) 
  Get the profile's skewness. Calculates the value on-demand if stale.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf         Profile object.
  Returns: series float  The Skewness of the profile.
 method getKurtosis(self) 
  Get the profile's excess kurtosis. Calculates the value on-demand if stale.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf         Profile object.
  Returns: series float  The Kurtosis of the profile.
 method getSegments(self) 
  Get the profile's fundamental unimodal segments. Calculates on-demand if stale.
Uses a parameter-free, pivot-based recursive algorithm.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf        The profile object.
  Returns: matrix  A 2-column matrix where each row is an   pair.
 method getCvd(self) 
  Cumulative Volume Delta (CVD) like metric over all buckets.
  Namespace types: VProf
  Parameters:
     self (VProf) : VProf      Profile object.
  Returns:  
cvd    series float  The final Cumulative Volume Delta (Total Buy Vol - Total Sell Vol).
cvdHi  series float  The running high-water mark of the CVD as volume was added.
cvdLo  series float  The running low-water mark of the CVD as volume was added.
 VProf 
  VProf  Bucketed Buy/Sell volume profile plus meta information.
  Fields:
     buckets (series int) : int              Number of price buckets (granularity ≥1)
     rangeUp (series float) : float            Upper price range (absolute)
     rangeLo (series float) : float            Lower price range (absolute)
     dynamic (series bool) : bool             Flag for dynamic adaption of profile ranges
     valueArea (series int) : int              Percentage of total volume to include in the Value Area (1..100)
     allot (series AllotMode) : AllotMode        Allocation mode `classic` or `pdf`
     estimator (series PriceEst enum from AustrianTradingMachine/LibBrSt/1) : LibBrSt.PriceEst Price density model when  `model == PDF`
     cdfSteps (series int) : int              Simpson integration resolution (even ≥2)
     split (series SplitMode) : SplitMode        Buy/Sell split strategy per bar
     trendLen (series int) : int              Look‑back length for trend factor (≥1)
     maxBkt (series int) : int              User-defined number of buckets (unclamped)
     aBuy (array) : array     Buy volume per bucket
     aSell (array) : array     Sell volume per bucket
     cvd (series float) : float            Final Cumulative Volume Delta (Total Buy Vol - Total Sell Vol).
     cvdHi (series float) : float            Running high-water mark of the CVD as volume was added.
     cvdLo (series float) : float            Running low-water mark of the CVD as volume was added.
     poc (series int) : int              Index of max‑volume bucket (POC). Is `na` until calculated.
     vaUp (series int) : int              Index of upper Value‑Area bound. Is `na` until calculated.
     vaLo (series int) : int              Index of lower value‑Area bound. Is `na` until calculated.
     median (series float) : float            Median price of the volume distribution. Is `na` until calculated.
     vwap (series float) : float            Profile VWAP (Volume Weighted Average Price). Is `na` until calculated.
     stdDev (series float) : float            Standard Deviation of volume around the VWAP. Is `na` until calculated.
     skewness (series float) : float            Skewness of the volume distribution. Is `na` until calculated.
     kurtosis (series float) : float            Excess Kurtosis of the volume distribution. Is `na` until calculated.
     segments (matrix) : matrix      A 2-column matrix where each row is an   pair. Is `na` until calculated.
LibPvotLibrary   "LibPvot" 
This is a library for advanced technical analysis, specializing
in two core areas: the detection of price-oscillator
divergences and the analysis of market structure. It provides
a back-end engine for signal detection and a toolkit for
indicator plotting.
Key Features:
1.  **Complete Divergence Suite (Class A, B, C):** The engine detects
all three major types of divergences, providing a full spectrum of
analytical signals:
- **Regular (A):** For potential trend reversals.
- **Hidden (B):** For potential trend continuations.
- **Exaggerated (C):** For identifying weakness at double tops/bottoms.
2.  **Advanced Signal Filtering:** The detection logic uses a
percentage-based price tolerance (`prcTol`). This feature
enables the practical detection of Exaggerated divergences
(which rarely occur at the exact same price) and creates a
"dead zone" to filter insignificant noise from triggering
Regular divergences.
3.  **Pivot Synchronization:** A bar tolerance (`barTol`) is used
to reliably match price and oscillator pivots that do not
align perfectly on the same bar, preventing missed signals.
4.  **Signal Invalidation Logic:** Features two built-in invalidation
rules:
- An optional `invalidate` parameter automatically terminates
active divergences if the price or the oscillator breaks
the level of the confirming pivot.
- The engine also discards 'half-pivots' (e.g., a price pivot)
if a corresponding oscillator pivot does not appear within
the `barTol` window.
5.  **Stateful Plotting Helpers:** Provides helper functions
(`bullDivPos` and `bearDivPos`) that abstract away the
state management issues of visualizing persistent signals.
They generate gap-free, accurately anchored data series
ready to be used in `plotshape` functions, simplifying
indicator-side code.
6.  **Rich Data Output:** The core detection functions (`bullDiv`, `bearDiv`)
return a comprehensive 9-field data tuple. This includes the
boolean flags for each divergence type and the precise
coordinates (price, oscillator value, bar index) of both the
starting and the confirming pivots.
7.  **Market Structure & Trend Analysis:** Includes a
`marketStructure` function to automatically identify pivot
highs/lows, classify their relationship (HH, LH, LL, HL),
detect structure breaks, and determine the current trend
state (Up, Down, Neutral) based on pivot sequences.
---
**DISCLAIMER**
This library is provided "AS IS" and for informational and
educational purposes only. It does not constitute financial,
investment, or trading advice.
The author assumes no liability for any errors, inaccuracies,
or omissions in the code. Using this library to build
trading indicators or strategies is entirely at your own risk.
As a developer using this library, you are solely responsible
for the rigorous testing, validation, and performance of any
scripts you create based on these functions. The author shall
not be held liable for any financial losses incurred directly
or indirectly from the use of this library or any scripts
derived from it.
 bullDiv(priceSrc, oscSrc, leftLen, rightLen, depth, barTol, prcTol, persist, invalidate) 
  Detects bullish divergences (Regular, Hidden, Exaggerated) based on pivot lows.
  Parameters:
     priceSrc (float) : series float  Price series to check for pivots (e.g., `low`).
     oscSrc (float) : series float  Oscillator series to check for pivots.
     leftLen (int) : series int    Number of bars to the left of a pivot (default 5).
     rightLen (int) : series int    Number of bars to the right of a pivot (default 5).
     depth (int) : series int    Maximum number of stored pivot pairs to check against (default 2).
     barTol (int) : series int    Maximum bar distance allowed between the price pivot and the oscillator pivot (default 3).
     prcTol (float) : series float  The percentage tolerance for comparing pivot prices. Used to detect Exaggerated
divergences and filter out market noise (default 0.05%).
     persist (bool) : series bool   If `true` (default), the divergence flag stays active for the entire duration of the signal.
If `false`, it returns a single-bar pulse on detection.
     invalidate (bool) : series bool   If `true` (default), terminates an active divergence if price or oscillator break
below the confirming pivot low.
  Returns:   A tuple containing comprehensive data for a detected bullish divergence.
regBull       series bool   `true` if a Regular bullish divergence (Class A) is active.
hidBull       series bool   `true` if a Hidden bullish divergence (Class B) is active.
exgBull       series bool   `true` if an Exaggerated bullish divergence (Class C) is active.
initPivotPrc  series float  Price value of the initial (older) pivot low.
initPivotOsz  series float  Oscillator value of the initial pivot low.
initPivotBar  series int    Bar index of the initial pivot low.
lastPivotPrc  series float  Price value of the last (confirming) pivot low.
lastPivotOsz  series float  Oscillator value of the last pivot low.
lastPivotBar  series int    Bar index of the last pivot low.
 bearDiv(priceSrc, oscSrc, leftLen, rightLen, depth, barTol, prcTol, persist, invalidate) 
  Detects bearish divergences (Regular, Hidden, Exaggerated) based on pivot highs.
  Parameters:
     priceSrc (float) : series float  Price series to check for pivots (e.g., `high`).
     oscSrc (float) : series float  Oscillator series to check for pivots.
     leftLen (int) : series int    Number of bars to the left of a pivot (default 5).
     rightLen (int) : series int    Number of bars to the right of a pivot (default 5).
     depth (int) : series int    Maximum number of stored pivot pairs to check against (default 2).
     barTol (int) : series int    Maximum bar distance allowed between the price pivot and the oscillator pivot (default 3).
     prcTol (float) : series float  The percentage tolerance for comparing pivot prices. Used to detect Exaggerated
divergences and filter out market noise (default 0.05%).
     persist (bool) : series bool   If `true` (default), the divergence flag stays active for the entire duration of the signal.
If `false`, it returns a single-bar pulse on detection.
     invalidate (bool) : series bool   If `true` (default), terminates an active divergence if price or oscillator break
above the confirming pivot high.
  Returns:   A tuple containing comprehensive data for a detected bearish divergence.
regBear       series bool   `true` if a Regular bearish divergence (Class A) is active.
hidBear       series bool   `true` if a Hidden bearish divergence (Class B) is active.
exgBear       series bool   `true` if an Exaggerated bearish divergence (Class C) is active.
initPivotPrc  series float  Price value of the initial (older) pivot high.
initPivotOsz  series float  Oscillator value of the initial pivot high.
initPivotBar  series int    Bar index of the initial pivot high.
lastPivotPrc  series float  Price value of the last (confirming) pivot high.
lastPivotOsz  series float  Oscillator value of the last pivot high.
lastPivotBar  series int    Bar index of the last pivot high.
 bullDivPos(regBull, hidBull, exgBull, rightLen, yPos) 
  Calculates the plottable data series for bullish divergences. It manages
the complex state of a persistent signal's plotting window to ensure
gap-free and accurately anchored visualization.
  Parameters:
     regBull (bool) : series bool   The regular bullish divergence flag from `bullDiv`.
     hidBull (bool) : series bool   The hidden bullish divergence flag from `bullDiv`.
     exgBull (bool) : series bool   The exaggerated bullish divergence flag from `bullDiv`.
     rightLen (int) : series int    The same `rightLen` value used in `bullDiv` for correct timing.
     yPos (float) : series float  The series providing the base Y-coordinate for the shapes (e.g., `low`).
  Returns:   A tuple of three `series float` for plotting bullish divergences.
regBullPosY  series float  Contains the static anchor Y-value for Regular divergences where a shape should be plotted; `na` otherwise.
hidBullPosY  series float  Contains the static anchor Y-value for Hidden divergences where a shape should be plotted; `na` otherwise.
exgBullPosY  series float  Contains the static anchor Y-value for Exaggerated divergences where a shape should be plotted; `na` otherwise.
 bearDivPos(regBear, hidBear, exgBear, rightLen, yPos) 
  Calculates the plottable data series for bearish divergences. It manages
the complex state of a persistent signal's plotting window to ensure
gap-free and accurately anchored visualization.
  Parameters:
     regBear (bool) : series bool   The regular bearish divergence flag from `bearDiv`.
     hidBear (bool) : series bool   The hidden bearish divergence flag from `bearDiv`.
     exgBear (bool) : series bool   The exaggerated bearish divergence flag from `bearDiv`.
     rightLen (int) : series int    The same `rightLen` value used in `bearDiv` for correct timing.
     yPos (float) : series float  The series providing the base Y-coordinate for the shapes (e.g., `high`).
  Returns:   A tuple of three `series float` for plotting bearish divergences.
regBearPosY  series float  Contains the static anchor Y-value for Regular divergences where a shape should be plotted; `na` otherwise.
hidBearPosY  series float  Contains the static anchor Y-value for Hidden divergences where a shape should be plotted; `na` otherwise.
exgBearPosY  series float  Contains the static anchor Y-value for Exaggerated divergences where a shape should be plotted; `na` otherwise.
 marketStructure(highSrc, lowSrc, leftLen, rightLen, srcTol) 
  Analyzes the market structure by identifying pivot points, classifying
their sequence (e.g., Higher Highs, Lower Lows), and determining the
prevailing trend state.
  Parameters:
     highSrc (float) : series float  Price series for pivot high detection (e.g., `high`).
     lowSrc (float) : series float  Price series for pivot low detection (e.g., `low`).
     leftLen (int) : series int    Number of bars to the left of a pivot (default 5).
     rightLen (int) : series int    Number of bars to the right of a pivot (default 5).
     srcTol (float) : series float  Percentage tolerance to consider two pivots as 'equal' (default 0.05%).
  Returns:   A tuple containing detailed market structure information.
pivType     series PivType  The type of the most recently formed pivot (e.g., `hh`, `ll`).
lastPivHi   series float    The price level of the last confirmed pivot high.
lastPivLo   series float    The price level of the last confirmed pivot low.
lastPiv     series float    The price level of the last confirmed pivot (either high or low).
pivHiBroken series bool     `true` if the price has broken above the last pivot high.
pivLoBroken series bool     `true` if the price has broken below the last pivot low.
trendState  series TrendState The current trend state (`up`, `down`, or `neutral`).
LibVolmLibrary   "LibVolm" 
This library provides a collection of core functions for volume and
money flow analysis. It offers implementations of several classic
volume-based indicators, with a focus on flexibility
for applications like multi-timeframe and session-based analysis.
Key Features:
1.  **Suite of Classic Volume Indicators:** Includes standard
implementations of several foundational indicators:
- **On Balance Volume (`obv`):** A momentum indicator that
accumulates volume based on price direction.
- **Accumulation/Distribution Line (`adLine`):** Measures cumulative
money flow using the close's position within the bar's range.
- **Chaikin Money Flow (`cmf`):** An oscillator version of the ADL
that measures money flow over a specified lookback period.
2.  **Anchored/Resettable Indicators:** The library includes flexible,
resettable indicators ideal for cyclical analysis:
- **Anchored VWAP (`vwap`):** Calculates a Volume Weighted Average
Price that can be reset on any user-defined `reset` condition.
It returns both the VWAP and the number of bars (`prdBars`) in
the current period.
- **Resettable CVD (`cvd`):** Computes a Cumulative Volume Delta
that can be reset on a custom `reset` anchor. The function
also tracks and returns the highest (`hi`) and lowest (`lo`)
delta values reached within the current period.
(Note: The delta sign is determined by a specific logic:
it first checks close vs. open, then close vs. prior
close, and persists the last non-zero sign).
3.  **Volume Sanitization:** All functions that use the built-in
`volume` variable automatically sanitize it via an internal
function. This process replaces `na` values with 0 and ensures
no negative volume values are used, providing stable calculations.
---
**DISCLAIMER**
This library is provided "AS IS" and for informational and
educational purposes only. It does not constitute financial,
investment, or trading advice.
The author assumes no liability for any errors, inaccuracies,
or omissions in the code. Using this library to build
trading indicators or strategies is entirely at your own risk.
As a developer using this library, you are solely responsible
for the rigorous testing, validation, and performance of any
scripts you create based on these functions. The author shall
not be held liable for any financial losses incurred directly
or indirectly from the use of this library or any scripts
derived from it.
 obv(price) 
  Calculates the On Balance Volume (OBV) cumulative indicator.
  Parameters:
     price (float) : series float  Source price series, typically the close.
  Returns: series float  Cumulative OBV value.
 adLine() 
  Computes the Accumulation/Distribution Line (AD Line).
  Returns: series float  Cumulative AD Line value.
 cmf(length) 
  Computes Chaikin Money Flow (CMF).
  Parameters:
     length (int) : series int    Lookback length for the CMF calculation.
  Returns: series float  CMF value.
 vwap(price, reset) 
  Calculates an anchored Volume Weighted Average Price (VWAP).
  Parameters:
     price (float) : series float   Source price series (usually *close*).
     reset (bool) : series bool    A signal that is *true* on the bar where the
accumulation should be reset.
  Returns:  
vwap     series float  The calculated Volume Weighted Average Price for the current period.
prdBars  series int    The number of bars that have passed since the last reset.
 cvd(reset) 
  Calculates a resettable, cumulative Volume Delta (CVD).
It accumulates volume delta and tracks its high/low range. The
accumulation is reset to zero whenever the `reset` condition is true.
This is useful for session-based analysis, intra-bar calculations,
or any other custom-anchored accumulation.
  Parameters:
     reset (bool) : series bool   A signal that is *true* on the bar where the
accumulation should be reset.
  Returns:  
cum  series float  The current cumulative volume delta.
hi   series float  The highest peak the cumulative delta has reached in the current period.
lo   series float  The lowest trough the cumulative delta has reached in the current period.
LibMvAvLibrary   "LibMvAv" 
This library provides a unified interface for calculating a
wide variety of moving averages. It is designed to simplify
indicator development by consolidating numerous MA calculations
into a single function and integrating the weighting
capabilities from the `LibWght` library.
Key Features:
1.  **All-in-One MA Function:** The core of the library is the
`ma()` function. Users can select the desired calculation
method via the `MAType` enum, which helps create
cleaner and more maintainable code compared to using
many different `ta.*` or custom functions.
2.  **Comprehensive Selection of MA Types:** It provides a
selection of 12 different moving averages, covering
common Pine Script built-ins and their weighted counterparts:
- **Standard MAs:** SMA, EMA, WMA, RMA (Wilder's), HMA (Hull), and
LSMA (Least Squares / Linear Regression).
- **Weighted MAs:** Weight-enhanced versions of the above
(WSMA, WEMA, WWMA, WRMA, WHMA, WLSMA).
3.  **Integrated Weighting:** The library provides weighted versions
for each of its standard MA types (e.g., `wsma` alongside `sma`).
By acting as a dispatcher, the `ma()` function allows these
weighted calculations to be called using the optional
`weight` parameter, which are then processed by the `LibWght`
library.
4.  **Simple API:** The library internally handles the logic of
choosing the correct function based on the selected `MAType`.
The user only needs to provide the source, length, and
optional weight, simplifying the development process.
---
**DISCLAIMER**
This library is provided "AS IS" and for informational and
educational purposes only. It does not constitute financial,
investment, or trading advice.
The author assumes no liability for any errors, inaccuracies,
or omissions in the code. Using this library to build
trading indicators or strategies is entirely at your own risk.
As a developer using this library, you are solely responsible
for the rigorous testing, validation, and performance of any
scripts you create based on these functions. The author shall
not be held liable for any financial losses incurred directly
or indirectly from the use of this library or any scripts
derived from it.
 ma(maType, source, length, weight) 
  Returns the requested moving average.
  Parameters:
     maType (simple MAType) : simple MAType Desired type (see enum above).
     source (float) : series float  Data series to smooth.
     length (simple int) : simple int    Look-back / period length.
     weight (float) : series float  Weight series (default = na)
  Returns: series float  Moving-average value.
LibWghtLibrary   "LibWght" 
This is a library of mathematical and statistical functions
designed for quantitative analysis in Pine Script. Its core
principle is the integration of a custom weighting series
(e.g., volume) into a wide array of standard technical
analysis calculations.
Key Capabilities:
1.  **Universal Weighting:** All exported functions accept a `weight`
parameter. This allows standard calculations (like moving
averages, RSI, and standard deviation) to be influenced by an
external data series, such as volume or tick count.
2.  **Weighted Averages and Indicators:** Includes a comprehensive
collection of weighted functions:
- **Moving Averages:** `wSma`, `wEma`, `wWma`, `wRma` (Wilder's),
`wHma` (Hull), and `wLSma` (Least Squares / Linear Regression).
- **Oscillators & Ranges:** `wRsi`, `wAtr` (Average True Range),
`wTr` (True Range), and `wR` (High-Low Range).
3.  **Volatility Decomposition:** Provides functions to decompose
total variance into distinct components for market analysis.
- **Two-Way Decomposition (`wTotVar`):** Separates variance into
**between-bar** (directional) and **within-bar** (noise)
components.
- **Three-Way Decomposition (`wLRTotVar`):** Decomposes variance
relative to a linear regression into **Trend** (explained by
the LR slope), **Residual** (mean-reversion around the
LR line), and **Within-Bar** (noise) components.
- **Local Volatility (`wLRLocTotStdDev`):** Measures the total
"noise" (within-bar + residual) around the trend line.
4.  **Weighted Statistics and Regression:** Provides a robust
function for Weighted Linear Regression (`wLinReg`) and a
full suite of related statistical measures:
- **Between-Bar Stats:** `wBtwVar`, `wBtwStdDev`, `wBtwStdErr`.
- **Residual Stats:** `wResVar`, `wResStdDev`, `wResStdErr`.
5.  **Fallback Mechanism:** All functions are designed for reliability.
If the total weight over the lookback period is zero (e.g., in
a no-volume period), the algorithms automatically fall back to
their unweighted, uniform-weight equivalents (e.g., `wSma`
becomes a standard `ta.sma`), preventing errors and ensuring
continuous calculation.
---
**DISCLAIMER**
This library is provided "AS IS" and for informational and
educational purposes only. It does not constitute financial,
investment, or trading advice.
The author assumes no liability for any errors, inaccuracies,
or omissions in the code. Using this library to build
trading indicators or strategies is entirely at your own risk.
As a developer using this library, you are solely responsible
for the rigorous testing, validation, and performance of any
scripts you create based on these functions. The author shall
not be held liable for any financial losses incurred directly
or indirectly from the use of this library or any scripts
derived from it.
 wSma(source, weight, length) 
  Weighted Simple Moving Average (linear kernel).
  Parameters:
     source (float) : series float  Data to average.
     weight (float) : series float  Weight series.
     length (int) : series int    Look-back length ≥ 1.
  Returns: series float  Linear-kernel weighted mean; falls back to
the arithmetic mean if Σweight = 0.
 wEma(source, weight, length) 
  Weighted EMA (exponential kernel).
  Parameters:
     source (float) : series float  Data to average.
     weight (float) : series float  Weight series.
     length (simple int) : simple int    Look-back length ≥ 1.
  Returns: series float  Exponential-kernel weighted mean; falls
back to classic EMA if Σweight = 0.
 wWma(source, weight, length) 
  Weighted WMA (linear kernel).
  Parameters:
     source (float) : series float  Data to average.
     weight (float) : series float  Weight series.
     length (int) : series int    Look-back length ≥ 1.
  Returns: series float  Linear-kernel weighted mean; falls back to
classic WMA if Σweight = 0.
 wRma(source, weight, length) 
  Weighted RMA (Wilder kernel, α = 1/len).
  Parameters:
     source (float) : series float  Data to average.
     weight (float) : series float  Weight series.
     length (simple int) : simple int    Look-back length ≥ 1.
  Returns: series float  Wilder-kernel weighted mean; falls back to
classic RMA if Σweight = 0.
 wHma(source, weight, length) 
  Weighted HMA (linear kernel).
  Parameters:
     source (float) : series float  Data to average.
     weight (float) : series float  Weight series.
     length (int) : series int    Look-back length ≥ 1.
  Returns: series float  Linear-kernel weighted mean; falls back to
classic HMA if Σweight = 0.
 wRsi(source, weight, length) 
  Weighted Relative Strength Index.
  Parameters:
     source (float) : series float  Price series.
     weight (float) : series float  Weight series.
     length (simple int) : simple int    Look-back length ≥ 1.
  Returns: series float  Weighted RSI; uniform if Σw = 0.
 wAtr(tr, weight, length) 
  Weighted ATR (Average True Range).
Implemented as WRMA on *true range*.
  Parameters:
     tr (float) : series float  True Range series.
     weight (float) : series float  Weight series.
     length (simple int) : simple int    Look-back length ≥ 1.
  Returns: series float  Weighted ATR; uniform weights if Σw = 0.
 wTr(tr, weight, length) 
  Weighted True Range over a window.
  Parameters:
     tr (float) : series float  True Range series.
     weight (float) : series float  Weight series.
     length (int) : series int    Look-back length ≥ 1.
  Returns: series float  Weighted mean of TR; uniform if Σw = 0.
 wR(r, weight, length) 
  Weighted High-Low Range over a window.
  Parameters:
     r (float) : series float  High-Low per bar.
     weight (float) : series float  Weight series.
     length (int) : series int    Look-back length ≥ 1.
  Returns: series float  Weighted mean of range; uniform if Σw = 0.
 wBtwVar(source, weight, length, biased) 
  Weighted Between Variance (biased/unbiased).
  Parameters:
     source (float) : series float  Data series.
     weight (float) : series float  Weight series.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population (biased); false → sample.
  Returns:  
variance  series float  The calculated between-bar variance (σ²btw), either biased or unbiased.
sumW      series float  The sum of weights over the lookback period (Σw).
sumW2     series float  The sum of squared weights over the lookback period (Σw²).
 wBtwStdDev(source, weight, length, biased) 
  Weighted Between Standard Deviation.
  Parameters:
     source (float) : series float  Data series.
     weight (float) : series float  Weight series.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population (biased); false → sample.
  Returns: series float  σbtw uniform if Σw = 0.
 wBtwStdErr(source, weight, length, biased) 
  Weighted Between Standard Error.
  Parameters:
     source (float) : series float  Data series.
     weight (float) : series float  Weight series.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population (biased); false → sample.
  Returns: series float  √(σ²btw / N_eff) uniform if Σw = 0.
 wTotVar(mu, sigma, weight, length, biased) 
  Weighted Total Variance (= between-group + within-group).
Useful when each bar represents an aggregate with its own
mean* and pre-estimated σ (e.g., second-level ranges inside a
1-minute bar). Assumes the *weight* series applies to both the
group means and their σ estimates.
  Parameters:
     mu (float) : series float  Group means (e.g., HL2 of 1-second bars).
     sigma (float) : series float  Pre-estimated σ of each group (same basis).
     weight (float) : series float  Weight series (volume, ticks, …).
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population (biased); false → sample.
  Returns:  
varBtw  series float  The between-bar variance component (σ²btw).
varWtn  series float  The within-bar variance component (σ²wtn).
sumW    series float  The sum of weights over the lookback period (Σw).
sumW2   series float  The sum of squared weights over the lookback period (Σw²).
 wTotStdDev(mu, sigma, weight, length, biased) 
  Weighted Total Standard Deviation.
  Parameters:
     mu (float) : series float  Group means (e.g., HL2 of 1-second bars).
     sigma (float) : series float  Pre-estimated σ of each group (same basis).
     weight (float) : series float  Weight series (volume, ticks, …).
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population (biased); false → sample.
  Returns: series float  σtot.
 wTotStdErr(mu, sigma, weight, length, biased) 
  Weighted Total Standard Error.
SE = √( total variance / N_eff ) with the same effective sample
size logic as `wster()`.
  Parameters:
     mu (float) : series float  Group means (e.g., HL2 of 1-second bars).
     sigma (float) : series float  Pre-estimated σ of each group (same basis).
     weight (float) : series float  Weight series (volume, ticks, …).
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population (biased); false → sample.
  Returns: series float  √(σ²tot / N_eff).
 wLinReg(source, weight, length) 
  Weighted Linear Regression.
  Parameters:
     source (float) : series float   Data series.
     weight (float) : series float   Weight series.
     length (int) : series int     Look-back length ≥ 2.
  Returns:  
mid        series float  The estimated value of the regression line at the most recent bar.
slope      series float  The slope of the regression line.
intercept  series float  The intercept of the regression line.
 wResVar(source, weight, midLine, slope, length, biased) 
  Weighted Residual Variance.
linear regression – optionally biased (population) or
unbiased (sample).
  Parameters:
     source (float) : series float   Data series.
     weight (float) : series float   Weighting series (volume, etc.).
     midLine (float) : series float   Regression value at the last bar.
     slope (float) : series float   Slope per bar.
     length (int) : series int     Look-back length ≥ 2.
     biased (bool) : series bool    true  → population variance (σ²_P), denominator ≈ N_eff.
false → sample variance (σ²_S), denominator ≈ N_eff - 2.
(Adjusts for 2 degrees of freedom lost to the regression).
  Returns:  
variance  series float  The calculated residual variance (σ²res), either biased or unbiased.
sumW      series float  The sum of weights over the lookback period (Σw).
sumW2     series float  The sum of squared weights over the lookback period (Σw²).
 wResStdDev(source, weight, midLine, slope, length, biased) 
  Weighted Residual Standard Deviation.
  Parameters:
     source (float) : series float  Data series.
     weight (float) : series float  Weight series.
     midLine (float) : series float  Regression value at the last bar.
     slope (float) : series float  Slope per bar.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population (biased); false → sample.
  Returns: series float  σres; uniform if Σw = 0.
 wResStdErr(source, weight, midLine, slope, length, biased) 
  Weighted Residual Standard Error.
  Parameters:
     source (float) : series float  Data series.
     weight (float) : series float  Weight series.
     midLine (float) : series float  Regression value at the last bar.
     slope (float) : series float  Slope per bar.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population (biased); false → sample.
  Returns: series float  √(σ²res / N_eff); uniform if Σw = 0.
 wLRTotVar(mu, sigma, weight, midLine, slope, length, biased) 
  Weighted Linear-Regression Total Variance **around the
window’s weighted mean μ**.
σ²_tot =  E_w    ⟶  *within-group variance*
+ Var_w   ⟶  *residual variance*
+ Var_w   ⟶  *trend variance*
where each bar i in the look-back window contributes
m_i   = *mean*      (e.g. 1-sec HL2)
σ_i   = *sigma*     (pre-estimated intrabar σ)
w_i   = *weight*    (volume, ticks, …)
ŷ_i   = b₀ + b₁·x   (value of the weighted LR line)
r_i   = m_i − ŷ_i   (orthogonal residual)
  Parameters:
     mu (float) : series float  Per-bar mean m_i.
     sigma (float) : series float  Pre-estimated σ_i of each bar.
     weight (float) : series float  Weight series w_i (≥ 0).
     midLine (float) : series float  Regression value at the latest bar (ŷₙ₋₁).
     slope (float) : series float  Slope b₁ of the regression line.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population; false → sample.
  Returns:  
varRes  series float  The residual variance component (σ²res).
varWtn  series float  The within-bar variance component (σ²wtn).
varTrd  series float  The trend variance component (σ²trd), explained by the linear regression.
sumW    series float  The sum of weights over the lookback period (Σw).
sumW2   series float  The sum of squared weights over the lookback period (Σw²).
 wLRTotStdDev(mu, sigma, weight, midLine, slope, length, biased) 
  Weighted Linear-Regression Total Standard Deviation.
  Parameters:
     mu (float) : series float  Per-bar mean m_i.
     sigma (float) : series float  Pre-estimated σ_i of each bar.
     weight (float) : series float  Weight series w_i (≥ 0).
     midLine (float) : series float  Regression value at the latest bar (ŷₙ₋₁).
     slope (float) : series float  Slope b₁ of the regression line.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population; false → sample.
  Returns: series float  √(σ²tot).
 wLRTotStdErr(mu, sigma, weight, midLine, slope, length, biased) 
  Weighted Linear-Regression Total Standard Error.
SE = √( σ²_tot / N_eff )  with N_eff = Σw² / Σw²  (like in wster()).
  Parameters:
     mu (float) : series float  Per-bar mean m_i.
     sigma (float) : series float  Pre-estimated σ_i of each bar.
     weight (float) : series float  Weight series w_i (≥ 0).
     midLine (float) : series float  Regression value at the latest bar (ŷₙ₋₁).
     slope (float) : series float  Slope b₁ of the regression line.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population; false → sample.
  Returns: series float  √((σ²res, σ²wtn, σ²trd) / N_eff).
 wLRLocTotStdDev(mu, sigma, weight, midLine, slope, length, biased) 
  Weighted Linear-Regression Local Total Standard Deviation.
Measures the total "noise" (within-bar + residual) around the trend.
  Parameters:
     mu (float) : series float  Per-bar mean m_i.
     sigma (float) : series float  Pre-estimated σ_i of each bar.
     weight (float) : series float  Weight series w_i (≥ 0).
     midLine (float) : series float  Regression value at the latest bar (ŷₙ₋₁).
     slope (float) : series float  Slope b₁ of the regression line.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population; false → sample.
  Returns: series float  √(σ²wtn + σ²res).
 wLRLocTotStdErr(mu, sigma, weight, midLine, slope, length, biased) 
  Weighted Linear-Regression Local Total Standard Error.
  Parameters:
     mu (float) : series float  Per-bar mean m_i.
     sigma (float) : series float  Pre-estimated σ_i of each bar.
     weight (float) : series float  Weight series w_i (≥ 0).
     midLine (float) : series float  Regression value at the latest bar (ŷₙ₋₁).
     slope (float) : series float  Slope b₁ of the regression line.
     length (int) : series int    Look-back length ≥ 2.
     biased (bool) : series bool   true → population; false → sample.
  Returns: series float  √((σ²wtn + σ²res) / N_eff).
 wLSma(source, weight, length) 
  Weighted Least Square Moving Average.
  Parameters:
     source (float) : series float   Data series.
     weight (float) : series float   Weight series.
     length (int) : series int     Look-back length ≥ 2.
  Returns: series float   Least square weighted mean. Falls back
to unweighted regression if Σw = 0.
PivotLiveLibrary   "PivotLive" 
 zigCore(lo, hi, d, dev, bs) 
  Parameters:
     lo (float) 
     hi (float) 
     d (int) 
     dev (int) 
     bs (int)
mysourcetypesncsLibrary   "mysourcetypes" 
Libreria personale per sorgenti estese (Close, Open, High, Low, Median, Typical, Weighted, Average, Average Median Body, Trend Biased, Trend Biased Extreme, Volume Body, Momentum Biased, Volatility Adjusted, Body Dominance, Shadow Biased, Gap Aware, Rejection Biased, Range Position, Adaptive Trend, Pressure Balanced, Impulse Wave)
 rclose() 
  Regular Close
  Returns: Close price
 ropen() 
  Regular Open
  Returns: Open price
 rhigh() 
  Regular High
  Returns: High price
 rlow() 
  Regular Low
  Returns: Low price
 rmedian() 
  Regular Median (HL2)
  Returns: (High + Low) / 2
 rtypical() 
  Regular Typical (HLC3)
  Returns: (High + Low + Close) / 3
 rweighted() 
  Regular Weighted (HLCC4)
  Returns: (High + Low + Close + Close) / 4
 raverage() 
  Regular Average (OHLC4)
  Returns: (Open + High + Low + Close) / 4
 ravemedbody() 
  Average Median Body
  Returns: (Open + Close) / 2
 rtrendb() 
  Trend Biased Regular
  Returns: Trend-weighted price
 rtrendbext() 
  Trend Biased Extreme
  Returns: Extreme trend-weighted price
 rvolbody() 
  Volume Weighted Body
  Returns: Body midpoint weighted by volume intensity
 rmomentum() 
  Momentum Biased
  Returns: Price biased towards momentum direction
 rvolatility() 
  Volatility Adjusted
  Returns: Price adjusted by candle's volatility
 rbodydominance() 
  Body Dominance
  Returns: Emphasizes body over wicks
 rshadowbias() 
  Shadow Biased
  Returns: Price biased by shadow length
 rgapaware() 
  Gap Aware
  Returns: Considers gap between candles
 rrejection() 
  Rejection Biased
  Returns: Emphasizes price rejection levels
 rrangeposition() 
  Range Position
  Returns: Where close sits within the candle range (0-100%)
 radaptivetrend() 
  Adaptive Trend
  Returns: Adapts based on recent trend strength
 rpressure() 
  Pressure Balanced
  Returns: Balances buying/selling pressure within candle
 rimpulse() 
  Impulse Wave
  Returns: Detects impulsive moves vs corrections
BossExoticMAs
   A next-generation moving average and smoothing library by TheStopLossBoss, featuring premium adaptive, exotic, and DSP-inspired filters — optimized for Pine Script® v6 and designed for Traders who demand precision and beauty.
> BossExoticMAs is a complete moving average and signal-processing toolkit built for Pine Script v6.
It combines the essential trend filters (SMA, EMA, WMA, etc.) with advanced, high-performance exotic types used by quants, algo designers, and adaptive systems.
Each function is precision-tuned for stability, speed, and visual clarity — perfect for building custom baselines, volatility filters, dynamic ribbons, or hybrid signal engines.
Includes built-in color gradient theming powered by the exclusive BossGradient — 
//Key Features
✅ Full Moving Average Set
SMA, EMA, ZEMA, WMA, HMA, WWMA, SMMA
DEMA, TEMA, T3 (Tillson)
ALMA, KAMA, LSMA
VMA, VAMA, FRAMA
✅ Signal Filters
One-Euro Filter (Crispin/Casiez implementation)
ATR-bounded Range Filter
✅ Color Engine
lerpColor() safe blending using color.from_gradient
Thematic gradient palettes: STOPLOSS, VAPORWAVE, ROYAL FLAME, MATRIX FLOW
Exclusive: BOSS GRADIENT 
✅ Helper Functions
Clamping, normalization, slope detection, tick delta
Slope-based dynamic color control via slopeThemeColor()
🧠 Usage Example
//@version=6
indicator("Boss Exotic MA Demo", overlay=true)
import TheStopLossBoss/BossExoticMAs/1 as boss
len  = input.int(50, "Length")
atype = input.string("T3", "MA Type",  options= )
t3factor = input.float(0.7, "T3 β", step=0.05)
smoothColor = boss.slopeThemeColor(close, "BOSS GRADIENT", 0.001)ma = boss.maSelect(close, len, atype, t3factor, 0.85, 14)
plot(ma, "Boss Exotic MA", color=smoothColor, linewidth=2)
---
🔑  Notes
Built exclusively for Pine Script® v6
Library designed for import use — all exports are prefixed cleanly (boss.functionName())
Some functions maintain internal state (var-based). Warnings are safe to ignore — adaptive design choice.
Each MA output is non-repainting and mathematically stable.
---
📜 Author
TheStopLossBoss
Designer of precision trading systems and custom adaptive algorithms.
Follow for exclusive releases, educational material, and full-stack trend solutions.
movingaverage, trend, adaptive, filter, volatility, smoothing, quant, technicalanalysis, bossgradient, t3, alma, frama, vma
livremySMATestLibLibrary   "livremySMATestLib" 
TODO: add library description here
 mySMA(x) 
  TODO: add function description here
  Parameters:
     x (int) : TODO: add parameter x description here
  Returns: TODO: add what function returns
SequencerLibraryLibrary   "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) :             The sequence object containing bullish and bearish setups.
     src (float) :                The source value (e.g., close price) used for evaluating sequence conditions.
     config (SequenceInputs) :      The user-defined settings for sequence analysis.
     condition (bool) :             When true, executes the sequence logic.
  Returns: 
 highlight(s, css, condition) 
  Highlights the bullish and bearish sequence setups and countdowns on the chart.
  Parameters:
     s (Sequence) :       The sequence object containing bullish and bearish sequence states.
     css (SequenceCSS) :    The styling configuration for customizing label appearances.
     condition (bool) :          When true, the function creates and displays labels for setups and countdowns.
  Returns: 
 SequenceState 
  A type representing the configuration and state of a sequence setup.
  Fields:
     setup (series int) :    Current count of the setup phase (e.g., how many bars have met the setup criteria).
     countdown (series int) :    Current count of the countdown phase (e.g., bars meeting countdown criteria).
     threshold (series float) :  The price threshold level used as support/resistance for the sequence.
     priceWhenCompleted (series float) :  The closing price when the setup or countdown phase is completed.
     indicatorWhenCompleted (series float) :  The indicator value when the setup or countdown phase is completed.
     setupCompleted (series bool) :   Indicates if the setup phase has been completed (i.e., reached the required count).
     countdownCompleted (series bool) :   Indicates if the countdown phase has been completed (i.e., reached exhaustion).
     perfected (series bool) :   Indicates if the setup meets the "perfected" condition (e.g., aligns with strict criteria).
     highlightSetup (series bool) :   Determines whether the setup phase should be visually highlighted on the chart.
     highlightCountdown (series 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) :  Configuration and state for bullish sequences.
     bearish (SequenceState) :  Configuration and state for bearish sequences.
 SequenceInputs 
  A type for user-configurable input settings for sequence-based analysis.
  Fields:
     showSetup (series bool) :    Enables or disables the display of setup sequences.
     showCountdown (series bool) :    Enables or disables the display of countdown sequences.
     setupFilter (series 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) :  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) :     Defines the lookback period for evaluating setup conditions (default: 4 bars).
     lookbackCountdown (series int) :     Defines the lookback period for evaluating countdown conditions (default: 2 bars).
     lookbackSetupPerfected (series int) :     Defines the lookback period to determine a perfected setup condition (default: 6 bars).
     maxSetup (series int) :     The maximum count required to complete a setup phase (default: 9).
     maxCountdown (series 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 used for bullish sequence labels.
     bearish (series color) :  Color used for bearish sequence labels.
     imperfect (series color) :  Color used for labels representing imperfect sequences.
AlertSenderLibrary_TradingFinderLibrary   "AlertSenderLibrary_TradingFinder" 
TODO: add library description here
 AlertSender(Condition, Alert, AlertName, AlertType, DetectionType, SetupData, Frequncy, UTC, MoreInfo, Message, o, h, l, c, Entry, TP, SL, Distal, Proximal) 
  Parameters:
     Condition (bool) 
     Alert (string) 
     AlertName (string) 
     AlertType (string) 
     DetectionType (string) 
     SetupData (string) 
     Frequncy (string) 
     UTC (string) 
     MoreInfo (string) 
     Message (string) 
     o (float) 
     h (float) 
     l (float) 
     c (float) 
     Entry (float) 
     TP (float) 
     SL (float) 
     Distal (float) 
     Proximal (float)
TA█ TA Library 
 📊 OVERVIEW 
 TA  is a Pine Script technical analysis library. This library provides  25+ moving averages and smoothing filters , from classic SMA/EMA to Kalman Filters and adaptive algorithms, implemented based on academic research.
 🎯 Core Features 
 
 Academic Based  - Algorithms follow original papers and formulas
 Performance Optimized  - Pre-calculated constants for faster response
 Unified Interface  - Consistent function design
 Research Based  - Integrates technical analysis research
 
 🎯 CONCEPTS 
 Library Design Philosophy 
This technical analysis library focuses on providing:
 Academic Foundation 
 
 Algorithms based on published research papers and academic standards
 Implementations that follow original mathematical formulations
 Clear documentation with research references
 
 Developer Experience 
 
 Unified interface design for consistent usage patterns
 Pre-calculated constants for optimal performance
 Comprehensive function collection to reduce development time
 Single import statement for immediate access to all functions
 Each indicator encapsulated as a simple function call - one line of code simplifies complexity
 
 Technical Excellence 
 
 25+ carefully implemented moving averages and filters
 Support for advanced algorithms like Kalman Filter and MAMA/FAMA
 Optimized code structure for maintainability and reliability
 Regular updates incorporating latest research developments
 
 🚀 USING THIS LIBRARY 
 Import Library 
 
//@version=6
import DCAUT/TA/1 as dta
indicator("Advanced Technical Analysis", overlay=true)
 
 Basic Usage Example 
 
// Classic moving average combination
ema20 = ta.ema(close, 20)
kama20 = dta.kama(close, 20)
plot(ema20, "EMA20", color.red, 2)
plot(kama20, "KAMA20", color.green, 2)
 
 Advanced Trading System 
 
// Adaptive moving average system
kama = dta.kama(close, 20, 2, 30)
  = dta.mamaFama(close, 0.5, 0.05)
// Trend confirmation and entry signals
bullTrend = kama > kama  and mamaValue > famaValue
bearTrend = kama < kama  and mamaValue < famaValue
longSignal = ta.crossover(close, kama) and bullTrend
shortSignal = ta.crossunder(close, kama) and bearTrend
plot(kama, "KAMA", color.blue, 3)
plot(mamaValue, "MAMA", color.orange, 2)
plot(famaValue, "FAMA", color.purple, 2)
plotshape(longSignal, "Buy", shape.triangleup, location.belowbar, color.green)
plotshape(shortSignal, "Sell", shape.triangledown, location.abovebar, color.red)
 
 📋 FUNCTIONS REFERENCE 
 ewma(source, alpha) 
Calculates the Exponentially Weighted Moving Average with dynamic alpha parameter.
Parameters:
   source (series float) : Series of values to process.
   alpha (series float) : The smoothing parameter of the filter.
Returns: (float) The exponentially weighted moving average value.
 dema(source, length) 
Calculates the Double Exponential Moving Average (DEMA) of a given data series.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Double Exponential Moving Average value.
 tema(source, length) 
Calculates the Triple Exponential Moving Average (TEMA) of a given data series.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Triple Exponential Moving Average value.
 zlema(source, length) 
Calculates the Zero-Lag Exponential Moving Average (ZLEMA) of a given data series. This indicator attempts to eliminate the lag inherent in all moving averages.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Zero-Lag Exponential Moving Average value.
 tma(source, length) 
Calculates the Triangular Moving Average (TMA) of a given data series. TMA is a double-smoothed simple moving average that reduces noise.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Triangular Moving Average value.
 frama(source, length) 
Calculates the Fractal Adaptive Moving Average (FRAMA) of a given data series. FRAMA adapts its smoothing factor based on fractal geometry to reduce lag. Developed by John Ehlers.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Fractal Adaptive Moving Average value.
 kama(source, length, fastLength, slowLength) 
Calculates Kaufman's Adaptive Moving Average (KAMA) of a given data series. KAMA adjusts its smoothing based on market efficiency ratio. Developed by Perry J. Kaufman.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the efficiency calculation.
   fastLength (simple int) : Fast EMA length for smoothing calculation. Optional. Default is 2.
   slowLength (simple int) : Slow EMA length for smoothing calculation. Optional. Default is 30.
Returns: (float) The calculated Kaufman's Adaptive Moving Average value.
 t3(source, length, volumeFactor) 
Calculates the Tilson Moving Average (T3) of a given data series. T3 is a triple-smoothed exponential moving average with improved lag characteristics. Developed by Tim Tillson.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the moving average calculation.
   volumeFactor (simple float) : Volume factor affecting responsiveness. Optional. Default is 0.7.
Returns: (float) The calculated Tilson Moving Average value.
 ultimateSmoother(source, length) 
Calculates the Ultimate Smoother of a given data series. Uses advanced filtering techniques to reduce noise while maintaining responsiveness. Based on digital signal processing principles by John Ehlers.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the smoothing calculation.
Returns: (float) The calculated Ultimate Smoother value.
 kalmanFilter(source, processNoise, measurementNoise) 
Calculates the Kalman Filter of a given data series. Optimal estimation algorithm that estimates true value from noisy observations. Based on the Kalman Filter algorithm developed by Rudolf Kalman (1960).
Parameters:
   source (series float) : Series of values to process.
   processNoise (simple float) : Process noise variance (Q). Controls adaptation speed. Optional. Default is 0.05.
   measurementNoise (simple float) : Measurement noise variance (R). Controls smoothing. Optional. Default is 1.0.
Returns: (float) The calculated Kalman Filter value.
 mcginleyDynamic(source, length) 
Calculates the McGinley Dynamic of a given data series. McGinley Dynamic is an adaptive moving average that adjusts to market speed changes. Developed by John R. McGinley Jr.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the dynamic calculation.
Returns: (float) The calculated McGinley Dynamic value.
 mama(source, fastLimit, slowLimit) 
Calculates the Mesa Adaptive Moving Average (MAMA) of a given data series. MAMA uses Hilbert Transform Discriminator to adapt to market cycles dynamically. Developed by John F. Ehlers.
Parameters:
   source (series float) : Series of values to process.
   fastLimit (simple float) : Maximum alpha (responsiveness). Optional. Default is 0.5.
   slowLimit (simple float) : Minimum alpha (smoothing). Optional. Default is 0.05.
Returns: (float) The calculated Mesa Adaptive Moving Average value.
 fama(source, fastLimit, slowLimit) 
Calculates the Following Adaptive Moving Average (FAMA) of a given data series. FAMA follows MAMA with reduced responsiveness for crossover signals. Developed by John F. Ehlers.
Parameters:
   source (series float) : Series of values to process.
   fastLimit (simple float) : Maximum alpha (responsiveness). Optional. Default is 0.5.
   slowLimit (simple float) : Minimum alpha (smoothing). Optional. Default is 0.05.
Returns: (float) The calculated Following Adaptive Moving Average value.
 mamaFama(source, fastLimit, slowLimit) 
Calculates Mesa Adaptive Moving Average (MAMA) and Following Adaptive Moving Average (FAMA).
Parameters:
   source (series float) : Series of values to process.
   fastLimit (simple float) : Maximum alpha (responsiveness). Optional. Default is 0.5.
   slowLimit (simple float) : Minimum alpha (smoothing). Optional. Default is 0.05.
Returns: ( ) Tuple containing   values.
 laguerreFilter(source, length, gamma, order) 
Calculates the standard N-order Laguerre Filter of a given data series. Standard Laguerre Filter uses uniform weighting across all polynomial terms. Developed by John F. Ehlers.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Length for UltimateSmoother preprocessing.
   gamma (simple float) : Feedback coefficient (0-1). Lower values reduce lag. Optional. Default is 0.8.
   order (simple int) : The order of the Laguerre filter (1-10). Higher order increases lag. Optional. Default is 8.
Returns: (float) The calculated standard Laguerre Filter value.
 laguerreBinomialFilter(source, length, gamma) 
Calculates the Laguerre Binomial Filter of a given data series. Uses 6-pole feedback with binomial weighting coefficients. Developed by John F. Ehlers.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Length for UltimateSmoother preprocessing.
   gamma (simple float) : Feedback coefficient (0-1). Lower values reduce lag. Optional. Default is 0.5.
Returns: (float) The calculated Laguerre Binomial Filter value.
 superSmoother(source, length) 
Calculates the Super Smoother of a given data series. SuperSmoother is a second-order Butterworth filter from aerospace technology. Developed by John F. Ehlers.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Period for the filter calculation.
Returns: (float) The calculated Super Smoother value.
 rangeFilter(source, length, multiplier) 
Calculates the Range Filter of a given data series. Range Filter reduces noise by filtering price movements within a dynamic range.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the average range calculation.
   multiplier (simple float) : Multiplier for the smooth range. Higher values increase filtering. Optional. Default is 2.618.
Returns: ( ) Tuple containing filtered value, trend direction, upper band, and lower band.
 qqe(source, rsiLength, rsiSmooth, qqeFactor) 
Calculates the Quantitative Qualitative Estimation (QQE) of a given data series. QQE is an improved RSI that reduces noise and provides smoother signals. Developed by Igor Livshin.
Parameters:
   source (series float) : Series of values to process.
   rsiLength (simple int) : Number of bars for the RSI calculation. Optional. Default is 14.
   rsiSmooth (simple int) : Number of bars for smoothing the RSI. Optional. Default is 5.
   qqeFactor (simple float) : QQE factor for volatility band width. Optional. Default is 4.236.
Returns: ( ) Tuple containing smoothed RSI and QQE trend line.
 sslChannel(source, length) 
Calculates the Semaphore Signal Level (SSL) Channel of a given data series. SSL Channel provides clear trend signals using moving averages of high and low prices.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the moving average calculation.
Returns: ( ) Tuple containing SSL Up and SSL Down lines.
 ma(source, length, maType) 
Calculates a Moving Average based on the specified type. Universal interface supporting all moving average algorithms.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : Number of bars for the moving average calculation.
   maType (simple MaType) : Type of moving average to calculate. Optional. Default is SMA.
Returns: (float) The calculated moving average value based on the specified type.
 atr(length, maType) 
Calculates the Average True Range (ATR) using the specified moving average type. Developed by J. Welles Wilder Jr.
Parameters:
   length (simple int) : Number of bars for the ATR calculation.
   maType (simple MaType) : Type of moving average to use for smoothing. Optional. Default is RMA.
Returns: (float) The calculated Average True Range value.
 macd(source, fastLength, slowLength, signalLength, maType, signalMaType) 
Calculates the Moving Average Convergence Divergence (MACD) with customizable MA types. Developed by Gerald Appel.
Parameters:
   source (series float) : Series of values to process.
   fastLength (simple int) : Period for the fast moving average.
   slowLength (simple int) : Period for the slow moving average.
   signalLength (simple int) : Period for the signal line moving average.
   maType (simple MaType) : Type of moving average for main MACD calculation. Optional. Default is EMA.
   signalMaType (simple MaType) : Type of moving average for signal line calculation. Optional. Default is EMA.
Returns: ( ) Tuple containing MACD line, signal line, and histogram values.
 dmao(source, fastLength, slowLength, maType) 
Calculates the Dual Moving Average Oscillator (DMAO) of a given data series. Uses the same algorithm as the Percentage Price Oscillator (PPO), but can be applied to any data series.
Parameters:
   source (series float) : Series of values to process.
   fastLength (simple int) : Period for the fast moving average.
   slowLength (simple int) : Period for the slow moving average.
   maType (simple MaType) : Type of moving average to use for both calculations. Optional. Default is EMA.
Returns: (float) The calculated Dual Moving Average Oscillator value as a percentage.
 continuationIndex(source, length, gamma, order) 
Calculates the Continuation Index of a given data series. The index represents the Inverse Fisher Transform of the normalized difference between an UltimateSmoother and an N-order Laguerre filter. Developed by John F. Ehlers, published in TASC 2025.09.
Parameters:
   source (series float) : Series of values to process.
   length (simple int) : The calculation length.
   gamma (simple float) : Controls the phase response of the Laguerre filter. Optional. Default is 0.8.
   order (simple int) : The order of the Laguerre filter (1-10). Optional. Default is 8.
Returns: (float) The calculated Continuation Index value.
 📚 RELEASE NOTES 
 v1.0 (2025.09.24) 
 
 ✅ 25+ technical analysis functions
 ✅ Complete adaptive moving average series (KAMA, FRAMA, MAMA/FAMA)
 ✅ Advanced signal processing filters (Kalman, Laguerre, SuperSmoother, UltimateSmoother)
 ✅ Performance optimized with pre-calculated constants and efficient algorithms
 ✅ Unified function interface design following TradingView best practices
 ✅ Comprehensive moving average collection (DEMA, TEMA, ZLEMA, T3, etc.)
 ✅ Volatility and trend detection tools (QQE, SSL Channel, Range Filter)
 ✅ Continuation Index - Latest research from TASC 2025.09
 ✅ MACD and ATR calculations supporting multiple moving average types
 ✅ Dual Moving Average Oscillator (DMAO) for arbitrary data series analysis
tclibLibrary   "tclib" 
 super_smoother(data, smoothing_period) 
  Parameters:
     data (float) 
     smoothing_period (int)
Adaptive FoS LibraryThis library provides Adaptive Functions that I use in my scripts. For calculations, I use the max_bars_back function with a fixed length of 200 bars to prevent errors when a script tries to access data beyond its available history. This is a key difference from most other adaptive libraries — if you don’t need it, you don’t have to use it.
Some of the adaptive length functions are normalized. In addition to the adaptive length functions, this library includes various methods for calculating moving averages, normalized differences between fast and slow MA's, as well as several normalized oscillators.
SessionRangeLibraryLibrary   "SessionRangeLibrary" 
TODO: add library description here
 update(session) 
  Parameters:
     session (string) 
 Data 
  Fields:
     drh (series float) 
     drl (series float) 
     idrh (series float) 
     idrl (series float) 
     mid (series float)
CoreJuice001Library   "CoreJuice001" 
 DrawingData 
  Fields:
     kzone1Boxes (array) 
     kzone2Boxes (array) 
     kzone3Boxes (array) 
     kzone4Boxes (array) 
     kzone5Boxes (array) 
     kzone6Boxes (array) 
     kzone1Labels (array) 
     kzone2Labels (array) 
     kzone3Labels (array) 
     kzone4Labels (array) 
     kzone5Labels (array) 
     kzone6Labels (array) 
     kzone1TrendLines (array) 
     kzone2TrendLines (array) 
     kzone3TrendLines (array) 
     kzone4TrendLines (array) 
     kzone5TrendLines (array) 
     kzone6TrendLines (array) 
     kzone1PriceLabels (array) 
     kzone2PriceLabels (array) 
     kzone3PriceLabels (array) 
     kzone4PriceLabels (array) 
     kzone5PriceLabels (array) 
     kzone6PriceLabels (array)
PulseLogicLibPulseLogicLib v3.6.1
PulseLogic breath-strength & momentum-structure calculator
Exports:
• getBreathScore() → int (0–100)
• hasGreenDot() → bool
• getTriangleColor() → string (“green”/“red”/“none”)
PulseLinesLibPulseLinesLib v1.3.1  
PulseLines morphic-level calculator (support & resistance)
Exports:
• getLevels(lookback:int, wickRatioThresh:float, flatCandles:int, tolerancePips:float, atrMult:float) → float  
PivotLibrary222Library   "PivotLibrary222" 
 f_determinePivotStrength(_pivotCandidateRelativeIndex, _type, _maxStrength) 
  Determines the strength of a pivot (low or high).
  Parameters:
     _pivotCandidateRelativeIndex (int) : The relative bar index of the pivot candidate.
     _type (string) : "low" for a pivot low, "high" for a pivot high.
     _maxStrength (int) : The maximum number of bars to check on either side for strength.
  Returns: An array containing  .
 f_getPlotColorForStrength(_strength) 
  Gets a plotting color based on pivot strength.
  Parameters:
     _strength (int) : The calculated pivot strength.
  Returns: A color for plotting.
 f_updateExistingPivotLow(f_pivotLows, f_pivotLowInfoIndex, f_newStrength, f_showLabels) 
  Updates an existing pivot LOW's strength and its corresponding chart label.
  Parameters:
     f_pivotLows (array) : The array of pivotLowInfo objects.
     f_pivotLowInfoIndex (int) : The index of the pivot to update in the array.
     f_newStrength (int) : The new (increased) strength of the pivot.
     f_showLabels (bool) : A boolean to control if labels should be updated.
 f_updateExistingPivotHigh(f_pivotHighs, f_pivotHighInfoIndex, f_newStrength, f_showLabels) 
  Updates an existing pivot HIGH's strength and its corresponding chart label.
  Parameters:
     f_pivotHighs (array) : The array of pivotHighInfo objects.
     f_pivotHighInfoIndex (int) : The index of the pivot to update in the array.
     f_newStrength (int) : The new (increased) strength of the pivot.
     f_showLabels (bool) : A boolean to control if labels should be updated.
 f_findPivotLows(f_pivotLows, f_minStrength, f_maxStrength, f_showLabels) 
  Finds and processes pivot lows.
  Parameters:
     f_pivotLows (array) : The array of pivotLowInfo objects to read from and modify.
     f_minStrength (int) : Minimum strength required for a new pivot to be recorded.
     f_maxStrength (int) : Maximum strength to search for when determining pivot strength.
     f_showLabels (bool) : A boolean to control if new labels should be created.
 f_findPivotHighs(f_pivotHighs, f_minStrength, f_maxStrength, f_showLabels) 
  Finds and processes pivot highs.
  Parameters:
     f_pivotHighs (array) : The array of pivotHighInfo objects to read from and modify.
     f_minStrength (int) : Minimum strength required for a new pivot to be recorded.
     f_maxStrength (int) : Maximum strength to search for when determining pivot strength.
     f_showLabels (bool) : A boolean to control if new labels should be created.
 pivotHighInfo 
  Represents a detected pivot high.
  Fields:
     abs_index (series int) 
     price (series float) 
     strength (series int) 
     label_id (series label) 
 pivotLowInfo 
  Represents a detected pivot low.
  Fields:
     abs_index (series int) 
     price (series float) 
     strength (series int) 
     label_id (series label)
LiliALHUNTERSystem_v2📚 **Library: LiliALHUNTERSystem_v2**
This library provides a powerful target management system for Pine Script developers.  
It includes advanced calculators for EMA, RMA, and Supertrend, and introduces a central `createTargets()` function to dynamically render target lines and labels based on long/short trade logic.
🛠️ **Main Features:**
– Dynamic horizontal & vertical target lines  
– Dual target configuration (Target 1 & Target 2)  
– Directional logic via `isLong1`, `isLong2`  
– Integrated Supertrend validation  
– Visual dashboard and label display  
– Works seamlessly with custom indicators
🎯 **Purpose:**  
The `LiliALHUNTERSystem_v2` Library enables Pine coders to manage and visualize targets consistently across all trading strategies and indicators. It simplifies target logic while maintaining visual clarity and modular usage.
⚠️ **Disclaimer:**  
This script is intended for educational and analytical purposes only. It does not constitute financial advice.
Library   "LiliALHUNTERSystem_v2" 
 ema_calc(len, source) 
  Parameters:
     len (simple int) 
     source (float) 
 rma_calc(len, source) 
  Parameters:
     len (simple int) 
     source (float) 
 supertrend_calc(length, factor) 
  Parameters:
     length (simple int) 
     factor (float) 
 createTargets(config, state, source1A, source1B, source2A, source2B) 
  Parameters:
     config (TargetConfig) 
     state (TargetState) 
     source1A (float) 
     source1B (float) 
     source2A (float) 
     source2B (float) 
 showDashboard(state, dashLoc, textSize) 
  Parameters:
     state (TargetState) 
     dashLoc (string) 
     textSize (string) 
 TargetConfig 
  Fields:
     enableTarget1 (series bool) 
     enableTarget2 (series bool) 
     isLong1 (series bool) 
     isLong2 (series bool) 
     target1Condition (series string) 
     target2Condition (series string) 
     target1Color (series color) 
     target2Color (series color) 
     target1Style (series string) 
     target2Style (series string) 
     distTarget1 (series float) 
     distTarget2 (series float) 
     distOptions1 (series string) 
     distOptions2 (series string) 
     showLabels (series bool) 
     showDash (series bool) 
 TargetState 
  Fields:
     target1LineV (series line) 
     target1LineH (series line) 
     target2LineV (series line) 
     target2LineH (series line) 
     target1Lbl (series label) 
     target2Lbl (series label) 
     target1Active (series bool) 
     target2Active (series bool) 
     target1Value (series float) 
     target2Value (series float) 
     countTargets1 (series int) 
     countTgReached1 (series int) 
     countTargets2 (series int) 
     countTgReached2 (series int)
FastMetrixLibrary   "FastMetrix" 
This is a library I've been tweaking and working with for a while and I find it useful to get valuable technical analysis metrics faster (why its called FastMetrix). A lot of is personal to my trading style, so sorry if it does not have everything you want. The way I get my variables from library to script is by copying the return function into my new script.
TODO: Volatility and short term price analysis functions
 slope(source, smoothing) 
  Parameters:
     source (float) 
     smoothing (int) 
 integral(topfunction, bottomfunction, start, end) 
  Parameters:
     topfunction (float) 
     bottomfunction (float) 
     start (int) 
     end (int) 
 deviation(x, y) 
  Parameters:
     x (float) 
     y (float) 
 getema(len) 
  TODO: return important exponential long term moving averages and derivatives/variables
  Parameters:
     len (simple int) 
 getsma(len) 
  TODO: return requested sma
  Parameters:
     len (int) 
 kc(mult, len) 
  TODO: Return Keltner Channels variables and calculations
  Parameters:
     mult (simple float) 
     len (simple int) 
 bollinger(len, mult) 
  TODO: returns bollinger bands with optimal settings
  Parameters:
     len (int) 
     mult (simple float) 
 volatility(atrlen, smoothing) 
  TODO: Returns volatility indicators based on atr
  Parameters:
     atrlen (simple int) 
     smoothing (int) 
 premarketfib() 
 countinday(xcondition) 
  Parameters:
     xcondition (bool) 
 countinsession(condition, n) 
  Parameters:
     condition (bool) 
     n (int)
RifleShooterLibLibrary   "RifleShooterLib" 
Provides a collection of helper functions in support of the Rifle Shooter Indicators.
Functions support the key components of the Rifle Trade algorithm including
* measuring momentum
* identifying paraboloic price action (to disable the algorthim during such time)
* determine the lookback criteria of X point movement in last N minutes
* processing and navigating between the 23/43/73 levels
* maintaining a status table of algorithm progress
 toStrRnd(val, digits) 
  Parameters:
     val (float) 
     digits (int) 
 _isValidTimeRange(startTimeInput, endTimeInput) 
  Parameters:
     startTimeInput (string) 
     endTimeInput (string) 
 _normalize(_src, _min, _max) 
  _normalize Normalizes series with unknown min/max using historical min/max.
  Parameters:
     _src (float) : Source series to normalize
     _min (float) : minimum value of the rescaled series
     _max (float) : maximum value of the rescaled series
  Returns: The series scaled with values between min and max
 arrayToSeries(arrayInput) 
  arrayToSeries Return an array from the provided series.
  Parameters:
     arrayInput (array) : Source array to convert to a series
  Returns: The array as a series datatype
 f_parabolicFiltering(_activeCount, long, shooterRsi, shooterRsiLongThreshold, shooterRsiShortThreshold, fiveMinuteRsi, fiveMinRsiLongThreshold, fiveMinRsiShortThreshold, shooterRsiRoc, shooterRsiRocLongThreshold, shooterRsiRocShortThreshold, quickChangeLookbackBars, quckChangeThreshold, curBarChangeThreshold, changeFromPrevBarThreshold, maxBarsToholdParabolicMoveActive, generateLabels) 
  f_parabolicFiltering Return true when price action indicates a parabolic active movement based on the provided inputs and thresholds.
  Parameters:
     _activeCount (int) 
     long (bool) 
     shooterRsi (float) 
     shooterRsiLongThreshold (float) 
     shooterRsiShortThreshold (float) 
     fiveMinuteRsi (float) 
     fiveMinRsiLongThreshold (float) 
     fiveMinRsiShortThreshold (float) 
     shooterRsiRoc (float) 
     shooterRsiRocLongThreshold (float) 
     shooterRsiRocShortThreshold (float) 
     quickChangeLookbackBars (int) 
     quckChangeThreshold (int) 
     curBarChangeThreshold (int) 
     changeFromPrevBarThreshold (int) 
     maxBarsToholdParabolicMoveActive (int) 
     generateLabels (bool) 
 rsiValid(rsi, buyThreshold, sellThreshold) 
  rsiValid Returns true if the provided RSI value is withing the associated threshold. For the unused threshold set it to na
  Parameters:
     rsi (float) 
     buyThreshold (float) 
     sellThreshold (float) 
 squezeBands(source, length) 
  squezeBands Returns the squeeze bands momentum color of current source series input
  Parameters:
     source (float) 
     length (int) 
 f_momentumOscilator(source, length, transperency) 
  f_momentumOscilator Returns the squeeze pro momentum value and bar color states of the series input
  Parameters:
     source (float) 
     length (int) 
     transperency (int) 
 f_getLookbackExtreme(lowSeries, highSeries, lbBars, long) 
  f_getLookbackExtreme Return the highest high or lowest low over the look back window
  Parameters:
     lowSeries (float) 
     highSeries (float) 
     lbBars (int) 
     long (bool) 
 f_getInitialMoveTarget(lbExtreme, priveMoveOffset, long) 
  f_getInitialMoveTarget Return the point delta required to achieve an initial rifle move (X points over Y lookback)
  Parameters:
     lbExtreme (float) 
     priveMoveOffset (int) 
     long (bool) 
 isSymbolSupported(sym) 
  isSymbolSupported Return true if provided symbol is one of the supported DOW Rifle Indicator symbols
  Parameters:
     sym (string) 
 getBasePrice(price) 
  getBasePrice Returns integer portion of provided float
  Parameters:
     price (float) 
 getLastTwoDigitsOfPrice(price) 
  getBasePrice Returns last two integer numerals of provided float value
  Parameters:
     price (float) 
 getNextLevelDown(price, lowestLevel, middleLevel, highestLevel) 
  getNextLevelDown Returns the next level above the provided price value
  Parameters:
     price (float) 
     lowestLevel (float) 
     middleLevel (float) 
     highestLevel (float) 
 getNextLevelUp(price, lowestLevel, middleLevel, highestLevel) 
  getNextLevelUp Returns the next level below the provided price value
  Parameters:
     price (float) 
     lowestLevel (float) 
     middleLevel (float) 
     highestLevel (float) 
 isALevel(price, lowestLevel, middleLevel, highestLevel) 
  isALevel Returns true if the provided price is onve of the specified levels
  Parameters:
     price (float) 
     lowestLevel (float) 
     middleLevel (float) 
     highestLevel (float) 
 getClosestLevel(price, lowestLevel, middleLevel, highestLevel) 
  getClosestLevel Returns the level closest to the price value provided
  Parameters:
     price (float) 
     lowestLevel (float) 
     middleLevel (float) 
     highestLevel (float) 
 f_fillSetupTableCell(_table, _col, _row, _text, _bgcolor, _txtcolor, _text_size) 
  f_fillSetupTableCell Helper function to fill a setup table celll
  Parameters:
     _table (table) 
     _col (int) 
     _row (int) 
     _text (string) 
     _bgcolor (color) 
     _txtcolor (color) 
     _text_size (string) 
 f_fillSetupTableRow(_table, _row, _col0Str, _col1Str, _col2Str, _bgcolor, _textColor, _textSize) 
  f_fillSetupTableRow Helper function to fill a setup table row
  Parameters:
     _table (table) 
     _row (int) 
     _col0Str (string) 
     _col1Str (string) 
     _col2Str (string) 
     _bgcolor (color) 
     _textColor (color) 
     _textSize (string) 
 f_addBlankRow(_table, _row) 
  f_addBlankRow Helper function to fill a setup table row with empty values
  Parameters:
     _table (table) 
     _row (int) 
 f_updateVersionTable(versionTable, versionStr, versionDateStr) 
  f_updateVersionTable Helper function to fill the version table with provided values
  Parameters:
     versionTable (table) 
     versionStr (string) 
     versionDateStr (string) 
 f_updateSetupTable(_table, parabolicMoveActive, initialMoveTargetOffset, initialMoveAchieved, shooterRsi, shooterRsiValid, rsiRocEnterThreshold, shooterRsiRoc, fiveMinuteRsi, fiveMinuteRsiValid, requireValid5MinuteRsiForEntry, stallLevelOffset, stallLevelExceeded, stallTargetOffset, recoverStallLevelValid, curBarChangeValid, volumeRoc, volumeRocThreshold, enableVolumeRocForTrigger, tradeActive, entryPrice, curCloseOffset, curSymCashDelta, djiCashDelta, showDjiDelta, longIndicator, fontSize) 
  f_updateSetupTable Manages writing current data to the setup table
  Parameters:
     _table (table) 
     parabolicMoveActive (bool) 
     initialMoveTargetOffset (float) 
     initialMoveAchieved (bool) 
     shooterRsi (float) 
     shooterRsiValid (bool) 
     rsiRocEnterThreshold (float) 
     shooterRsiRoc (float) 
     fiveMinuteRsi (float) 
     fiveMinuteRsiValid (bool) 
     requireValid5MinuteRsiForEntry (bool) 
     stallLevelOffset (float) 
     stallLevelExceeded (bool) 
     stallTargetOffset (float) 
     recoverStallLevelValid (bool) 
     curBarChangeValid (bool) 
     volumeRoc (float) 
     volumeRocThreshold (float) 
     enableVolumeRocForTrigger (bool) 
     tradeActive (bool) 
     entryPrice (float) 
     curCloseOffset (float) 
     curSymCashDelta (float) 
     djiCashDelta (float) 
     showDjiDelta (bool) 
     longIndicator (bool) 
     fontSize (string)






















