cTrader Algo enables you to draw clouds between lines on a chart. Such clouds allow you to quickly identify key areas on charts and detect shifts in market behaviour.
In this article and its corresponding video, we will show you how to add and customise clouds in indicators.
Add an indicator
A typical Bollinger Bands indicator consists of an upper band, a lower band and a simple moving average in the middle. To enhance the indicator appearance, we plan to fill the space between the bands with a cloud.
To create the indicator, open the Algo app and navigate to the Indicators tab. Click the New button, type in a name for the indicator, such as "Bollinger Bands Cloud" then click the Create button.
We can now modify the indicator code. We will make our example an overlay indicator.
Click Build or use the Ctrl+B shortcut to build the indicator.
Add an indicator instance for the EURUSD symbol.
You should see a typical Bollinger Bands indicator on the chart.
Add a cloud to Bollinger Bands
Now, we return to the code editor and then work on adding a cloud between the bands.
To achieve our goal, we add the Cloud attribute to the existing indicator. The Cloud attribute instructs the indicator to draw a cloud between the Top and Bottom lines.
We rebuild the algorithm and then check our indicator to see what has changed.
You should see a red cloud between the bands. If you change the Top line colour, the cloud colour will be updated automatically.
We return to the code editor and change the Cloud attribute to draw a cloud only before the Main (yellow) line.
1
[Cloud("Top", "Main", Opacity = 0.2)]
Rebuild the indicator and then check it to confirm its new look.
Add cloud to MA crossover
We will create a new indicator and use it to demonstrate how clouds with different colours can be added to a chart. We intend to develop a Moving Average (MA) Crossover indicator with a green cloud for uptrends and red cloud for downtrends.
Repeat the steps from the previous section to create a new indicator. This time, the indicator name should be "MA Cloud".
We start modifying the new indicator by setting its IsOverlay property to True.
Repeat the step from the previous example (Bollinger Bands). Initialise the moving averages and pass the resulting values to the lines so that they are displayed on the chart.