PINE LIBRARY
Updated cloudTheory

Library "cloudTheory"
// OBJECTTIVE: A Combination of EMA to Draw Cloud Pattern on Chart
//
// The "2-EMA Line System" is one of the most oldest and durable
// frameworks in technical analysis where we plot one "fast" (short)
// and one "slow" (long) exponential moving average line on the same
// chart and their relationships determine the state of the security.
drawCloud(fastLength, slowLength, src)
Parameters:
fastLength (simple int): - Fast EMA Length, the shorter length which
typically determines the current rhythm of the security.
slowLength (simple int): - Slow EMA Length, the longer length which
determines the underlying drift of the security.
src (float): - Which value of the candle should be used to calculate
the moving average; defaults to candle close value.
Returns: [emaFast, emaSlow, isBullish, isBearish, isNeutral] - EMA
Values and the flags to determine the current sentiment.
// OBJECTTIVE: A Combination of EMA to Draw Cloud Pattern on Chart
//
// The "2-EMA Line System" is one of the most oldest and durable
// frameworks in technical analysis where we plot one "fast" (short)
// and one "slow" (long) exponential moving average line on the same
// chart and their relationships determine the state of the security.
drawCloud(fastLength, slowLength, src)
Parameters:
fastLength (simple int): - Fast EMA Length, the shorter length which
typically determines the current rhythm of the security.
slowLength (simple int): - Slow EMA Length, the longer length which
determines the underlying drift of the security.
src (float): - Which value of the candle should be used to calculate
the moving average; defaults to candle close value.
Returns: [emaFast, emaSlow, isBullish, isBearish, isNeutral] - EMA
Values and the flags to determine the current sentiment.
Release Notes
Updated:drawCloud(fastLength, slowLength, src)
Parameters:
fastLength (simple int): - Fast EMA Length, the shorter length which
typically determines the current rhythm of the security.
slowLength (simple int): - Slow EMA Length, the longer length which
determines the underlying drift of the security.
src (float): - Which value of the candle should be used to calculate
the moving average; defaults to candle close value.
Returns: [emaFast, emaSlow, mktSentiment] - EMA Values and a flag
to determine the market sentiment. The sentiment flag can be read
as: (I) '1' the security is bullish, (II) '-1' the security is
bearish and (III) '0' denotes the security is neutral.
Release Notes
v3Added:
priceAction(fastLength, slowLength, src, atrLength)
Parameters:
fastLength (simple int)
slowLength (simple int)
src (float)
atrLength (simple int)
Updated:
drawCloud(fastLength, slowLength, src)
Parameters:
fastLength (simple int): - Fast EMA Length, the shorter length which
typically determines the current rhythm of the security.
slowLength (simple int): - Slow EMA Length, the longer length which
determines the underlying drift of the security.
src (float): - Which value of the candle should be used to calculate
the moving average; defaults to candle close value.
Returns: [emaFast, emaSlow, mktSentiment, *Cross] - EMA Values and
a flag to determine the market sentiment. The sentiment flag can be
read as: (I) '1' the security is bullish, (II) '-1' the security is
bearish and (III) '0' denotes the security is neutral. The last two
values returned are the "EMA Cross" points. These values can be
directly used to determine the trend and set and altert.
------------------------------------------------------------------
Release Notes
v4Updated calculation of Price Action Values (experimental), now in bounded range of [-1, 1] which denotes the bearish to bullish market sentiment for the clouds. Recommend values are [-1, -0.25) can be considered as bearish, (-0.25, 0.25) as neutral market action while (0.25, 1] can be considered as bullish price action.
Release Notes
cloudTheory is a visualization extension of "2-EMA Line System", which can be used to provide visual confirmation based on the price action of the underlying. In addition, the library provides methods for calculating momentum using (I) the traditional method, and (II) Baz et al. CTA method.✨ Getting Started
The public (open-source) library is available at TradingView, and a rich documentation and usage guide is available at blog website. Import the library as below:
Then you can directly create editable fields and value control fields to implement the logic. To design the color schemes, it is recommended to use a three-toned system, and cross-over markings can be implemented as follows:
🔮 Drawing EMA Cloud
Use the function drawCloud() that returns the value of slow and fast moving averages along with the market sentiment and up/down crossing points.
📊 Price Action Value
The movement indicator and a tentative indication of the movement and entry point can be calculated using priceAction() function (check the function documentation for details).
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.