Click here to Login

How to create market indicators using the composite function - Part 1

Updated on 2010-07-13

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:
Comp(1, "count")
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.

Comp(close, "sum")
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.

Other examples:
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.

2 comments (Log in)

QuantShare Blog
Search Posts

Recent Posts

Create Graphs using the Grid Tool
Posted 1269 days ago

Profile Graphs
Posted 1374 days ago

Previous Posts

Correlation of market indicators
Posted 5128 days ago

Backtesting Process
Posted 5142 days ago

Trading software new features
Posted 5148 days ago

More Posts


Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.