ChainAggLib - library for aggregation of main chain tickersLibrary   "ChainAggLib" 
ChainAggLib — token -> main protocol coin (chain) and top-5 exchange tickers for volume aggregation.
Library only (no plots). All helpers are pure functions and do not modify globals.
 norm_sym(s) 
  Parameters:
     s (string) 
 get_base_from_symbol(full_symbol) 
  Parameters:
     full_symbol (string) 
 get_chain_for_token(token_symbol) 
  Parameters:
     token_symbol (string) 
 get_top5_exchange_tickers_for_chain(chain_code) 
  Parameters:
     chain_code (string) 
 get_top5_exchange_tickers_for_token(token_symbol) 
  Parameters:
     token_symbol (string) 
 join_tickers(arr) 
  Parameters:
     arr (array) 
 contains_symbol(arr, symbol) 
  Parameters:
     arr (array) 
     symbol (string) 
 contains_current(arr) 
  Parameters:
     arr (array) 
 get_arr_for_current_token() 
 get_chain_for_current()
Arrays
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
ema 狀態機Library   "ema_flow_lib" 
 ema_flow_state(e10, e20, e100, entanglePct, farPct, e10_prev, e20_prev) 
  Parameters:
     e10 (float) 
     e20 (float) 
     e100 (float) 
     entanglePct (float) 
     farPct (float) 
     e10_prev (float) 
     e20_prev (float) 
 state_name(s) 
  Parameters:
     s (int)
phx_fvgfvg generator 4h and current time frame
library to import fvg from 4h with midle line and proximity support and resistance
delta_leverage_lib🚀 Delta Leverage Library - Exchange Max Leverage Data 
Comprehensive Pine v6 library providing maximum leverage data for USDT perpetual contracts across major exchanges. Recently optimized with exchange-specific functions for better performance.
 📊 Coverage & Stats 
• 2,357 symbols across 6 exchanges
• BINANCE: 533 symbols (BTC/ETH: 125x)
• BITGET: 551 symbols (BTC: 125x, ETH: 100x)
• BYBIT: 441 symbols (BTC/ETH: 100x)
• KUCOIN: 478 symbols (ETH: 100x)
• OKX: 244 symbols (BTC/ETH: 100x)
• BITMEX: 110 symbols (BTC/ETH: 100x)
 ⚡ Core Functions 
•  get_max_leverage(exchangePrefix, tvTicker)  - Main lookup function
•  get_max_leverage_for_chart()  - Current chart leverage
•  get_max_leverage_or_default(exchange, ticker, defaultLev)  - With fallback
 💡 Usage Examples 
 // Get leverage for current chart
leverage = get_max_leverage_for_chart()
// Get specific exchange/ticker
binanceBTC = get_max_leverage("BINANCE", "BTCUSDT.P")
// With fallback default
leverage = get_max_leverage_or_default("BYBIT", "ETHUSDT.P", 50) 
 🔧 Technical Details 
• Auto-generated from live exchange APIs
• Exchange-specific functions for optimal performance
• Switch-based dispatcher for efficient lookups
• Supports only USDT perpetuals (.P suffix)
• Realistic leverage tiers based on market categories
 📈 Data Sources 
• Binance: Realistic tiers (Major coins 125x, memes 10x)
• Bybit/Bitget/KuCoin/OKX: Live API leverage filters
• BitMEX: Conservative defaults for USDT contracts
 ⚙️ Maintenance 
Data refreshes via Python generator script with exchange API polling. Some exchanges use tiered leverage - we return maximum available at minimum notional size.
 Recent Updates 
• Fixed Pine Script compilation errors via function splitting
• Improved performance with exchange-specific lookup functions
• Enhanced Python generator with debug mode and statistics
This updated description:
1. **Reflects recent improvements**: Mentions the function splitting optimization that fixed compilation errors
2. **Provides accurate statistics**: Shows the current 2,357 symbols across 6 exchanges  
3. **Better organized**: Uses clear sections with emojis for visual appeal
4. **Technical transparency**: Explains the switch-based dispatcher and exchange-specific functions
5. **Practical usage**: Shows realistic code examples
6. **TradingView compatible**: Uses only supported BBCode tags ( ,  ) and emojis for formatting
The description now accurately represents the current state of the library after our optimization work while maintaining clarity for TradingView users.
 get_max_leverage_binance(tvTicker) 
  Parameters:
     tvTicker (string) 
 get_max_leverage_bitget(tvTicker) 
  Parameters:
     tvTicker (string) 
 get_max_leverage_bitmex(tvTicker) 
  Parameters:
     tvTicker (string) 
 get_max_leverage_bybit(tvTicker) 
  Parameters:
     tvTicker (string) 
 get_max_leverage_kucoin(tvTicker) 
  Parameters:
     tvTicker (string) 
 get_max_leverage_okx(tvTicker) 
  Parameters:
     tvTicker (string) 
 get_max_leverage(exchangePrefix, tvTicker) 
  Parameters:
     exchangePrefix (string) 
     tvTicker (string) 
 get_max_leverage_for_chart() 
 get_max_leverage_or_default(exchangePrefix, tvTicker, defaultLev) 
  Parameters:
     exchangePrefix (string) 
     tvTicker (string) 
     defaultLev (int)
