Boyan BONTCHEV1, Slav DANEV2 and Assen SHARLANDJIEV3
! " #$%&&!'
(
! " $ $ %' )
**
. , %/ 0
,
! " $ $1!' (
! " $ %1!' )
2
. , 3
4
5,
! " !$ &$$&' (
! " !$ #&%"' )
+
,
-
,*
"
+
+2
,
,
The financial services industry offers great opportunities both for the investors
and for the companies providing services to the investors. Most of the existing Web sites
offer similar services such as stock/index/options quotes, markets overview, most active
issues, etc. On other side, there are various tools for technical analysis, charting, and
stocks screening. The paper presents a newly developed 6 * 7
4
called
that offers for the retail investors the services
mentioned over. It provides a detailed explanation of the business cases and the essential
functionalities of the portal and the way of their realization based on Java server2side
technologies. Special attention is dedicated to the definition and evaluation of trading
strategies and to stock screening based on these trading strategies.
There are many Web sites offering financial services to retail and institutional investors.
Almost every brokerage firm operates its’ own Web site and offers online trading and other
online services [1, 2]. The financial services industry offers great opportunities both for the
investors and for the companies providing services to the investors. Speculating in the stock
markets is very popular in the United States and Europe, where the number of retail investors
(i.e., online traders) is increasing every year. The demand for services offered to the retail
investors is also growing.
Most of the existing Web portals offer similar services. For the stock market the investors
can find similar information on almost every financial Web site, such as stock quotes, index1
quotes, markets overview, indices news [3], most active issues, etc. As well, there are some
stock screening tools and community services like message boards, chat, financial/investor
clubs, events, investment games, etc.
On other side, there are various tools (most of them not available on2line) for technical
analysis, charting, online research and stocks screening [1, 3, 4]. Based on our personal
experience as retail investors, we develop a 6 * 7
4
called
that offers services rear to be found on any other existing financial Web site
and, in the same time, very useful to the retail investor. The traditional market overview and
stock trading simulation is combined with some technical analyses via Web typical for
advanced desktop tools. For the moment, the portal includes managing user’s profiles,
1
An index is a single descriptive statistic that summarizes the relative change in an underlying group of variables
[3]
definition and evaluation of trading strategies, strategies stock screening, and E2mail and
wireless alerting.
The paper is focused mainly to the stock screening based on user’s trading strategies and its
implementation based on Java server2side technologies. After a review of modern stock trading
simulations and technical analysis indicators, it provides a description of functionalities for
user definitions of stock market screens based on custom trading strategies. For the purpose of
defining custom trading strategies, the system allows the usage of predefined set of technical
indicators like simple moving average, exponential and weighted moving averages, and
candlestick patterns. Screens are executed at the back office system at the end of the trading
day. For every stock that triggers a buy/sell signal, the user receives an e2mail or SMS alert.
Finally, the paper presents the software architecture of MFinance and technologies used for its
development.
", ,
2
6 *
There are various Web site offering customers simulated stock trading. Users are able to create
and manage virtual portfolios. In order to be realistic and useful for the retail investors, user
portfolios follow a lot of requirements. The portfolio summary contains as well the beginning
cash value, the current market value of the assets, and the percent of return on the investment,
and the S&P 5002 or other benchmark [3, 4] return. The position on the portfolio may include:
name/ticker of the asset, trade date, quantity of shares, cost and current price, current value,
percent change, percentage of equity and option to close the current position.
Normally, users are able to retrieve stock quotes, place orders in a particular portfolio,
review executed trades, their history and the portfolio performance. Orders are executed by a
back office system. Positions are managed and updated by the back office system. The back
office system uses real2time or delayed market data delivering stocks' quotes values in a
reasonable timeout. After confirmation, the back office executes the order (at real2time prices)
and place the position is the respective portfolio. Portfolios are evaluated every time it is
presented to the user.
",",
-
The
itself is a form of market analysis that studies demand and supply for
securities and commodities based on trading volume and price studies. Using charts and
modeling techniques, technicians attempt to identify price trends
in a market. Technical analysis tools provide markets indicators
such as trading range (the difference between the high and low
prices traded during a period of time), trend line (a line drawn
that connects either a series of highs or lows in a trend), etc.
Among the most popular technical methods used in desktop tools
available today, there are:
Fig. 1: Simple moving
avеrage
2
The S&P 500 Index consists of 500 stocks chosen for market size, liquidity, and industry group representation
[4]
moving averages – the Moving Average (MA) is a mathematical procedure to
smooth or eliminate the fluctuations in data and to assist in determining when to buy
and sell [1]. MA's emphasize the direction of a trend, confirm trend reversals and
smooth out price and volume fluctuations or "noise" that can confuse interpretation of
the market (fig. 1), the sum of a value plus a selected number of previous values
divided by the total number of values
MEM (Maximum Entropy Method) 2 both a tool for spectrum analysis and a
method of adaptive filtering and trend forecasting
candlestick patters 2 they are to be found on
candlestick charts (fig. 2), where the high and low are
plotted as a single line and are referred to as shadows.
The price range between the open and the close is plotted
as a narrow rectangle and is referred to as the body. If
the close is above the open, the body is white, otherwise
it is black
stochastic methods 2 the raw stochastic is
Fig. 2: Candlestick charts
computed as the position of today close as a percentage
of the range established by the highest high and the
lowest low of the time period you use
others
The strength of the tools for technical analysis is used by investors and technicians on their
attempt to identify price trends in a market [5, 6]. Unfortunately, such powerful tools as those
of MarketPlayer.com are not available on the Web. Our goal was to develop a financial portal
offering both simulating stock trading and services like stock screening and, of course, market
reviews. Next, there are discussed the functionalities of this portal.
, ,
7
In the financial portal, user profiles are used for identification and for customization purpose.
Users can register for the services offered. The system maintains profiles for each user. Users
are able to update the information stored in the profile. A single user is able to manage multiple
portfolios. Users can delete existing or create new portfolio at any time.
Fig. 3 presents view of a sample stock screening portfolio management. As stated before,
users can have more than one portfolio. The logged user has defined three portfolios with
normal types 2 one frozen and two with active status. The user has clicked on the link of the
last portfolio called bb20020206 and now has its view in the bottom of the figure. The
bb20020206 portfolio contains only one finance symbol scanned for all the 61 candlestick
patterns available in the portal. The user can edit this portfolio by clicking on the link bellow 2
he can add/delete/update symbols and patterns.
,",
2
The stock trading simulation is implemented in accordance with the principles stated in 2.1.
Users may retrieve stock quotes (reviewing the market), define orders, check pending orders,
and review executed trades, gains/losses and trades history.
Fig. 3: Sample stock screening portfolio management
Fig. 4: Historical charts of a stock symbol
While doing simulated stock trading users can consult any historical data about symbol quotes
and volumes in order to be assisted in taking their decisions. Fig. 4 shows a view of historical
data of the MS stock symbol of NYSE including its status, type, description and closes/simple
moving average charts and the volume chart, for a given period. Users can view historical data
as charts or as spreadsheets.
More interesting than the stock trading simulation are the stock screening services, as they
can be used for a successful stock trade. The stock screening services allow to analyze market
symbols and to issue a signal to the user, when given symbol matches a selected trading
strategy. Such a signal can be used to trigger a sell/buy order in a simulated or real stock trade.
, ,
2
*
8
While there are a lot of stock/bonds/funds on2line screeners based on some criteria's like share
price, performance, profitability, etc. [6], our stock screener is based on trading strategies
screening. Thus, the user is able to define stock market screens based on predefined or custom
trading strategies. Screens are executed by the back office system at the end of the trading day.
For every stock that triggers a signal the user receives an e2mail or SMS alert. Users may select
candlestick patters from a pattern list (the link Patterns in fig. 3) and use them as a set of
predefined trading strategies. Users apply these strategies to set of symbols (the link Finance
Symbols in fig. 3) and evaluate the strategy performance. Single strategy can be evaluated
against a set of symbols and companies should be rated on the performance of the strategy.
Another approach is to use a set of strategies against a set of (or single) symbols. In both the
cases users receive alerts (e2mails or SMS) issued when a chosen symbol matches a selected
strategy (i.e., a candlestick pattern). They can review their alerts using the link Alerts (fig. 3).
Fig. 5 shows one of all the 61 predefined patterns available for symbol screening. When adding
this pattern to the portfolio (through the link Patterns in fig. 3), users can see its trend, name,
way of identifications, definition and chart.
Moreover, users can define their own custom strategies. For the purpose of defining custom
trading strategies the system allow the usage of set of technical indicators like Simple Moving
Fig. 5: The Engulfing Bearish Reversal candlestick pattern
Average (SMA) 2 see fig. 1, Exponential3 and Weighted4 Moving Averages (EMA and WMA),
and candlestick patterns. Custom trading strategies are evaluated the same way as the
predefined strategies 2 against a set of symbols, or the entire market. Once developed by the
user, a strategy can be tested in the simulated stock trading.
#, , 9
:
The software architecture of our financial portal includes two main subsystems: a candlestick
pattern scanner and the Web portal application itself. They communicate each other through a
common Oracle database. As well, the portal application invokes through a scheduler a pattern
scanner for download symbol quotes from Internet free financial sites. After each download,
the pattern scanner proceeds with screening the symbols based on the chosen strategies
(candlesticks patterns). Both download and symbols screening are executed after a predefined
timeout. MFinance users manage their portfolios, do a simulated stock trading and explore
historical data and charts using any modern Web browser. The portal application has an alert
deliverer, which sends SMS or/and e2mail messages to the interested users. The global
architectural view of the MFinance is given in fig. 6.
3
The EMA for day D is calculated as:
smoothing constant
where PR is the price on day D and alpha is a
. Alpha may be estimated as 2/(n+1), where n is the simple moving average length.
Another form of the formula is
4
WMA is a moving average that puts more weight on recent prices. A three2day weighted moving average would
add a multiple of 1 to the first date, 2 to the second date and 3 to the third date.
#,",
27
The candlestick pattern scanner is a backend subsystem based on the Java 2 Standard Edition
platform. The scanner is a multithreaded Java system (fig. 7), where inter2process
communication is implemented by means of IBM TSpace [7, 8]. TSpace is a Java
communication middleware, which enables communication between applications and devices
in a network of heterogeneous operating systems, and provides group communication services,
database services, and event notification services.
The architecture of the candlestick pattern scanner uses publisher/subscribe paradigm. The
downloader retrieves regularly quotes from free Internet servers, then parses and publishes
them into the TSpace and stores them into the database. The candlestick patterns are subscribed
for quotes and try to match asynchronously any quote published by the Publisher. In case of
successful match, the correspondent pattern publishes an alert into TSpace. The Publisher
Callback is subscribed for receiving alerts, thus, it is called asynchronously (through an
EventListener) from the TSpace each time when an alert is published into the TSpace. It stores
the alert into the database.
#, ,
6 *7
Java server technologies like servlets, JSP (Java Server Pages) and EJB (Enterprise Java
Beans) are widely used for creation of to interactive Web pages because of the advantages of
Java as a programming language. The Web portal follows the MVC pattern [9], i.e. separation
of the
(relational DB, file system, etc.) from the
(a dispatcher servlet)
and from the presentations (i.e., the JSP : ). The mapping between the action specified in
the HTTP request and its correspondent action handler is provided by XML configurations
files. The action handlers access request, session and application contexts and, based on that
information, verify the user input and invoke business components to perform certain
operations for that action [10]. The business components have access to the data model through
a persistency manager and to a resource pool through a resource manager.
Finally, the dispatcher calls correspondent view handler with its specific parameters using
again mapping information (action2view handler) from the configuration file. In case of error
or unexpected situation the dispatcher forwards the control towards a different view handler.
The view handler invokes a JSP, which populates data from the beans on proper positions. JSP
is not aware where data comes from, i.e. it does not make any difference between database
values and internationalization strings read from property files.
!
The work for creation of the MFinance portal was started in order to provide customers with
two main services: market overview, simulated stock trading and advanced stock screening.
The simulated stock trading allows customers to execute virtual trades and monitor the
performance of their trading strategies. Retail investors will have a plenty of benefits from
using the advanced stock screening services. Users can define and program their own trading
strategies. Strategies can be back tested against a particular stock or against a set of stocks.
Stocks can be ranked based on performance for a given strategy. The system performs market
screening and sends alerts to the customers automatically via e2mail or on a mobile device.
For the future, the system will provide output from back testing the strategy 2 historical
trades, and charts with the historical trades. Users will test their investment strategies on the
simulated stock trading.
The provider of the services can benefit from subscription fee for the services offered. Most
of the services should be offered for free, but the alerting should be offered only to subscribed
users. There could be entry for stock competition games, that will award winners with cash
prizes. The Web site can be operated by online stock brokers. The product can be offered both
to the retail investors and online brokerage firms.
"
[1] Veale, S. Stocks, Bonds, Options, Futures. Investments and their Markets. NYIF, 1987
[2] Boss,
R.
Index
Calculation
Primer.
White
Paper,
Standard&Poor's,
July
2000,
http://www.spglobal.com/IndexCalculations.pdf
[3] The Global Industry Classification Standard (GICS). An Overview for Standard & Poor’s U.S. Indices. White
Paper, Standard&Poor's, March 2001, http://www.spglobal.com/GICSIndexDocument.PDF
[4] US Benchmarks Review 2 S&P SuperComposite 1500 versus Russell 3000. White Paper, Standard&Poor's,
January 2002, http://www.spglobal.com/USbenchmark.pdf
[5] Domash, H. Want to Gain Momentum? Take a Screen Test. Business Magazine, June 2000
[6] Domash,
H.
Searching
for
Fair
Value.
6
; :
!< "< !!!#
http://www.winninginvesting.com/searching_for_fair_value.htm
[7] Tobin J. Gottemukkala V. The Design and Performance Evaluation of a Lock Manager for a Memory2
Resident Database System. Performance of Concurrency Control Mechanisms in Centralized Database
Systems, Prentice Hall, 1996, , pp. 4062428
[8] Lehman, Т., at al. Hitting the distributed computing sweet spot with TSpaces. Computer Networks, Vol. 35,
2001, pp. 4572472
[9] Seshadri, G. Understanding JavaServer Pages Model 2 architecture. JavaWorld, December 1999,
http://www.javaworld.com/javaworld/jw21221999/jw2122ssj2jspmvc.html
[10]Bontchev B., S. Ilieva. Middleware Service Support for Modern Application Presentations. Proc. of 162th Int.
SAER Conference, 2002