PINE LIBRARY
IC optimiser lib

Library "IC optimiser lib"
Library for IC-based parameter optimization
findOptimalParam(testParams, icValues, currentParam, smoothing)
Find optimal parameter from array of IC values
Parameters:
testParams (array<float>): Array of parameter values being tested
icValues (array<float>): Array of IC values for each parameter (same size as testParams)
currentParam (float): Current parameter value (for smoothing)
smoothing (simple float): Smoothing factor (0-1, e.g., 0.2 means 20% new, 80% old)
Returns: [optimizedParam, bestIC, bestIndex] New parameter value, its IC, and array index
adaptiveParamWithStarvation(opt, testParams, icValues, smoothing, starvationThreshold, starvationJumpSize)
Adaptive parameter selection with starvation handling
Parameters:
opt (ICOptimizer): ICOptimizer object
testParams (array<float>): Array of parameter values
icValues (array<float>): Array of IC values for each parameter
smoothing (simple float): Normal smoothing factor
starvationThreshold (simple int): Number of updates before triggering starvation mode
starvationJumpSize (simple float): Jump size when in starvation (as fraction of range)
Returns: [newParam, bestIC] Updated parameter and IC
detectAndAdjustDomination(longCount, shortCount, currentLongLevel, currentShortLevel, dominationRatio, jumpSize, minLevel, maxLevel)
Detect signal imbalance and adjust parameters
Parameters:
longCount (int): Number of long signals in period
shortCount (int): Number of short signals in period
currentLongLevel (float): Current long threshold
currentShortLevel (float): Current short threshold
dominationRatio (simple int): Ratio threshold (e.g., 4 = 4:1 imbalance)
jumpSize (simple float): Size of adjustment
minLevel (simple float): Minimum allowed level
maxLevel (simple float): Maximum allowed level
Returns: [newLongLevel, newShortLevel, isDominated]
calcIC(signals, returns, lookback)
Parameters:
signals (float)
returns (float)
lookback (simple int)
classifyIC(currentIC, icWindow, goodPercentile, badPercentile)
Parameters:
currentIC (float)
icWindow (simple int)
goodPercentile (simple int)
badPercentile (simple int)
evaluateSignal(signal, forwardReturn)
Parameters:
signal (float)
forwardReturn (float)
updateOptimizerState(opt, signal, forwardReturn, currentIC, metaICPeriod)
Parameters:
opt (ICOptimizer)
signal (float)
forwardReturn (float)
currentIC (float)
metaICPeriod (simple int)
calcSuccessRate(successful, total)
Parameters:
successful (int)
total (int)
createICStatsTable(opt, paramName, normalSuccess, normalTotal)
Parameters:
opt (ICOptimizer)
paramName (string)
normalSuccess (int)
normalTotal (int)
initOptimizer(initialParam)
Parameters:
initialParam (float)
ICOptimizer
Fields:
currentParam (series float)
currentIC (series float)
metaIC (series float)
totalSignals (series int)
successfulSignals (series int)
goodICSignals (series int)
goodICSuccess (series int)
nonBadICSignals (series int)
nonBadICSuccess (series int)
goodICThreshold (series float)
badICThreshold (series float)
updateCounter (series int)
Library for IC-based parameter optimization
findOptimalParam(testParams, icValues, currentParam, smoothing)
Find optimal parameter from array of IC values
Parameters:
testParams (array<float>): Array of parameter values being tested
icValues (array<float>): Array of IC values for each parameter (same size as testParams)
currentParam (float): Current parameter value (for smoothing)
smoothing (simple float): Smoothing factor (0-1, e.g., 0.2 means 20% new, 80% old)
Returns: [optimizedParam, bestIC, bestIndex] New parameter value, its IC, and array index
adaptiveParamWithStarvation(opt, testParams, icValues, smoothing, starvationThreshold, starvationJumpSize)
Adaptive parameter selection with starvation handling
Parameters:
opt (ICOptimizer): ICOptimizer object
testParams (array<float>): Array of parameter values
icValues (array<float>): Array of IC values for each parameter
smoothing (simple float): Normal smoothing factor
starvationThreshold (simple int): Number of updates before triggering starvation mode
starvationJumpSize (simple float): Jump size when in starvation (as fraction of range)
Returns: [newParam, bestIC] Updated parameter and IC
detectAndAdjustDomination(longCount, shortCount, currentLongLevel, currentShortLevel, dominationRatio, jumpSize, minLevel, maxLevel)
Detect signal imbalance and adjust parameters
Parameters:
longCount (int): Number of long signals in period
shortCount (int): Number of short signals in period
currentLongLevel (float): Current long threshold
currentShortLevel (float): Current short threshold
dominationRatio (simple int): Ratio threshold (e.g., 4 = 4:1 imbalance)
jumpSize (simple float): Size of adjustment
minLevel (simple float): Minimum allowed level
maxLevel (simple float): Maximum allowed level
Returns: [newLongLevel, newShortLevel, isDominated]
calcIC(signals, returns, lookback)
Parameters:
signals (float)
returns (float)
lookback (simple int)
classifyIC(currentIC, icWindow, goodPercentile, badPercentile)
Parameters:
currentIC (float)
icWindow (simple int)
goodPercentile (simple int)
badPercentile (simple int)
evaluateSignal(signal, forwardReturn)
Parameters:
signal (float)
forwardReturn (float)
updateOptimizerState(opt, signal, forwardReturn, currentIC, metaICPeriod)
Parameters:
opt (ICOptimizer)
signal (float)
forwardReturn (float)
currentIC (float)
metaICPeriod (simple int)
calcSuccessRate(successful, total)
Parameters:
successful (int)
total (int)
createICStatsTable(opt, paramName, normalSuccess, normalTotal)
Parameters:
opt (ICOptimizer)
paramName (string)
normalSuccess (int)
normalTotal (int)
initOptimizer(initialParam)
Parameters:
initialParam (float)
ICOptimizer
Fields:
currentParam (series float)
currentIC (series float)
metaIC (series float)
totalSignals (series int)
successfulSignals (series int)
goodICSignals (series int)
goodICSuccess (series int)
nonBadICSignals (series int)
nonBadICSuccess (series int)
goodICThreshold (series float)
badICThreshold (series float)
updateCounter (series int)
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。