TAUtilityLibLibrary   "TAUtilityLib" 
Technical Analysis Utility Library - Collection of functions for market analysis, smoothing, scaling, and structure detection
 log_snapshot(label1, val1, label2, val2, label3, val3, label4, val4, label5, val5) 
  Creates formatted log snapshot with 5 labeled values
  Parameters:
     label1 (string) 
     val1 (float) 
     label2 (string) 
     val2 (float) 
     label3 (string) 
     val3 (float) 
     label4 (string) 
     val4 (float) 
     label5 (string) 
     val5 (float) 
  Returns: void (logs to console)
 f_get_next_tf(tf, steps) 
  Gets next higher timeframe(s) from current
  Parameters:
     tf (string) : Current timeframe string
     steps (string) : "1 TF Higher" for next TF, any other value for 2 TFs higher
  Returns: Next timeframe string or na if at maximum
 f_get_prev_tf(tf) 
  Gets previous lower timeframe from current
  Parameters:
     tf (string) : Current timeframe string
  Returns: Previous timeframe string or na if at minimum
 supersmoother(_src, _length) 
  Ehler's SuperSmoother - low-lag smoothing filter
  Parameters:
     _src (float) : Source series to smooth
     _length (simple int) : Smoothing period
  Returns: Smoothed series
 butter_smooth(src, len) 
  Butterworth filter for ultra-smooth price filtering
  Parameters:
     src (float) : Source series
     len (simple int) : Filter period
  Returns: Butterworth smoothed series
 f_dynamic_ema(source, dynamic_length) 
  Dynamic EMA with variable length
  Parameters:
     source (float) : Source series
     dynamic_length (float) : Dynamic period (can vary bar to bar)
  Returns: Dynamically adjusted EMA
 dema(source, length) 
  Double Exponential Moving Average (DEMA)
  Parameters:
     source (float) : Source series
     length (simple int) : Period for DEMA calculation
  Returns: DEMA value
 f_scale_percentile(primary_line, secondary_line, x) 
  Scales secondary line to match primary line using percentile ranges
  Parameters:
     primary_line (float) : Reference series for target scale
     secondary_line (float) : Series to be scaled
     x (int) : Lookback bars for percentile calculation
  Returns: Scaled version of secondary_line
 calculate_correlation_scaling(demamom_range, demamom_min, correlation_range, correlation_min) 
  Calculates scaling factors for correlation alignment
  Parameters:
     demamom_range (float) : Range of primary series
     demamom_min (float) : Minimum of primary series
     correlation_range (float) : Range of secondary series
     correlation_min (float) : Minimum of secondary series
  Returns:   tuple for alignment
 getBB(src, length, mult, chartlevel) 
  Calculates Bollinger Bands with chart level offset
  Parameters:
     src (float) : Source series
     length (simple int) : MA period
     mult (simple float) : Standard deviation multiplier
     chartlevel (simple float) : Vertical offset for plotting
  Returns:   tuple
 get_mrc(source, length, mult, mult2, gradsize) 
  Mean Reversion Channel with multiple bands and conditions
  Parameters:
     source (float) : Price source
     length (simple int) : Channel period
     mult (simple float) : First band multiplier
     mult2 (simple float) : Second band multiplier
     gradsize (simple float) : Gradient size for zone detection
  Returns:  
 analyzeMarketStructure(highFractalBars, highFractalPrices, lowFractalBars, lowFractalPrices, trendDirection) 
  Analyzes market structure for ChoCH and BOS patterns
  Parameters:
     highFractalBars (array) : Array of high fractal bar indices
     highFractalPrices (array) : Array of high fractal prices
     lowFractalBars (array) : Array of low fractal bar indices
     lowFractalPrices (array) : Array of low fractal prices
     trendDirection (int) : Current trend (1=up, -1=down, 0=neutral)
  Returns:   - change signals and new trend direction
