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. קרא עוד בתנאים וההגבלות.