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
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.
Haftungsausschluss
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.