Click here to Login

Create a stock index or a trading indicator using the composite tools

Updated on 2010-06-15

There are two tools in QuantShare that at the first glance seem to perform the same task. Although it is true that these tools have the same name and have a lot of things in common, each one can perform things that are impossible for the other to do. These tools are the composite/index plug-in and the composite function.

In this post, we will describe and introduce each tool and enumerate each one's advantages.

The composite plug-in was developed first. Its main role is to create composites and indices using quotes and/or databases' data. Before creating a composite, you will have to open a form, add ticker symbols, formula, calculation method and some other optional settings. Once the composite is created, its data is associated with a ticker symbol; you can later display the symbol's data, reference it into formulas and use it to create trading rules.
The composite function doesn’t contain any forms, controls or buttons. It simply consists of a powerful vector-based function that you can use to create rules based on aggregate data of several securities (quotes, technical indicators, fundamental data...). With a single line, you can for example instruct the trading software to create a trading system that buys stocks when the difference between their close price and moving averages is two time higher the standard deviation of the same formula for all US stocks.

Advantage of the composite plug-in:
  • It associates the index or composite data with a ticker symbol and therefore you can plot quotes data as you do with any stock, currency or futures contract. Example, you can calculate then plot the advance-decline market breadth indicator for all stocks or only for stocks that are part of the Dow Jones Index

  • It lets you create complex indices using the .Net programming language. You can for example calculate several composites within the same item and use the c# language to create an indice based on these composites

Advantage of the composite function:
  • It requires only one line of code and can be easily used to create trading rules

  • It allows you to calculate the maximum, minimum, average, sum, count and standard deviation of all stocks and for each trading day

  • It lets you group data by any criteria. You can for example calculate the number of stocks within the same industry that crossed their moving average during the last 5 days. The values returned by the composite function will be different for stocks that are not in the same industry

  • You can reference an external list of symbols; the calculation will be based on this list and not on the list of symbols you are analyzing (Example: The list of stocks you are backtesting). Example: While backtesting stocks that trade in the US Stock Market, you can create a rule based on the aggregate data of FOREX or options symbols. Or you can backtest small cap stocks and use the function to create rules based on S&P 500 stocks

  • It allows you to calculate the percentile or rank of a stock for any given formula. Example: To buy stocks that are in the top 10% percentile for the relative strength index (RSI) technical indicator, you can simply type the following formula: comp(rsi(14), "percentile") >= 90

The main disadvantage of this function is that it can be used only by some plug-ins (Rules Analyzer, Ranking System Analyzer, Screener, Simulator, and Portfolio). You cannot use it for example to display data on a chart. The watch list plug-in cannot use it either.

To summarize, both tools allow you to create composites. While the main role of the first one is to analyze and display composites data, the second composite (function) is usually used to create trading rules. The latter let you also calculate the percentile and rank of an instrument for any given formula.

2 comments (Log in)

QuantShare Blog
Search Posts

Recent Posts

Create Graphs using the Grid Tool
Posted 1272 days ago

Profile Graphs
Posted 1377 days ago

Previous Posts

Correlation of market indicators
Posted 5131 days ago

Backtesting Process
Posted 5145 days ago

Trading software new features
Posted 5151 days ago

Optimization of a trading system
Posted 5166 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.