FNGAdataDates_Part2FNGAdataDates_Part2 provides the second part of historical trading dates for a financial instrument (e.g., FNGA index or related asset), covering approximately mid-2021 to January 22, 2018, with 896 trading days. The dates are organized into 18 chunks (dates_19 to dates_36), with 50 dates per chunk for 19–35 and 46 dates for chunk 36 (excluding weekends and possibly holidays). This library complements FNGAdataDates_Part1 to complete the 1,846-date dataset and is designed to align with the FNGAopenPrices and FNGAclosePrices libraries for backtesting, analysis, or visualization in Pine Script.
FNGAdataDates_Part1FNGAdataDates_Part1 provides historical trading dates for a financial instrument (e.g., FNGA index or related asset) from May 23, 2025, to approximately mid-2021, covering 950 trading days. The dates are organized into 19 chunks (dates_0 to dates_18), each containing 50 timestamps representing trading days (excluding weekends and possibly holidays). This library is part one of a two-part set due to Pine Script token limits and must be used with FNGAdataDates_Part2 for the complete dataset (1,846 dates). It is designed to align with the FNGAopenPrices and FNGAclosePrices libraries for backtesting, technical analysis, or visualization in Pine Script.
FNGAdataCloseClose prices for FNGA ETF (Dec 2018–May 2025)
The Close prices for FNGA ETF (December 2018 – May 2025) represent the final trading price recorded at the end of each regular U.S. market session (4:00 p.m. Eastern Time) over the entire lifespan of this leveraged exchange-traded note. Initially issued under the ticker FNGU and later rebranded as FNGA in March 2025 before its redemption in May 2025, the product was designed to provide 3x daily leveraged exposure to the MicroSectors FANG+™ Index, which tracks a concentrated group of large-cap technology and tech-enabled growth leaders such as Apple, Amazon, Meta (Facebook), Netflix, and Alphabet (Google).
Close prices are widely regarded as the most important reference point in market data because they establish the official end-of-day valuation of a security. For leveraged products like FNGA, the closing price is especially critical, since it directly determines the reset value for the following trading session. This daily compounding effect means that FNGA’s closing levels often diverged significantly from the long-term performance of its underlying index, creating both opportunities and risks for traders.
FNGAdataLow“Low prices for FNGA ETF (Dec 2018–May 2025)
The Low prices for FNGA ETF (December 2018 – May 2025) capture the lowest trading price reached during each regular U.S. market session over the entire lifespan of this leveraged exchange-traded note. Initially launched under the ticker FNGU, and later rebranded as FNGA in March 2025 before its eventual redemption, the fund was structured to deliver 3x daily leveraged exposure to the MicroSectors FANG+™ Index. This index concentrated on a small basket of leading technology and tech-enabled growth companies such as Meta (Facebook), Amazon, Apple, Netflix, and Alphabet (Google), along with a few other innovators.
The Low price is particularly important in the study of FNGA because it highlights the intraday downside extremes of a highly volatile, leveraged product. Since FNGA was designed to reset leverage daily, its lows often reflected moments of amplified market stress, when declines in the underlying FANG+™ stocks were multiplied through the 3x leverage structure.
FNGAdataHighHigh prices for FNGA ETF (Dec 2018–May 2025)
The High prices for FNGA ETF (December 2018 – May 2025) represent the maximum trading price reached during each regular U.S. market session over the entire trading lifespan of this leveraged exchange-traded note. Originally issued under the ticker FNGU, and later rebranded as FNGA in March 2025 before its redemption, the fund was designed to deliver 3x daily leveraged exposure to the MicroSectors FANG+™ Index. This index focused on a concentrated group of large-cap technology and technology-enabled companies such as Facebook (Meta), Amazon, Apple, Netflix, and Google (Alphabet), along with a few other growth leaders.
The High price data from December 2018 through May 2025 is crucial for understanding how FNGA behaved during intraday trading sessions. Because FNGA was a daily resetting 3x leveraged product, its intraday highs often displayed extreme sensitivity to movements in the underlying FANG+™ stocks, resulting in sharp upward spikes during bullish days and pronounced volatility during broader market rallies.
FNGAdataOpenOpen prices for FNGA ETF (Dec 2018–May 2025)
The FNGA ETF (originally launched under the FNGU ticker before being renamed in March 2025) tracked the MicroSectors FANG+™ Index with 3x daily leverage and was designed to give traders magnified exposure to a concentrated basket of large-cap technology and tech-enabled companies. The fund’s price history contains multiple phases due to ticker changes, corporate actions, and its eventual redemption in mid-2025.
When looking specifically at Open prices from December 2018 through May 2025, this dataset provides the daily opening values for FNGA across its entire lifecycle. The opening price is the first traded price at the start of each regular U.S. market session (9:30 a.m. Eastern Time). It is an important measure for traders and analysts because it reflects overnight sentiment, pre-market positioning, and often sets the tone for intraday volatility.
BecakFloatingPanelsLibrary   "BecakFloatingPanels" 
Library for creating floating indicator panels with MACD, RSI, and Stochastic indicators
 calculateMacd(source, fastLength, slowLength, signalLength) 
  Calculate MACD components
  Parameters:
     source (float) : Price source for calculation
     fastLength (simple int) : Fast EMA period
     slowLength (simple int) : Slow EMA period
     signalLength (simple int) : Signal line period
  Returns: MacdData MACD calculation results
 calculateRsi(source, length) 
  Calculate RSI
  Parameters:
     source (float) : Price source for calculation
     length (simple int) : RSI period
  Returns: float RSI value
 calculateStochastic(source, high, low, kLength, kSmoothing, dSmoothing) 
  Calculate Stochastic components
  Parameters:
     source (float) : Price source for calculation
     high (float) : High prices
     low (float) : Low prices
     kLength (int) : %K period
     kSmoothing (int) : %K smoothing period
     dSmoothing (int) : %D smoothing period
  Returns: StochData Stochastic calculation results
 calculateStochSignals(stochK, stochD, overboughtLevel, oversoldLevel) 
  Calculate Stochastic signals
  Parameters:
     stochK (float) : Stochastic %K series
     stochD (float) : Stochastic %D series
     overboughtLevel (float) : Overbought threshold
     oversoldLevel (float) : Oversold threshold
  Returns: StochSignals Signal flags
 calculateChartMetrics(high, low, lookbackLength) 
  Calculate chart range and positioning metrics
  Parameters:
     high (float) : High prices
     low (float) : Low prices
     lookbackLength (int) : Lookback period
  Returns: ChartMetrics Chart positioning data
 calculateMacdRange(macdLine, signalLine, histogram, safeLookback) 
  Calculate MACD range for normalization
  Parameters:
     macdLine (float) : MACD line series
     signalLine (float) : Signal line series
     histogram (float) : Histogram series
     safeLookback (int) : Lookback period
  Returns: MacdRange MACD range metrics
 initVisualArrays() 
  Initialize visual arrays
  Returns: VisualArrays Container with initialized arrays
 clearVisuals(visuals) 
  Clear all visual elements
  Parameters:
     visuals (VisualArrays) : VisualArrays container
  Returns: void
 calculatePanelPositions(chartMetrics, oscPlacement, panelHeight, panelSpacing, centerOffset) 
  Calculate panel positions based on placement option
  Parameters:
     chartMetrics (ChartMetrics) : Chart metrics object
     oscPlacement (string) : Panel placement option
     panelHeight (float) : Panel height percentage
     panelSpacing (float) : Panel spacing percentage
     centerOffset (float) : Center offset percentage
  Returns: PanelPositions Panel boundary coordinates
 createPanelBackgrounds(visuals, positions, panelLeft, panelRight, showBackground, transparency) 
  Create panel backgrounds
  Parameters:
     visuals (VisualArrays) : VisualArrays container
     positions (PanelPositions) : PanelPositions object
     panelLeft (int) : Left boundary
     panelRight (int) : Right boundary
     showBackground (bool) : Show background flag
     transparency (int) : Background transparency
  Returns: void
 drawReferenceLines(visuals, positions, chartMetrics, macdRange, dataLeft, dataRight, panelHeight, rsiOverbought, rsiOversold, stochOverbought, stochOversold) 
  Draw reference lines for all panels
  Parameters:
     visuals (VisualArrays) : VisualArrays container
     positions (PanelPositions) : PanelPositions object
     chartMetrics (ChartMetrics) : ChartMetrics object
     macdRange (MacdRange) : MacdRange object
     dataLeft (int) : Left data boundary
     dataRight (int) : Right data boundary
     panelHeight (float) : Panel height percentage
     rsiOverbought (int) : RSI overbought level
     rsiOversold (int) : RSI oversold level
     stochOverbought (int) : Stochastic overbought level
     stochOversold (int) : Stochastic oversold level
  Returns: void
 drawMacdIndicator(visuals, macdLine, signalLine, histogram, macdRange, positions, chartMetrics, barIndex, nextBarIndex, barIndexOffset, panelHeight) 
  Draw MACD indicator
  Parameters:
     visuals (VisualArrays) : VisualArrays container
     macdLine (float) : MACD line series
     signalLine (float) : Signal line series
     histogram (float) : Histogram series
     macdRange (MacdRange) : MacdRange object
     positions (PanelPositions) : PanelPositions object
     chartMetrics (ChartMetrics) : ChartMetrics object
     barIndex (int) : Current bar index
     nextBarIndex (int) : Next bar index
     barIndexOffset (int) : Horizontal offset
     panelHeight (float) : Panel height percentage
  Returns: void
 drawRsiIndicator(visuals, rsiValue, positions, chartMetrics, barIndex, nextBarIndex, barIndexOffset, panelHeight) 
  Draw RSI indicator
  Parameters:
     visuals (VisualArrays) : VisualArrays container
     rsiValue (float) : RSI value
     positions (PanelPositions) : PanelPositions object
     chartMetrics (ChartMetrics) : ChartMetrics object
     barIndex (int) : Current bar index
     nextBarIndex (int) : Next bar index
     barIndexOffset (int) : Horizontal offset
     panelHeight (float) : Panel height percentage
  Returns: void
 drawStochasticIndicator(visuals, stochK, stochD, positions, chartMetrics, barIndex, nextBarIndex, barIndexOffset, panelHeight, stochOverbought, stochOversold) 
  Draw Stochastic indicator
  Parameters:
     visuals (VisualArrays) : VisualArrays container
     stochK (float) : Stochastic %K series
     stochD (float) : Stochastic %D series
     positions (PanelPositions) : PanelPositions object
     chartMetrics (ChartMetrics) : ChartMetrics object
     barIndex (int) : Current bar index
     nextBarIndex (int) : Next bar index
     barIndexOffset (int) : Horizontal offset
     panelHeight (float) : Panel height percentage
     stochOverbought (int) : Overbought level
     stochOversold (int) : Oversold level
  Returns: void
 addStochasticSignals(visuals, buySignal, sellSignal, positions, chartMetrics, currentBarIndex, barIndexOffset, panelHeight, signalIndex) 
  Add Stochastic buy/sell signals
  Parameters:
     visuals (VisualArrays) : VisualArrays container
     buySignal (bool) : Buy signal series
     sellSignal (bool) : Sell signal series
     positions (PanelPositions) : PanelPositions object
     chartMetrics (ChartMetrics) : ChartMetrics object
     currentBarIndex (int) : Current bar index
     barIndexOffset (int) : Horizontal offset
     panelHeight (float) : Panel height percentage
     signalIndex (int) : Signal index for lookback
  Returns: void
 setPanelLabels(macdLabel, rsiLabel, stochLabel, positions, chartMetrics, labelOffset, panelHeight, barIndexOffset) 
  Set panel title labels
  Parameters:
     macdLabel (label) : MACD label reference
     rsiLabel (label) : RSI label reference
     stochLabel (label) : Stochastic label reference
     positions (PanelPositions) : PanelPositions object
     chartMetrics (ChartMetrics) : ChartMetrics object
     labelOffset (int) : Label horizontal offset
     panelHeight (float) : Panel height percentage
     barIndexOffset (int) : Horizontal offset
  Returns: void
 showDebugInfo(chartMetrics, debugMode) 
  Display debug information
  Parameters:
     chartMetrics (ChartMetrics) : ChartMetrics object
     debugMode (bool) : Debug mode flag
  Returns: void
 ChartMetrics 
  Chart metrics container
  Fields:
     visibleHigh (series float) : Highest visible price
     visibleLow (series float) : Lowest visible price
     chartRange (series float) : Price range of chart
     chartCenter (series float) : Center point of chart
 MacdData 
  MACD calculation results
  Fields:
     macdLine (series float) : Main MACD line
     signalLine (series float) : Signal line
     histogram (series float) : MACD histogram
 MacdRange 
  MACD range metrics for normalization
  Fields:
     highest (series float) : Highest MACD value
     lowest (series float) : Lowest MACD value
     BRange (series float) : Total range
 StochData 
  Stochastic calculation results
  Fields:
     k_smooth (series float) : Smoothed %K line
     d (series float) : %D line
 StochSignals 
  Stochastic signals
  Fields:
     buySignal (series bool) : Buy signal flag
     sellSignal (series bool) : Sell signal flag
 PanelPositions 
  Panel positioning data
  Fields:
     macdTop (series float) : MACD panel top
     macdBottom (series float) : MACD panel bottom
     rsiTop (series float) : RSI panel top
     rsiBottom (series float) : RSI panel bottom
     stochTop (series float) : Stochastic panel top
     stochBottom (series float) : Stochastic panel bottom
 VisualArrays 
  Visual elements arrays container
  Fields:
     macdLines (array) : Array of MACD lines
     macdHist (array) : Array of MACD histogram boxes
     rsiLines (array) : Array of RSI lines
     stochLines (array) : Array of Stochastic lines
     stochAreas (array) : Array of Stochastic areas
     stochSignals (array) : Array of Stochastic signals
     panelBackgrounds (array) : Array of panel backgrounds
