PINE LIBRARY

AMF_Library

44
Library "AMF_Library"
Adaptive Momentum Flow (AMF) Library - A comprehensive momentum oscillator that adapts to market volatility
Author B3AR_Trades

f_ema(source, length)
  Custom EMA calculation that accepts a series length
  Parameters:
    source (float): (float) Source data for calculation
    length (float): (float) EMA length (can be series)
  Returns: (float) EMA value

f_dema(source, length)
  Custom DEMA calculation that accepts a series length
  Parameters:
    source (float): (float) Source data for calculation
    length (float): (float) DEMA length (can be series)
  Returns: (float) DEMA value

f_sum(source, length)
  Custom sum function for rolling sum calculation
  Parameters:
    source (float): (float) Source data for summation
    length (int): (int) Number of periods to sum
  Returns: (float) Sum value

get_average(data, length, ma_type)
  Get various moving average types for fixed lengths
  Parameters:
    data (float): (float) Source data
    length (simple int): (int) MA length
    ma_type (string): (string) MA type: "SMA", "EMA", "WMA", "DEMA"
  Returns: (float) Moving average value

calculate_adaptive_lookback(base_length, min_lookback, max_lookback, volatility_sensitivity)
  Calculate adaptive lookback length based on volatility
  Parameters:
    base_length (int): (int) Base lookback length
    min_lookback (int): (int) Minimum allowed lookback
    max_lookback (int): (int) Maximum allowed lookback
    volatility_sensitivity (float): (float) Sensitivity to volatility changes
  Returns: (int) Adaptive lookback length

get_volatility_ratio()
  Get current volatility ratio
  Returns: (float) Current volatility ratio vs 50-period average

calculate_volume_analysis(vzo_length, smooth_length, smooth_type)
  Calculate volume-based buying/selling pressure
  Parameters:
    vzo_length (int): (int) Lookback length for volume analysis
    smooth_length (simple int): (int) Smoothing length
    smooth_type (string): (string) Smoothing MA type
  Returns: (float) Volume analysis value (-100 to 100)

calculate_amf(base_length, smooth_length, smooth_type, signal_length, signal_type, min_lookback, max_lookback, volatility_sensitivity, medium_multiplier, slow_multiplier, vzo_length, vzo_smooth_length, vzo_smooth_type, price_vs_fast_weight, fast_vs_medium_weight, medium_vs_slow_weight, vzo_weight)
  Calculate complete AMF oscillator
  Parameters:
    base_length (int): (int) Base lookback length
    smooth_length (simple int): (int) Final smoothing length
    smooth_type (string): (string) Final smoothing MA type
    signal_length (simple int): (int) Signal line length
    signal_type (string): (string) Signal line MA type
    min_lookback (int): (int) Minimum adaptive lookback
    max_lookback (int): (int) Maximum adaptive lookback
    volatility_sensitivity (float): (float) Volatility adaptation sensitivity
    medium_multiplier (float): (float) Medium DEMA length multiplier
    slow_multiplier (float): (float) Slow DEMA length multiplier
    vzo_length (int): (int) Volume analysis lookback
    vzo_smooth_length (simple int): (int) Volume analysis smoothing
    vzo_smooth_type (string): (string) Volume analysis smoothing type
    price_vs_fast_weight (float): (float) Weight for price vs fast DEMA
    fast_vs_medium_weight (float): (float) Weight for fast vs medium DEMA
    medium_vs_slow_weight (float): (float) Weight for medium vs slow DEMA
    vzo_weight (float): (float) Weight for volume analysis component
  Returns: (AMFResult) Complete AMF calculation results

calculate_amf_default()
  Calculate AMF with default parameters
  Returns: (AMFResult) AMF result with standard settings

amf_oscillator()
  Get just the main AMF oscillator value with default parameters
  Returns: (float) Main AMF oscillator value

amf_signal()
  Get just the AMF signal line with default parameters
  Returns: (float) AMF signal line value

is_overbought(overbought_level)
  Check if AMF is in overbought condition
  Parameters:
    overbought_level (float): (float) Overbought threshold (default 70)
  Returns: (bool) True if overbought

is_oversold(oversold_level)
  Check if AMF is in oversold condition
  Parameters:
    oversold_level (float): (float) Oversold threshold (default -70)
  Returns: (bool) True if oversold

bullish_crossover()
  Detect bullish crossover (main line crosses above signal)
  Returns: (bool) True on bullish crossover

bearish_crossover()
  Detect bearish crossover (main line crosses below signal)
  Returns: (bool) True on bearish crossover

AMFResult
  AMF calculation results
  Fields:
    main_oscillator (series float): The main AMF oscillator value (-100 to 100)
    signal_line (series float): The signal line for crossover signals
    dema_fast (series float): Fast adaptive DEMA value
    dema_medium (series float): Medium adaptive DEMA value
    dema_slow (series float): Slow adaptive DEMA value
    volume_analysis (series float): Volume-based buying/selling pressure (-100 to 100)
    adaptive_lookback (series int): Current adaptive lookback length
    volatility_ratio (series float): Current volatility ratio vs average

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.