PINE LIBRARY

TAUtilityLib

30
Library "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: [scale_factor, offset] 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: [upper, lower, basis] 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: [meanline, meanrange, upband1, loband1, upband2, loband2, condition]

analyzeMarketStructure(highFractalBars, highFractalPrices, lowFractalBars, lowFractalPrices, trendDirection)
  Analyzes market structure for ChoCH and BOS patterns
  Parameters:
    highFractalBars (array<int>): Array of high fractal bar indices
    highFractalPrices (array<float>): Array of high fractal prices
    lowFractalBars (array<int>): Array of low fractal bar indices
    lowFractalPrices (array<float>): Array of low fractal prices
    trendDirection (int): Current trend (1=up, -1=down, 0=neutral)
  Returns: [choch, bos, newTrend] - change signals and new trend direction

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.