PINE LIBRARY
AssetCorrelationLibrary

Library "AssetCorrelationLibrary™"
detectIndicesFutures(ticker)
Detects Index Futures (NQ/ES/YM/RTY + micro variants)
Parameters:
ticker (string): The ticker string to check (typically syminfo.ticker)
Returns: AssetPairing with secondary and tertiary assets configured
detectMetalsFutures(ticker)
Detects Metal Futures (GC/SI/HG + micro variants)
Parameters:
ticker (string): The ticker string to check
Returns: AssetPairing with secondary and tertiary assets configured
detectForexFutures(ticker)
Detects Forex Futures (6E/6B + micro variants)
Parameters:
ticker (string): The ticker string to check
Returns: AssetPairing with secondary and tertiary assets configured
detectEnergyFutures(ticker)
Detects Energy Futures (CL/RB/HO + micro variants)
Parameters:
ticker (string): The ticker string to check
Returns: AssetPairing with secondary and tertiary assets configured
detectTreasuryFutures(ticker)
Detects Treasury Futures (ZB/ZF/ZN)
Parameters:
ticker (string): The ticker string to check
Returns: AssetPairing with secondary and tertiary assets configured
detectForexCFD(ticker, tickerId)
Detects Forex CFD pairs (EUR/GBP/DXY, USD/JPY/CHF triads)
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID (syminfo.tickerid) for primary asset
Returns: AssetPairing with secondary and tertiary assets configured
detectCrypto(ticker, tickerId)
Detects major Crypto assets (BTC, ETH, SOL, XRP, alts)
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with secondary and tertiary assets configured
detectMetalsCFD(ticker, tickerId)
Detects Metals CFD (XAU/XAG/Copper)
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with secondary and tertiary assets configured
detectIndicesCFD(ticker, tickerId)
Detects Indices CFD (NAS100/SP500/DJ30)
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with secondary and tertiary assets configured
detectEUStocks(ticker, tickerId)
Detects EU Stock Indices (GER40/EU50) - Dyad only
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with secondary asset configured (tertiary empty for dyad)
getDefaultFallback(tickerId)
Returns default fallback assets (chart ticker only, no correlation)
Parameters:
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with chart ticker as primary, empty secondary/tertiary (no correlation)
applySessionModifierWithBackadjust(tickerStr, sessionType)
Applies futures session modifier to ticker WITH back adjustment
Parameters:
tickerStr (string): The ticker to modify
sessionType (string): The session type (syminfo.session)
Returns: Modified ticker string with session and backadjustment.on applied
applySessionModifierNoBackadjust(tickerStr, sessionType)
Applies futures session modifier to ticker WITHOUT back adjustment
Parameters:
tickerStr (string): The ticker to modify
sessionType (string): The session type (syminfo.session)
Returns: Modified ticker string with session and backadjustment.off applied
isTriadMode(pairing)
Checks if a pairing represents a valid triad (3 assets)
Parameters:
pairing (AssetPairing): The AssetPairing to check
Returns: True if tertiary is non-empty (triad mode), false for dyad
getAssetTicker(tickerId)
Extracts clean ticker string from full ticker ID
Parameters:
tickerId (string): The full ticker ID (e.g., "BITGET:BTCUSDT.P")
Returns: Clean ticker string (e.g., "BTCUSDT.P")
resolveTriad(chartTickerId, pairing)
Resolves triad asset assignments with proper inversion flags
Parameters:
chartTickerId (string): The current chart's ticker ID (syminfo.tickerid)
pairing (AssetPairing): The detected AssetPairing
Returns: Tuple [primaryAsset, secondaryAsset, tertiaryAsset, invertSecondary, invertTertiary]
resolveDyad(chartTickerId, pairing)
Resolves dyad asset assignment with proper inversion flag
Parameters:
chartTickerId (string): The current chart's ticker ID
pairing (AssetPairing): The detected AssetPairing (dyad: tertiary is empty)
Returns: Tuple [primaryAsset, secondaryAsset, invertSecondary]
resolveAssets(ticker, tickerId, assetType, sessionType, useBackadjust)
Main auto-detection entry point. Detects asset category and returns fully resolved config.
Parameters:
ticker (string): The ticker string to check (typically syminfo.ticker)
tickerId (string): The full ticker ID (typically syminfo.tickerid)
assetType (string): The asset type (typically syminfo.type)
sessionType (string): The session type for futures (typically syminfo.session)
useBackadjust (bool): Whether to apply back adjustment for futures session alignment
Returns: AssetConfig with fully resolved assets, inversion flags, and detection status
resolveCurrentChart()
Simplified auto-detection using current chart's syminfo values
Returns: AssetConfig with fully resolved assets, inversion flags, and detection status
AssetPairing
Core asset pairing structure for triad/dyad configurations
Fields:
primary (series string): The primary (chart) asset ticker ID
secondary (series string): The secondary correlated asset ticker ID
tertiary (series string): The tertiary correlated asset ticker ID (empty for dyad)
invertSecondary (series bool): Whether secondary asset should be inverted for divergence calc
invertTertiary (series bool): Whether tertiary asset should be inverted for divergence calc
AssetConfig
Full asset resolution result with mode detection and computed values
Fields:
detected (series bool): Whether auto-detection succeeded
isTriadMode (series bool): True if triad (3 assets), false if dyad (2 assets)
primary (series string): The resolved primary asset ticker ID
secondary (series string): The resolved secondary asset ticker ID
tertiary (series string): The resolved tertiary asset ticker ID (empty for dyad)
invertSecondary (series bool): Computed inversion flag for secondary asset
invertTertiary (series bool): Computed inversion flag for tertiary asset
assetCategory (series string): String describing the detected asset category
Note to potential users.
I did not really intend to make this public but i have to in order to avoid any potential compliance issues with the TradingView Moderation Team and the House Rules.
However if you are to use this library, you cannot make your code closed source / invite only as it is intellectual property. The only exception to this is if I am credited in the header of your code and i explicitly give permission to do so.
As per the TradingView house rules, you are completely FREE to do with this as you like, provided the script stays private.
Use the fstarcapital tag to give credits
❤️ from cephxs
detectIndicesFutures(ticker)
Detects Index Futures (NQ/ES/YM/RTY + micro variants)
Parameters:
ticker (string): The ticker string to check (typically syminfo.ticker)
Returns: AssetPairing with secondary and tertiary assets configured
detectMetalsFutures(ticker)
Detects Metal Futures (GC/SI/HG + micro variants)
Parameters:
ticker (string): The ticker string to check
Returns: AssetPairing with secondary and tertiary assets configured
detectForexFutures(ticker)
Detects Forex Futures (6E/6B + micro variants)
Parameters:
ticker (string): The ticker string to check
Returns: AssetPairing with secondary and tertiary assets configured
detectEnergyFutures(ticker)
Detects Energy Futures (CL/RB/HO + micro variants)
Parameters:
ticker (string): The ticker string to check
Returns: AssetPairing with secondary and tertiary assets configured
detectTreasuryFutures(ticker)
Detects Treasury Futures (ZB/ZF/ZN)
Parameters:
ticker (string): The ticker string to check
Returns: AssetPairing with secondary and tertiary assets configured
detectForexCFD(ticker, tickerId)
Detects Forex CFD pairs (EUR/GBP/DXY, USD/JPY/CHF triads)
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID (syminfo.tickerid) for primary asset
Returns: AssetPairing with secondary and tertiary assets configured
detectCrypto(ticker, tickerId)
Detects major Crypto assets (BTC, ETH, SOL, XRP, alts)
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with secondary and tertiary assets configured
detectMetalsCFD(ticker, tickerId)
Detects Metals CFD (XAU/XAG/Copper)
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with secondary and tertiary assets configured
detectIndicesCFD(ticker, tickerId)
Detects Indices CFD (NAS100/SP500/DJ30)
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with secondary and tertiary assets configured
detectEUStocks(ticker, tickerId)
Detects EU Stock Indices (GER40/EU50) - Dyad only
Parameters:
ticker (string): The ticker string to check
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with secondary asset configured (tertiary empty for dyad)
getDefaultFallback(tickerId)
Returns default fallback assets (chart ticker only, no correlation)
Parameters:
tickerId (string): The full ticker ID for primary asset
Returns: AssetPairing with chart ticker as primary, empty secondary/tertiary (no correlation)
applySessionModifierWithBackadjust(tickerStr, sessionType)
Applies futures session modifier to ticker WITH back adjustment
Parameters:
tickerStr (string): The ticker to modify
sessionType (string): The session type (syminfo.session)
Returns: Modified ticker string with session and backadjustment.on applied
applySessionModifierNoBackadjust(tickerStr, sessionType)
Applies futures session modifier to ticker WITHOUT back adjustment
Parameters:
tickerStr (string): The ticker to modify
sessionType (string): The session type (syminfo.session)
Returns: Modified ticker string with session and backadjustment.off applied
isTriadMode(pairing)
Checks if a pairing represents a valid triad (3 assets)
Parameters:
pairing (AssetPairing): The AssetPairing to check
Returns: True if tertiary is non-empty (triad mode), false for dyad
getAssetTicker(tickerId)
Extracts clean ticker string from full ticker ID
Parameters:
tickerId (string): The full ticker ID (e.g., "BITGET:BTCUSDT.P")
Returns: Clean ticker string (e.g., "BTCUSDT.P")
resolveTriad(chartTickerId, pairing)
Resolves triad asset assignments with proper inversion flags
Parameters:
chartTickerId (string): The current chart's ticker ID (syminfo.tickerid)
pairing (AssetPairing): The detected AssetPairing
Returns: Tuple [primaryAsset, secondaryAsset, tertiaryAsset, invertSecondary, invertTertiary]
resolveDyad(chartTickerId, pairing)
Resolves dyad asset assignment with proper inversion flag
Parameters:
chartTickerId (string): The current chart's ticker ID
pairing (AssetPairing): The detected AssetPairing (dyad: tertiary is empty)
Returns: Tuple [primaryAsset, secondaryAsset, invertSecondary]
resolveAssets(ticker, tickerId, assetType, sessionType, useBackadjust)
Main auto-detection entry point. Detects asset category and returns fully resolved config.
Parameters:
ticker (string): The ticker string to check (typically syminfo.ticker)
tickerId (string): The full ticker ID (typically syminfo.tickerid)
assetType (string): The asset type (typically syminfo.type)
sessionType (string): The session type for futures (typically syminfo.session)
useBackadjust (bool): Whether to apply back adjustment for futures session alignment
Returns: AssetConfig with fully resolved assets, inversion flags, and detection status
resolveCurrentChart()
Simplified auto-detection using current chart's syminfo values
Returns: AssetConfig with fully resolved assets, inversion flags, and detection status
AssetPairing
Core asset pairing structure for triad/dyad configurations
Fields:
primary (series string): The primary (chart) asset ticker ID
secondary (series string): The secondary correlated asset ticker ID
tertiary (series string): The tertiary correlated asset ticker ID (empty for dyad)
invertSecondary (series bool): Whether secondary asset should be inverted for divergence calc
invertTertiary (series bool): Whether tertiary asset should be inverted for divergence calc
AssetConfig
Full asset resolution result with mode detection and computed values
Fields:
detected (series bool): Whether auto-detection succeeded
isTriadMode (series bool): True if triad (3 assets), false if dyad (2 assets)
primary (series string): The resolved primary asset ticker ID
secondary (series string): The resolved secondary asset ticker ID
tertiary (series string): The resolved tertiary asset ticker ID (empty for dyad)
invertSecondary (series bool): Computed inversion flag for secondary asset
invertTertiary (series bool): Computed inversion flag for tertiary asset
assetCategory (series string): String describing the detected asset category
Note to potential users.
I did not really intend to make this public but i have to in order to avoid any potential compliance issues with the TradingView Moderation Team and the House Rules.
However if you are to use this library, you cannot make your code closed source / invite only as it is intellectual property. The only exception to this is if I am credited in the header of your code and i explicitly give permission to do so.
As per the TradingView house rules, you are completely FREE to do with this as you like, provided the script stays private.
Use the fstarcapital tag to give credits
❤️ from cephxs
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
For access to my Invite Only Indicators, visit whop.com/fstarlabs/
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
For access to my Invite Only Indicators, visit whop.com/fstarlabs/
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.