Primes_4These libraries (Primes_1 -> Primes_4) contain arrays of reduced Prime Numbers to minimize the amount of tokens, allowing more information to be exported.
Values, for example:
 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7021 
are reduced to: 
 7001,   13,   19,   27,   39,   43,   57,   69,   79, 7103,    9,   21 
With the restoreValues() function found in this library, the reduced values can be restored back to its original state.
 7001,   13,   19,   27,   39,   43,   57,   69,   79, 7103,    9,   21 
is restored back to:
 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7021 
The libraries contain all Prime Numbers from 2 to 1.340.011
------------------------------------------------------------
Library   "Primes_4" 
Prime Numbers 1.096.031 - 1.340.011
 primes_a() 
  Prime numbers 1.096.031 - 1.205.999
 primes_b() 
  Prime numbers 1.206.013 - 1.317.989
 primes_c() 
  Prime numbers 1.318.003 - 1.340.011
 method restoreValues(iArray, iShow, iFrom, iTo) 
  restoreValues : Restores reduced prime number values in an array to their original state, for example `7001, 13, 19, 27, 39, 43, 57, 69, 79, 7103, 9, 21` is restored to `7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7021`
  Namespace types: array
  Parameters:
     iArray (array) 
     iShow (bool) 
     iFrom (int) 
     iTo (int) 
  Returns: Initial array with restored prime number values
