Purple Cloud Indicator

Purple Cloud Indicator

1. Introduction

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.

2. Indicator Components

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:

2.1 SuperTrend

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.

  • SuperTrend Parameters:
    • atrperiod: Defines the length of the ATR (Average True Range), a volatility indicator used to calculate the SuperTrend bands. In Purple Cloud, the default value is 10.
    • factor: Represents the multiplier applied to the ATR to define the distance of the SuperTrend bands from the price. In this case, the default value is 3. A higher factor smooths the signals, while a lower factor makes them more sensitive to market movements.

2.2 Upper and Lower Bands

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.

  • Band Calculation:
    • The upper band (xh) is calculated as the closing price plus a fraction of the ATR multiplied by the volatility factor (alpha), with a default value of 0.7.
    • The lower band (xl) is calculated similarly but subtracting the fraction of the ATR instead of adding it.

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.

2.3 Buy and Sell Signals

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.

  • Buying/Selling Pressure:
    • bpt (Buying Pressure Threshold) defines the threshold for a valid buy signal. In the code, its default value is 1.4.
    • spt (Selling Pressure Threshold) defines the threshold for sell signals, also with a default value of 1.4.

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.

2.4 Moving Averages (EMAs)

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.

  • EMA 20: Short-term moving average that helps detect quick trend changes.
  • EMA 50: Medium-term moving average used to identify the strength of the current trend.
  • EMA 200: Long-term moving average that serves as a key reference for defining the primary trend.

2.5 Candle Coloring

Purple Cloud offers the option to color candles based on the trend direction detected by the indicator:

  • Cyan: Indicates a confirmed bullish trend.
  • Fuchsia: Indicates a confirmed bearish trend.

This visual color coding helps traders quickly identify market direction without the need to analyze each technical element separately.

3. Indicator Configuration

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.

3.1 ATR Period (atrperiod)

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.

  • Recommendation: For volatile markets or assets with fast movements, it is recommended to use a lower value (e.g., 7). For more stable assets, a higher value (e.g., 14) can help reduce false signals.

3.2 SuperTrend Factor (factor)

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.

  • Recommendation: A lower value may generate more signals, but it can also increase the risk of false signals in volatile markets. A higher value is more conservative and can be useful for identifying more defined trends.

3.3 Buying and Selling Pressure Threshold (bpt and spt)

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.

  • bpt (Buying Pressure Threshold): Default value of 1.4%. This means the price must be at least 1.4% above the lower band to generate a buy signal.
  • spt (Selling Pressure Threshold): Default value of 1.4%. This means the price must be at least 1.4% below the upper band to trigger a sell signal.

3.4 Optional Visualization

Purple Cloud offers several visualization options to suit user preferences:

  • drawsupertrend: Enables or disables SuperTrend visualization. If activated (default value 1), the SuperTrend will be displayed as a line on the chart.
  • drawemas: Allows the user to show or hide exponential moving averages (EMAs) of 20, 50, and 200 periods. The default value is 1 (enabled).
  • colorcandles: If activated (value 1), the candles will be colored depending on market direction: cyan for bullish trends and fuchsia for bearish trends.
  • drawsignals: Enables or disables the display of buy and sell signals on the chart. If activated (value 1), labels such as “BUY,” “SELL,” “STRONG BUY,” or “STRONG SELL” will be shown when the conditions are met.

4. Practical Application

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.

4.1 Interpreting Buy and Sell 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.

  • Buy Signal (BUY): A buy signal is triggered when the buysignal condition is met (the price falls below the lower band, xl) and the trend changes (xs <> xs[1]). This indicates a potential bullish reversal. Additionally, if the price is above the SuperTrend at the time of the signal, it is considered a “STRONG BUY”, reinforcing the likelihood of a significant upward move.
  • Sell Signal (SELL): A sell signal is triggered when the price crosses the upper band (xh) and the trend changes (xs <> xs[1]), suggesting a potential bearish reversal. If the price is below the SuperTrend, the signal is classified as “STRONG SELL”, indicating a higher probability of a downward movement.

4.2 Using SuperTrend for Confirmation

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.

  • Bullish Confirmation (STRONG BUY): If the price is above the SuperTrend when a buy signal is generated, this is classified as a “STRONG BUY”. This indicates that the bullish trend is stronger and more likely to continue.
  • Bearish Confirmation (STRONG SELL): Similarly, if the price is below the SuperTrend when a sell signal is generated, it is classified as a “STRONG SELL”, suggesting that the bearish trend is strong and expected to continue.

4.3 Suggested Trading Strategies

Reversal Strategy with Trend Confirmation

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:

  1. Long Entry (buy): Open a long position when the Purple Cloud issues a “BUY” signal (or preferably, a “STRONG BUY” if the price is above the SuperTrend).
  2. Short Entry (sell): Open a short position when a “SELL” signal is generated (or “STRONG SELL” if the price is below the SuperTrend).
  3. Exit Position: Close the position when a contrary signal is generated, or when the price crosses back over the SuperTrend.
Moving Averages Strategy

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:

  1. Bullish Trend: If the 20-period EMA crosses above the 50-period EMA, this reinforces buy signals from the indicator.
  2. Bearish Trend: If the 20-period EMA crosses below the 50-period EMA, it reinforces sell signals, suggesting that the downtrend is holding.

4.4 Indicator Optimization

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.

