PINE LIBRARY
Kerbal_Clouds

Library "kerbal_clouds"
Kerbal Indicators Shared Library - EMA/SMA Cloud Helpers
This library provides convenient functions for creating and managing moving average clouds (high/close/low based).
emaCloud(period)
Calculate EMA cloud values (high, close, low)
Parameters:
period (simple int): The EMA period
Returns: Tuple of [emaHigh, emaClose, emaLow]
cloudWidth(emaHigh, emaLow)
Calculate EMA cloud width
Parameters:
emaHigh (float): EMA of high
emaLow (float): EMA of low
Returns: Cloud width (emaHigh - emaLow)
cloudPosition(emaHigh, emaClose, emaLow)
Calculate price position within cloud (0-1 scale)
Parameters:
emaHigh (float): EMA of high
emaClose (float): EMA of close
emaLow (float): EMA of low
Returns: Position from 0 (at low) to 1 (at high)
distanceToCloud(price, emaHigh, emaLow)
Calculate distance from price to cloud
Parameters:
price (float): Current price to check
emaHigh (float): EMA of high
emaLow (float): EMA of low
Returns: Distance (positive if above cloud, negative if below, 0 if inside)
priceCloudRelation(price, emaHigh, emaLow)
Check if price is above, below, or within cloud
Parameters:
price (float): Current price
emaHigh (float): EMA of high
emaLow (float): EMA of low
Returns: Position string: "ABOVE", "BELOW", or "INSIDE"
smaCloud(period)
Calculate SMA cloud values (high, close, low)
Parameters:
period (int): The SMA period
Returns: Tuple of [smaHigh, smaClose, smaLow]
cloudStacking(shortHigh, shortLow, mediumHigh, mediumLow, longHigh, longLow)
Check if clouds are properly stacked (bullish or bearish)
Parameters:
shortHigh (float): Short period EMA high
shortLow (float): Short period EMA low
mediumHigh (float): Medium period EMA high
mediumLow (float): Medium period EMA low
longHigh (float): Long period EMA high
longLow (float): Long period EMA low
Returns: Stacking string: "BULLISH" (short > medium > long), "BEARISH" (short < medium < long), "MIXED"
cloudAlignment(shortClose, mediumClose, longClose)
Calculate cloud alignment score (0-100)
Parameters:
shortClose (float): Short period EMA close
mediumClose (float): Medium period EMA close
longClose (float): Long period EMA close
Returns: Alignment score (100 = perfect bullish, 0 = perfect bearish, 50 = mixed)
cloudTrendStrength(shortClose, mediumClose, longClose, atr)
Calculate trend strength based on cloud separation
Parameters:
shortClose (float): Short period EMA close
mediumClose (float): Medium period EMA close
longClose (float): Long period EMA close
atr (float): Current ATR for normalization
Returns: Trend strength (-1 to 1, negative for bearish, positive for bullish)
cloudSqueeze(shortWidth, mediumWidth, longWidth, atr, threshold)
Detect cloud squeeze (compression)
Parameters:
shortWidth (float): Short cloud width
mediumWidth (float): Medium cloud width
longWidth (float): Long cloud width
atr (float): Current ATR
threshold (float): Squeeze threshold (width/ATR ratio)
Returns: True if all clouds are squeezed below threshold
bullishCloudCross(price, cloudHigh)
Detect bullish cloud crossover
Parameters:
price (float): Current price
cloudHigh (float): Cloud high boundary
Returns: True if price crossed above cloud
bearishCloudCross(price, cloudLow)
Detect bearish cloud crossover
Parameters:
price (float): Current price
cloudLow (float): Cloud low boundary
Returns: True if price crossed below cloud
tripleCloud(shortPeriod, mediumPeriod, longPeriod)
Calculate triple cloud system (short, medium, long periods)
Parameters:
shortPeriod (simple int): Short EMA period
mediumPeriod (simple int): Medium EMA period
longPeriod (simple int): Long EMA period
Returns: Tuple of 9 values: [shortH, shortC, shortL, mediumH, mediumC, mediumL, longH, longC, longL]
cloudTrendColor(emaClose, emaPrevClose, bullishColor, bearishColor)
Get cloud color based on position and trend
Parameters:
emaClose (float): EMA close value
emaPrevClose (float): Previous EMA close value
bullishColor (color): Color for bullish/rising cloud
bearishColor (color): Color for bearish/falling cloud
Returns: Appropriate cloud color
Kerbal Indicators Shared Library - EMA/SMA Cloud Helpers
This library provides convenient functions for creating and managing moving average clouds (high/close/low based).
emaCloud(period)
Calculate EMA cloud values (high, close, low)
Parameters:
period (simple int): The EMA period
Returns: Tuple of [emaHigh, emaClose, emaLow]
cloudWidth(emaHigh, emaLow)
Calculate EMA cloud width
Parameters:
emaHigh (float): EMA of high
emaLow (float): EMA of low
Returns: Cloud width (emaHigh - emaLow)
cloudPosition(emaHigh, emaClose, emaLow)
Calculate price position within cloud (0-1 scale)
Parameters:
emaHigh (float): EMA of high
emaClose (float): EMA of close
emaLow (float): EMA of low
Returns: Position from 0 (at low) to 1 (at high)
distanceToCloud(price, emaHigh, emaLow)
Calculate distance from price to cloud
Parameters:
price (float): Current price to check
emaHigh (float): EMA of high
emaLow (float): EMA of low
Returns: Distance (positive if above cloud, negative if below, 0 if inside)
priceCloudRelation(price, emaHigh, emaLow)
Check if price is above, below, or within cloud
Parameters:
price (float): Current price
emaHigh (float): EMA of high
emaLow (float): EMA of low
Returns: Position string: "ABOVE", "BELOW", or "INSIDE"
smaCloud(period)
Calculate SMA cloud values (high, close, low)
Parameters:
period (int): The SMA period
Returns: Tuple of [smaHigh, smaClose, smaLow]
cloudStacking(shortHigh, shortLow, mediumHigh, mediumLow, longHigh, longLow)
Check if clouds are properly stacked (bullish or bearish)
Parameters:
shortHigh (float): Short period EMA high
shortLow (float): Short period EMA low
mediumHigh (float): Medium period EMA high
mediumLow (float): Medium period EMA low
longHigh (float): Long period EMA high
longLow (float): Long period EMA low
Returns: Stacking string: "BULLISH" (short > medium > long), "BEARISH" (short < medium < long), "MIXED"
cloudAlignment(shortClose, mediumClose, longClose)
Calculate cloud alignment score (0-100)
Parameters:
shortClose (float): Short period EMA close
mediumClose (float): Medium period EMA close
longClose (float): Long period EMA close
Returns: Alignment score (100 = perfect bullish, 0 = perfect bearish, 50 = mixed)
cloudTrendStrength(shortClose, mediumClose, longClose, atr)
Calculate trend strength based on cloud separation
Parameters:
shortClose (float): Short period EMA close
mediumClose (float): Medium period EMA close
longClose (float): Long period EMA close
atr (float): Current ATR for normalization
Returns: Trend strength (-1 to 1, negative for bearish, positive for bullish)
cloudSqueeze(shortWidth, mediumWidth, longWidth, atr, threshold)
Detect cloud squeeze (compression)
Parameters:
shortWidth (float): Short cloud width
mediumWidth (float): Medium cloud width
longWidth (float): Long cloud width
atr (float): Current ATR
threshold (float): Squeeze threshold (width/ATR ratio)
Returns: True if all clouds are squeezed below threshold
bullishCloudCross(price, cloudHigh)
Detect bullish cloud crossover
Parameters:
price (float): Current price
cloudHigh (float): Cloud high boundary
Returns: True if price crossed above cloud
bearishCloudCross(price, cloudLow)
Detect bearish cloud crossover
Parameters:
price (float): Current price
cloudLow (float): Cloud low boundary
Returns: True if price crossed below cloud
tripleCloud(shortPeriod, mediumPeriod, longPeriod)
Calculate triple cloud system (short, medium, long periods)
Parameters:
shortPeriod (simple int): Short EMA period
mediumPeriod (simple int): Medium EMA period
longPeriod (simple int): Long EMA period
Returns: Tuple of 9 values: [shortH, shortC, shortL, mediumH, mediumC, mediumL, longH, longC, longL]
cloudTrendColor(emaClose, emaPrevClose, bullishColor, bearishColor)
Get cloud color based on position and trend
Parameters:
emaClose (float): EMA close value
emaPrevClose (float): Previous EMA close value
bullishColor (color): Color for bullish/rising cloud
bearishColor (color): Color for bearish/falling cloud
Returns: Appropriate cloud color
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.