Primes_3These libraries (Primes_1 -> Primes_4) contain arrays of reduced Prime Numbers to minimize the amount of tokens, allowing more information to be exported.
Values, for example:
 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7021 
are reduced to: 
 7001,   13,   19,   27,   39,   43,   57,   69,   79, 7103,    9,   21 
With the restoreValues() function found in the Primes_4 library, the reduced values can be restored back to its original state.
 7001,   13,   19,   27,   39,   43,   57,   69,   79, 7103,    9,   21 
is restored back to:
 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7021 
The libraries contain all Prime Numbers from 2 to 1.340.011
------------------------------------------------------------
Library   "Primes_3" 
Prime Numbers 713.021 - 1.095.989
 primes_a() 
  Prime numbers 713.021 - 820.997
 primes_b() 
  Prime numbers 821.003 - 928.979
 primes_c() 
  Prime numbers 929.003 - 1.038.953
 primes_d() 
  Prime numbers 1.039.001 - 1.095.989
Primes_2These libraries (Primes_1 -> Primes_4) contain arrays of reduced Prime Numbers to minimize the amount of tokens, allowing more information to be exported.
Values, for example:
 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7021 
are reduced to: 
 7001,   13,   19,   27,   39,   43,   57,   69,   79, 7103,    9,   21 
With the restoreValues() function found in the Primes_4 library, the reduced values can be restored back to its original state.
 7001,   13,   19,   27,   39,   43,   57,   69,   79, 7103,    9,   21 
is restored back to:
 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7021 