5. Indicator Code in ProBuilder

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.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. roccafragius • 194 days ago #

    Hello Ivan, very good job! May I ask you to translate teh script from TradingView named Trendline Pivots [QuantVue] ? It’s very useful!!! Thank you in advance!!!

    • Iván • 193 days ago #

      Hi! yes.
      You can ask for it here: https://www.prorealcode.com/free-code-conversion/

  2. roccafragius • 189 days ago #

    Thank you so much Ivan! I created this request in english Translate from TradingView Indicator:Trendline Pivots [QuantVue] , I see many value also in this indicator, thank you anyway in advance!!!

  3. ipbvba • 30 days ago #

    Hello, Is it possible to have a screener for the various buy and sell signals?

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Daniele Maddaluno Écrivez-moi où vous préférez you can easily find me on LinkedIn
AK27 C'est payant visiblement sur linkdin je peux pas vous envoyer, discord vous avez ?
Pensera Bonjour Nicolas, comment est-il possible de backtester cet indicateur? cela fait une erreu...
Nicolas Oui bien sûr, il doit y avoir pas mal de sujets dans le forum à ce propos.
simmerseb Bonjour, merci beaucoup pour cet indicateur je le trouve très clair et pertinent.
IV Mcm V2 is coming
SudhirRN is this code working for on tradingview plartform?
Nicolas No. All our codes are made to be used with ProRealTime trading platform: https://www.proreal...
Nicolas Il doit s'agir d'un mauvais copier/coller. Je suggère de télécharger le fichier itf contenu ...
Bard Hello @Nicolas, I can get this to display in a separate indicator panel but not on Price as ...
Stenozar Hi @Nicolas, how can I put the bands on price? Thanks, Stefano
mickey992 salut merci pour ton partage et ton travaille
patapouf Hi Vivien René I just discovered your “Ordered trend-following stocks Screener”. Great work...
Nicolas Oui le code est correct et il fonctionne, j'ai de bons résultats sur la liste NASDAQ par exe...
pincherman Bonjour :-) J'ai coller le script dans prorealtime pour jouer avec le supertrend et j'ai un...
Nicolas Vous l'avez sans doute collé au mauvais endroit, dans l'éditeur de code pour les stratégies,...
Guillaume Mcm I gave the above message fix ;)
Tradingrob Is it possible to put the itf-file in the right way here in Prorealcode? so the right 'trend...
Guillaume Mcm Update link ;) https://www.prorealcode.com/topic/trend-histogramme-cci-mise-a-jour-suite-...
Screw27 Hi man, I installed the indicator and i don't know why but my graph it is so big
HelixKing sounds interesting I'll take a look
Godo Bonjour Souhait Sam, Après de nombreux essais pour le mettre en format afin d'utiliser ce c...
Nicolas Il faut supprimer celles qui existent dans la fenêtre d'optimisation et les créer en dur dan...
crusoe76 hi there, anyone can help making this strategy work, i have a message saying replace variabl...
Screw27 Salut nicolas j'aimerais savoir tes résulats grace a cettte methode
eva.g.forsgren It dose not work, I get a strap instead of candels???????????????????????????????????????????
Nicolas That indicator is the one below the chart. The indicator to put on the price chart is this o...
pyhrus P.S : IG , que j'ai contacté ,m'indique que la version V11 , ne sera pas disponible avant un...
Hasardeur Dear Nicolas, is there someting at the arry to modify in order to run the trend at the actu...
MALIMALO Dear Nicolas, just try touse your indicator with backtest but it's not working. is anybody...
ribes65 Bonjour Nicolas, Merci pour votre travail. Est-il envisageable de créer un screener pour ...
Nicolas Bien sûr, merci de formuler une demande dans le forum des screeners pour prorealtime. En res...
ipbvba Est il possible de le transformer en indicateur (pour ne plus avoir les lignes mais uniqueme...
supertiti Bonjour Nicolas, Je ne comprend pas bien , le trend change de couleur quand les prix sont a...
Nicolas Oui ce serait possible, cependant l'indicateur est bien prévu pour conserver la couleur de l...
supertiti Quand tu pourras si tu peux nous coder la troisième couleur cela améliorerait les trades cou...
Nicolas How to import file page: in the help section of the website explains howto
kenssa import through the indicator page/window in the Proreal time
chicoteca Buenas, no consigo que se me muestre en el chart de DAX. ¿Cómo procedo? Gracias.-
Ciccarelli Franco Per lasciare che la strategia venga eseguita (dopo aver importato il file): Basta eliminare...
JADINVEST Hello Jan, hello everyone, Thanks Jan for this strategy! Since 2020, have any of you found a...
Alessandro Furlani Hi Ian, hope you still use PRT and so you can read this post. I have tested a lot your work ...
Stockastiss Can this code be simply transferred into Backtestingcode so one doesnt need to use call ? (i...
Vonasi Sorry for the late reply. Add the code to your strategy and remove line 5 and line 39. Chang...
viktorthunss Hi! How many averages are there? Can I see the somewhere?
leofi https://www.prorealcode.com/topic/simple-average-with-visual-color/
leofi Go visit www.prorealcode.com/topic/simple-average-with-visual-color/ and watch 2em post
Dritan Hi,I am new on Prorealtime and coding.I downloaded the indi but I have it on a separate wind...
Alps007 Hi Nicolas. Happy New Year. Can you please program me several MACD divergence screeners ...
Arlei Zanin Hello Nicolas, would it be possible to convert the Cloud to Pascal language? Thank you.
ashee i want it in MT4

Top