PINE LIBRARY

QTA_Optimized

69
Library "QTA_Optimized"

changePercent(source)
  Returns the one-bar change percentage of the source.
  Parameters:
    source (float)

calculateKellyRatio(returns)
  Calculates the Kelly Ratio.
  Parameters:
    returns (array<float>)

calculateAdjustedKellyFraction(kellyRatio, riskTolerance, fedStance)
  Calculates the adjusted Kelly Fraction.
  Parameters:
    kellyRatio (float)
    riskTolerance (float)
    fedStance (string)

sumArray(arr)
  Sums the elements of a float array.
  Parameters:
    arr (array<float>)

calculateStdDev(returns)
  Calculates the standard deviation of an array of returns.
  Parameters:
    returns (array<float>)

calculateMaxDrawdown(returns)
  Calculates the maximum drawdown from an array of returns.
  Parameters:
    returns (array<float>)

calculateEV(avgWinReturn, winProb, avgLossReturn)
  Calculates the Expected Value (EV) of a bet.
  Parameters:
    avgWinReturn (float)
    winProb (float)
    avgLossReturn (float)

calculateTailRatio(returns)
  Calculates the Tail Ratio.
  Parameters:
    returns (array<float>)

calculateSharpeRatio(avgReturn, riskFreeRate, stdDev)
  Calculates the Sharpe Ratio.
  Parameters:
    avgReturn (float)
    riskFreeRate (float)
    stdDev (float)

calculateDownsideDeviation(returns)
  Calculates the Downside Deviation.
  Parameters:
    returns (array<float>)

calculateSortinoRatio(avgReturn, downsideDeviation)
  Calculates the Sortino Ratio.
  Parameters:
    avgReturn (float)
    downsideDeviation (float)

calculateVaR(returns, confidenceLevel)
  Calculates the Value at Risk (VaR).
  Parameters:
    returns (array<float>)
    confidenceLevel (float)

calculateCVaR(returns, varValue)
  Calculates the Conditional Value at Risk (CVaR).
  Parameters:
    returns (array<float>)
    varValue (float)

calculateRollingStdDev(returns, window)
  Calculates the rolling standard deviation of returns.
  Parameters:
    returns (array<float>)
    window (int)

calculateRollingMean(returns, window)
  Calculates the rolling mean of returns.
  Parameters:
    returns (array<float>)
    window (int)

determineMarketRegime(priceChanges)
  Determines the market regime based on price changes.
  Parameters:
    priceChanges (array<float>)

classifyVolatilityRegime(volatility)
  Classifies the volatility regime.
  Parameters:
    volatility (array<float>)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.