The libraries contain all Prime Numbers from 2 to 1.340.011
------------------------------------------------------------
Library   "Primes_2" 
Prime Numbers 340.007 - 712.981
 primes_a() 
  Prime numbers 340.007 - 441.971
 primes_b() 
  Prime numbers 442.003 - 545.959
 primes_c() 
  Prime numbers 546.001 - 650.987
 primes_d() 
  Prime numbers 651.017 - 712.981
Primes_1These libraries (Primes_1 -> Primes_4) contain arrays of reduced Prime Numbers to minimize the amount of tokens, allowing more information to be exported.
Values, for example:
 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7021 
are reduced to: 
 7001,   13,   19,   27,   39,   43,   57,   69,   79, 7103,    9,   21 
With the restoreValues() function found in the Primes_4 library, the reduced values can be restored back to its original state.
 7001,   13,   19,   27,   39,   43,   57,   69,   79, 7103,    9,   21 
is restored back to:
 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7021 
The libraries contain all Prime Numbers from 2 to 1.340.011
------------------------------------------------------------
Library   "Primes_1" 
Prime Numbers 2 - 339.991
 primes_a() 
  Prime numbers 2 - 81.689
 primes_b() 
  Prime numbers 81.701 - 175.897
 primes_c() 
  Prime numbers 175.909 - 273.997
 primes_d() 
  Prime numbers 274.007 - 339.991
AuthLibLibrary   "AuthLib" 
 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)
lib_listaAtivos_PosseidonLibrary   "lib_listaAtivos_Posseidon" 
TODO: add library description here
 ativos(loteSelected) 
  TODO: add function description here
  Parameters:
     loteSelected (simple int) 
  Returns: TODO: add what function returns
TrailingStopLibraryLibrary   "TrailingStopLibrary" 
专业移动止盈库 - 为Pine Script策略提供完整的追踪止盈功能。支持做多做空双向交易,基于风险回报比智能激活,提供收盘价和高低价两种判断模式。包含完整的状态管理、调试信息和易用的API接口。适用于股票、外汇、加密货币等各种市场的风险管理。
@version 1.0
@author runto2006
 new_config(enabled, activation_ratio, pullback_percent, price_type) 
  创建移动止盈配置对象
  Parameters:
     enabled (bool) : (bool) 是否启用移动止盈,默认true
     activation_ratio (float) : (float) 激活盈亏比,默认4.0,表示盈利4倍止损距离时激活
     pullback_percent (float) : (float) 回撤百分比,默认1.0,表示回撤1%时触发止盈
     price_type (string) : (string) 价格类型,默认"close"。"close"=收盘价模式,"hl"=高低价模式
  Returns: Config 配置对象
 new_state() 
  创建移动止盈状态对象
  Returns: State 初始化的状态对象
 reset(state) 
  重置移动止盈状态
  Parameters:
     state (State) : (State) 要重置的状态对象
  Returns: void
 calc_activation_target(entry_price, stop_price, activation_ratio, is_long) 
  计算激活目标价格
  Parameters:
     entry_price (float) : (float) 入场价格
     stop_price (float) : (float) 止损价格
     activation_ratio (float) : (float) 激活盈亏比
     is_long (bool) : (bool) 是否为多头持仓
  Returns: float 激活目标价格,如果输入无效则返回na
 get_check_price(price_type, is_long, for_activation) 
  获取用于判断的价格
  Parameters:
     price_type (string) : (string) 价格类型:"close"或"hl"
     is_long (bool) : (bool) 是否为多头持仓
     for_activation (bool) : (bool) 是否用于激活判断,影响高低价的选择方向
  Returns: float 当前判断价格
 check_activation(config, state, entry_price, stop_price, is_long, has_position) 
  检查是否应该激活移动止盈
  Parameters:
     config (Config) : (Config) 移动止盈配置
     state (State) : (State) 移动止盈状态
     entry_price (float) : (float) 入场价格
     stop_price (float) : (float) 止损价格
     is_long (bool) : (bool) 是否为多头持仓
     has_position (bool) : (bool) 是否有持仓
  Returns: bool 是否成功激活
 update_tracking(config, state, is_long) 
  更新移动止盈的追踪价格
  Parameters:
     config (Config) : (Config) 移动止盈配置
     state (State) : (State) 移动止盈状态
     is_long (bool) : (bool) 是否为多头持仓
  Returns: void
 check_trigger(config, state, entry_price, is_long) 
  检查是否触发移动止盈
  Parameters:
     config (Config) : (Config) 移动止盈配置
     state (State) : (State) 移动止盈状态
     entry_price (float) : (float) 入场价格
     is_long (bool) : (bool) 是否为多头持仓
  Returns: bool 是否触发止盈
 process(config, state, entry_price, stop_price, is_long, has_position) 
  一体化处理移动止盈逻辑
  Parameters:
     config (Config) : (Config) 移动止盈配置
     state (State) : (State) 移动止盈状态
     entry_price (float) : (float) 入场价格
     stop_price (float) : (float) 止损价格
     is_long (bool) : (bool) 是否为多头持仓
     has_position (bool) : (bool) 是否有持仓
  Returns: bool 是否触发止盈
 get_trigger_price(config, state, is_long) 
  获取当前触发价格
  Parameters:
     config (Config) : (Config) 移动止盈配置
     state (State) : (State) 移动止盈状态
     is_long (bool) : (bool) 是否为多头持仓
  Returns: float 触发价格,未激活时返回na
 get_pullback_percent(config, state, entry_price, is_long) 
  计算当前回撤百分比
  Parameters:
     config (Config) : (Config) 移动止盈配置
     state (State) : (State) 移动止盈状态
     entry_price (float) : (float) 入场价格
     is_long (bool) : (bool) 是否为多头持仓
  Returns: float 当前回撤百分比,未激活时返回na
 get_status_info(config, state, entry_price, is_long) 
  获取状态信息字符串(用于调试)
  Parameters:
     config (Config) : (Config) 移动止盈配置
     state (State) : (State) 移动止盈状态
     entry_price (float) : (float) 入场价格
     is_long (bool) : (bool) 是否为多头持仓
  Returns: string 详细的状态信息
 Config 
  移动止盈配置对象
  Fields:
     enabled (series bool) : (bool) 是否启用移动止盈功能
     activation_ratio (series float) : (float) 激活盈亏比 - 盈利达到止损距离的多少倍时激活追踪
     pullback_percent (series float) : (float) 回撤百分比 - 从最优价格回撤多少百分比时触发止盈
     price_type (series string) : (string) 价格判断类型 - "close"使用收盘价,"hl"使用高低价
 State 
  移动止盈状态对象
  Fields:
     activated (series bool) : (bool) 是否已激活追踪止盈
     highest_price (series float) : (float) 激活后记录的最高价格
     lowest_price (series float) : (float) 激活后记录的最低价格
     activation_target (series float) : (float) 激活目标价格
