The "Avg" calculation method, along with the "Rank" and "Percentile", are probably the most important calculation methods for the composite function. You can read more about the first method here (Market Indicators 2), however for the two others (rank and percentile), you will have to wait a few weeks for another part of this how to create market indicators using the composite function post series. In the first post we have introduced the "Count" and "Sum" function (Market Indicators). There are some other methods that can be also important and very useful in certain situations. These methods allow you to calculate the maximum value for each bar and given an indicator or time series applied to several securities, the minimum value and the standard deviation of the values that occurred during the same date. Here is an example on how it works: Given the following formula: Comp(rsi(14), "Max") And the following Relative Strength Index values: GOOG 10/05/2010 – 40 11/05/2010 – 42 12/05/2010 - 50 MSFT 10/05/2010 – 30 11/05/2010 – 48 12/05/2010 - 42 C 10/05/2010 – 41 11/05/2010 – 40 12/05/2010 - 39 Our composite formula will return the following values: Max Composite Indicator: 10/05/2010 - 41 (This is because on 10/05/2010, 41 was the highest value) 11/05/2010 – 48 12/05/2010 - 50 Example of market indicators: Comp(perf(close, 1), "Max") A trading indicator that calculates the maximum stock increase from previous close, among all stocks in your list of symbols. Comp(perf(close, 1), "Min") A market indicator that is similar to the one described above with the difference that it calculates the minimum stock increase from the previous close instead of the maximum increase. Comp(perf(close, 1), "Sdv") This trading indicator calculates the standard deviation of the different one-bar stock's returns that occurred on the same date. This is a measure of the volatility of these populations; the market indicator will show you how the volatility of the one-bar stock's returns evolve over time. We can also add another composite in order to calculate the z-score or standard score of the one-bar return of each stock. The calculation requires that we also calculate the mean of the population and this can be done using the "Avg" calculation method. So, here is the complete formula: pe = perf(close, 1); zscore = pe - Comp(pe, "Avg"); zscore = zscore / Comp(pe, "Sdv"); Through this series of posts, we have already presented six calculation methods that allow you to create divers and powerful market trading indicators. Stay tuned as we will introduce you two very powerful functions, the "rank" and "percentile", in the next post.
|