Trading With an Edge. Yes, it is possible with the composite indicator. This powerful tool lets you create simple and advanced market indicators with a single line. Please take a look at the following post (Create a stock index or a trading indicator using the composite tools) for the difference between the composite indicator and the composite plug-in.
The composite indicator allow you to use several calculation methods to create market indicators. The different methods are: Count, Sum, Average, Max, Min, Percentile, Rank, SDV (Standard Deviation).
We will explain each method and provide several examples of market indicators for each one of them. We will start with the first two calculation types: Count and Sum.
"Count" simply instructs the trading software to create indicators that calculate the number of times the function was hit for each trading day. This calculates the number of existing symbol's quotes for each trading day. The time series provided in the first parameter is ignored.
Examples of market indicators:
This creates an indicator that calculates the number of stocks that have quotes for each bar.
Comp(volume > ref(volume, 1), "count")
This indicator is exactly the same as the previous one. With the "Count" method, the volume trading rule is simply ignored.
The "Sum" calculation method creates an index that sums the values of the time series that occurred on the same date.
Examples of market indicators using "Sum":
On 01/01/2010, Stock A closed at 10$, then closed at 11$ on 02/01/2010.
On 01/01/2010, Stock B closed at 2$, then closed at 2.5$ on 02/01/2010.
This trading indicator sums stock's close prices.
On 01/01/2010, the market indicator returns 12 and on 02/01/2010 it returns 13.5.
Comp(rsi(14) > 70, "sum")
This market indicator calculates the number of stocks that are overbought. A stock is usually overbought when its Relative Strength index is higher than 70.
Comp(close > sma(30), "sum")
Here is a market indicator that calculates the number of stocks that closed above their 30-bar simple moving average.
Comp(close > ref(close, 1), "sum")
Here is how to create a popular market breadth index called advancing stocks. It returns the number of stocks that are advancing, that is, the close price of these stocks is higher than their yesterday's close price.
This is it for the "Count" and "Sum" indicator methods, please ask your questions and leave your comments below. You can also use the forum for questions.
In future posts, we will continue our presentation of the different calculation methods that can be used to create market indicators with the composite function.