SIC_TICKER_DATAThe SIC Ticker Data is an advanced and efficient library for ticker-to-industry classification and sector analysis. Built with enterprise-grade performance optimizations, this library provides instant access to SIC codes, industry classifications, and peer company data for comprehensive market analysis.
Perfect for: Sector rotation strategies, peer analysis, portfolio diversification, market screening, and financial research tools.
The simple idea behind this library is to pull any data related to SIC number of any US stock market ticker  provided by SEC  in order to see the industry and also see the exact competitors of the ticker.
The library stores 3 types of data: SIC number, Ticker, and Industry name. What makes it very useful is that you can pull any one of this data using the other. For example, if you would like to know which tickers are inside a certain SIC, or what's the SIC number of a specific ticker, or even which tickers are inside a certain industry, you can use this library to pull this data. The idea for data inside this library is to be accessible in any direction possible as long as they're related to each other.
We've also published a simple indicator that uses this library in order to demonstrate the inner workings of this library.
The library stores thousands of tickers and their relevant SIC code and industry for your use and is constantly updated with new data when available. This is a large library but it is optimized to run as fast as possible. The previous unpublished versions would take over 40 seconds to load any data but the final public version here loads the data in less than 5 seconds.
 🔍 Primary Lookup Functions 
 createDataStore() 
Initialize the library with all pre-loaded data.
 store = data.createDataStore() 
 getSicByTicker(store, ticker) 
Get SIC code for any ticker symbol.
 sic = data.getSicByTicker(store, "AAPL")  // Returns: "3571" 
 getIndustryByTicker(store, ticker) 
Get industry classification for any ticker.
 industry = data.getIndustryByTicker(store, "AAPL")  // Returns: "Computer Hardware" 
 getTickersBySic(store, sic) 
Get all companies in a specific SIC code.
 software = data.getTickersBySic(store, "7372")  // Returns: "MSFT,GOOGL,META,V,MA,CRM,ADBE,ORCL,NOW,INTU" 
 getTickersByIndustry(store, industry) 
Get all companies in an industry.
 retail = data.getTickersByIndustry(store, "Retail")  // Returns: "AMZN,HD,WMT,TGT,COST,LOW" 
 📊 Array & Analysis Functions 
 getTickerArrayBySic(store, sic) 
Get tickers as array for processing.
 techArray = data.getTickerArrayBySic(store, "7372")
for i = 0 to array.size(techArray) - 1
    ticker = array.get(techArray, i)
    // Process each tech company 
 getTickerCountBySic(store, sic) 
Count companies in a sector (ultra-fast).
 pinescripttechCount = data.getTickerCountBySic(store, "7372")  // Returns: 10 
 🎯 Utility Functions 
 tickerExists(store, ticker) 
Check if ticker exists in database.
 exists = data.tickerExists(store, "AAPL")  // Returns: true 
 tickerInSic(store, ticker, sic) 
Check if ticker belongs to specific sector.
 isInTech = data.tickerInSic(store, "AAPL", "3571")  // Returns: true 
 💡 Usage Examples 
 Example 1: Basic Ticker Lookup 
 // @version=6
import EdgeTerminal/SIC_TICKER_DATA/1 as data
indicator("Ticker Analysis", overlay=true)
store = data.createDataStore()
currentSic = data.getSicByTicker(store, syminfo.ticker)
currentIndustry = data.getIndustryByTicker(store, syminfo.ticker)
if barstate.islast and currentSic != "NOT_FOUND"
    label.new(bar_index, high, syminfo.ticker + " SIC: " + currentSic + " Industry: " + currentIndustry) 
 Example 2: Sector Analysis 
