The Purple Cloud indicator is an advanced technical tool designed to help traders identify entry and exit points in the market, based on a combination of volatility bands, moving averages, and the popular SuperTrend. This indicator provides a clear visual representation of market conditions, making decision-making easier by showing buy and sell zones with colored candles and precise signals.
The Purple Cloud is mainly used in volatile markets or those with strong trends, where the use of volatility and price bands adjusted by volume pressure can provide high-probability signals. Additionally, it incorporates the ability to anticipate trend changes, making it ideal for both intraday and swing traders.
This indicator stands out for its ability to combine several key technical elements into a single visualization, allowing traders to cut through the market “noise” and focus on the most relevant signals. Furthermore, its versatility allows it to be applied across a wide range of assets, from stocks to currencies or cryptocurrencies.
The Purple Cloud indicator consists of several technical elements that, together, provide a comprehensive view of the market. Below, we detail each of these components:
The SuperTrend is a popular indicator that follows the trend using price and market volatility. In Purple Cloud, the SuperTrend is used to confirm buy and sell signals, and its visualization depends on the price’s behavior in relation to its level.
The Purple Cloud uses bands based on the ATR, adjusted by a volatility factor. These bands help identify overbought and oversold zones, functioning similarly to Bollinger Bands, but with direct integration of buying and selling pressure in the calculation.
These bands are combined with volume pressure through a weighted average, allowing the indicator to adjust to current market conditions and detect reversal points more accurately.
Buy and sell signals are generated when the price crosses the defined bands and meets certain buying and selling pressure thresholds. This helps filter out price movements that lack sufficient volume pressure to be considered trading opportunities.
When these conditions are met, the indicator marks signals such as “STRONG BUY,” “BUY,” “SELL,” or “STRONG SELL” depending on the strength of the price crossing the bands.
The indicator also incorporates three exponential moving averages (EMAs) of different periods (20, 50, and 200), allowing traders to identify short-, medium-, and long-term trends.
Purple Cloud offers the option to color candles based on the trend direction detected by the indicator:
This visual color coding helps traders quickly identify market direction without the need to analyze each technical element separately.
The Purple Cloud offers several configurable parameters, allowing users to customize the indicator’s behavior according to their needs and trading style. Below, we explain each parameter and how they affect the indicator’s performance.
This parameter defines the length of the Average True Range (ATR), which is the volatility indicator used to calculate the SuperTrend bands. A higher ATR value smooths the bands, making the indicator less sensitive to changes in volatility. By default, this value is set to 10.
This parameter determines the multiplier applied to the ATR to calculate the distance between the price and the SuperTrend bands. A higher value smooths the trend, while a lower value will make the SuperTrend more reactive. The default value is 3.
These parameters define the percentage thresholds for buying pressure (bpt) and selling pressure (spt). They are used to filter out weak signals and only display buy or sell opportunities that exceed these thresholds.
Purple Cloud offers several visualization options to suit user preferences:
The Purple Cloud indicator is designed to provide clear and precise signals under different market conditions. Below, we describe how to use this indicator in real-world situations and how to correctly interpret its signals.
The Purple Cloud generates buy and sell signals based on two key criteria: price crossing the volatility bands and a change in the direction of the trend as marked by the indicator (xs <> xs[1]). A buy or sell signal is only generated when both criteria are met.
The SuperTrend is used as an additional confirmation tool. Standard buy and sell signals (BUY/SELL) are generated when the price crosses the volatility bands, but the SuperTrend helps determine whether the trend is strong enough to classify the signal as “strong” or just a standard signal.
This strategy takes advantage of reversal points when the price crosses the Purple Cloud bands, and the trend changes. Buy and sell signals are used to open positions, with the SuperTrend confirming the signal’s strength.
Strategy Rules:
In less volatile markets, Purple Cloud‘s moving averages (EMAs) can be used to identify long-term trends, supporting buy and sell signals.
Strategy Rules:
The Purple Cloud is highly customizable, allowing users to adjust the parameters according to market conditions or their trading style. For example, a lower atrperiod or factor value will make the indicator more reactive, which can be useful in fast-moving markets, but it may also generate more false signals.
It is recommended to perform tests and backtesting with different assets and adjust the parameters based on the volatility and specific characteristics of the market being traded.
Below is the complete code for the Purple Cloud indicator in ProBuilder language, which you can use directly on your ProRealTime platform. This code includes the logic for calculating the SuperTrend, volatility bands, moving averages, and buy/sell signals, along with visualization options like candle coloring and signal representation on the chart.
//-----------------------------------------------------//
//PRC_Purple cloud
//version = 1
//09.09.2024
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//-----------------------------------------------------//
//-----Inputs------------------------------------------//
//-----------------------------------------------------//
atrperiod=10 //SuperTrend ATR length
factor=3 //Supertrend factor
x1=14
alpha=0.7
bpt=1.4//Buying Pressure Threshold %
spt=1.4//Selling Pressure Threshold %
drawsupertrend=1 //Draw Supertrend
drawemas=1 //Draw EMAs
colorcandles=1 //Color candles
drawsignals=1 //Draw Signals
//-----------------------------------------------------//
//-----SuperTrend--------------------------------------//
//-----------------------------------------------------//
St=Supertrend[factor,atrperiod]
//-----------------------------------------------------//
//-----Up and Down Bands-------------------------------//
//-----------------------------------------------------//
x2=averagetruerange[x1](close)*alpha
xh=close+x2
xl=close-x2
a1=VolumeAdjustedAverage[floor(x1/4)]((high+low)/2*volume)/VolumeAdjustedAverage[floor(x1/4)](volume)
a2=VolumeAdjustedAverage[floor(x1/2)]((high+low)/2*volume)/VolumeAdjustedAverage[floor(x1/2)](volume)
a3=2*a1-a2
a4=VolumeAdjustedAverage[x1](a3)
if barindex < x1 then
b1=average[x1](close)
else
b1=(b1[1]*(x1-1)+close)/x1
endif
a5=2*a4*b1/(a4+b1)
//-----------------------------------------------------//
//-----Buy and Sell Signals----------------------------//
//-----------------------------------------------------//
buysignal=a5<=xl and close>b1*(1+bpt*0.01)
sellsignal=a5>=xh and close<b1*(1-spt*0.01)
if buysignal then
xs=1
elsif sellsignal then
xs=-1
else
xs=xs[1]
endif
//-----------------------------------------------------//
//-----Plot--------------------------------------------//
//-----------------------------------------------------//
//Color Candles
if xs=1 and colorcandles then
drawcandle(open,high,low,close)coloured("cyan",100)
elsif xs=-1 and colorcandles then
drawcandle(open,high,low,close)coloured("fuchsia",100)
endif
//Plot Signals
if buysignal and xs<>xs[1] and close>st and drawsignals then
drawtext("STRONG BUY",barindex,low-tr)coloured("green")
drawtext("▲",barindex,low-0.25*tr)coloured("green")
elsif buysignal and xs<>xs[1] and drawsignals then
drawtext("BUY",barindex,low-tr)coloured("green")
drawtext("▲",barindex,low-0.25*tr)coloured("green")
elsif sellsignal and xs<>xs[1] and close<st and drawsignals then
drawtext("STRONG SELL",barindex,high+tr)coloured("red")
drawtext("▼",barindex,high+0.25*tr)coloured("red")
elsif sellsignal and xs<>xs[1] and drawsignals then
drawtext("SELL",barindex,high+tr)coloured("red")
drawtext("▼",barindex,high+0.25*tr)coloured("red")
endif
//Plot EMAs
if drawemas then
ema200=average[200,1](close)
ema50=average[50,1](close)
ema20=average[20,1](close)
else
ema200=undefined
ema50=undefined
ema20=undefined
endif
//Plot Supertrend
if drawsupertrend and close>st then
r=0
g=255
a=255
a2=100
elsif drawsupertrend and close<=st then
r=255
g=0
a2=100
else
a=0
a2=0
endif
colorbetween(close,st,"fuchsia",a2)
//-----------------------------------------------------//
return sT as "SuperTrend"coloured(r,g,0,a)style(line,3),ema200 as "EMA 200" style(line,4),ema50 as "EMA 50" style(line,3)coloured("lightblue"),ema20 as "EMA 20" style(line,2)coloured("orange")