// @version=6
import EdgeTerminal/SIC_TICKER_DATA/1 as data
indicator("Sector Comparison", overlay=false)
store = data.createDataStore()
// Compare sector sizes
techCount = data.getTickerCountBySic(store, "7372")     // Software
financeCount = data.getTickerCountBySic(store, "6199")  // Finance
healthCount = data.getTickerCountBySic(store, "2834")   // Pharmaceutical
plot(techCount, title="Tech Companies", color=color.blue)
plot(financeCount, title="Finance Companies", color=color.green)
plot(healthCount, title="Health Companies", color=color.red)
 Example 3: Peer Analysis 
 // @version=6
import EdgeTerminal/SIC_TICKER_DATA/1 as data
indicator("Find Competitors", overlay=true)
store = data.createDataStore()
currentSic = data.getSicByTicker(store, syminfo.ticker)
if currentSic != "NOT_FOUND"
    competitors = data.getTickersBySic(store, currentSic)
    peerCount = data.getTickerCountBySic(store, currentSic)
    if barstate.islast
        label.new(bar_index, high, "Competitors (" + str.tostring(peerCount) + "): " + competitors) 
 Example 4: Portfolio Sector Allocation 
 // @version=6
import EdgeTerminal/SIC_TICKER_DATA/1 as data
indicator("Portfolio Analysis", overlay=false)
store = data.createDataStore()
// Analyze your portfolio's sector distribution
portfolioTickers = array.from("AAPL", "MSFT", "GOOGL", "JPM", "JNJ")
sectorCount = map.new()
for i = 0 to array.size(portfolioTickers) - 1
    ticker = array.get(portfolioTickers, i)
    industry = data.getIndustryByTicker(store, ticker)
    if industry != "NOT_FOUND"
        currentCount = map.get(sectorCount, industry)
        newCount = na(currentCount) ? 1 : currentCount + 1
        map.put(sectorCount, industry, newCount) 
🔧 Advanced Feature
You can also bulk load data for large data sets like this:
 // Pre-format your data as pipe-separated string
bulkData = "AAPL:3571:Computer Hardware|MSFT:7372:Software|GOOGL:7372:Software"
store = data.createDataStoreFromBulk(bulkData)
ArraysAssorted🟩  OVERVIEW 
This library provides utility methods for working with arrays in Pine Script. The first method finds extreme values (highest/lowest) within a rolling lookback window and returns both the value and its position. I might extend the library for other ad-hoc methods I use to work with arrays.
🟩  HOW TO USE 
Pine Script libraries contain reusable code for importing into indicators. You do not need to copy any code out of here. Just import the library and call the method you want.
For example, for version 1 of this library, import it like this:
 
import SimpleCryptoLife/ArraysAssorted/1
 
See the EXAMPLE USAGE sections within the library for examples of calling the methods.
You do not need permission to use Pine libraries in your open-source scripts.
However,  you do need explicit permission  to reuse code from a Pine Script library’s functions in a  public protected or invite-only publication .
In any case, credit the author in your description. It is also good form to credit in open-source comments.
For more information on libraries and incorporating them into your scripts, see the  Libraries  section of the Pine Script User Manual. 
🟩  METHOD 1: m_getHighestLowestFloat() 
Finds the highest or lowest float value from an array. Simple enough. It also returns the index of the value as an offset from the end of the array.
• It works with rolling lookback windows, so you can find extremes within the last N elements
• It includes an offset parameter to skip recent elements if needed
• It handles edge cases like empty arrays and invalid ranges gracefully
• It can find either the first or last occurrence of the extreme value
We also export two enums whose sole purpose is to look pretty as method arguments.
 method m_getHighestLowestFloat(_self, _highestLowest, _lookbackBars, _offset, _firstLastType) 
	Namespace types: array
	This method finds the highest or lowest value in a float array within a rolling lookback window, and returns the value along with the offset (number of elements back from the end of the array) of its first or last occurrence.
	Parameters:
		 _self (array) : The array of float values to search for extremes.
		 _highestLowest (HighestLowest) : Whether to search for the highest or lowest value. Use the enum value HighestLowest.highest or HighestLowest.lowest.
		 _lookbackBars (int) : The number of array elements to include in the rolling lookback window. Must be positive. Note: Array elements only correspond to bars if the consuming script always adds exactly one element on consecutive bars.
		 _offset (int) : The number of array elements back from the end of the array to start the lookback window. A value of zero means no offset. The _offset parameter offsets both the beginning and end of the range.
		 _firstLastType (FirstLast) : Whether to return the offset of the first (lowest index) or last (highest index) occurrence of the extreme value. Use FirstLast.first or FirstLast.last.
	Returns: (tuple) A tuple containing the highest or lowest value and its offset -- the number of elements back from the end of the array. If not found, returns  . NOTE: The _offsetFromEndOfArray value is not affected by the _offset parameter. In other words, it is not the offset from the end of the range but from the end of the array. This number may or may not have any relation to the number of *bars* back, depending on how the array is populated. The calling code needs to figure that out.
 EXPORTED ENUMS 
 HighestLowest 
	Whether to return the highest value or lowest value in the range.
	•  highest : Find the highest value in the specified range
	•  lowest : Find the lowest value in the specified range
 FirstLast 
	Whether to return the first (lowest index) or last (highest index) occurrence of the extreme value.
	•  first : Return the offset of the first occurrence of the extreme value
	•  last : Return the offset of the last occurrence of the extreme value






















