Trading Financial Markets with Online Algorithms

Similar documents
Risk-Return Optimization of the Bank Portfolio

Stock Trading Following Stock Price Index Movement Classification Using Machine Learning Techniques

Stock Trading System Based on Formalized Technical Analysis and Ranking Technique

A Formal Study of Distributed Resource Allocation Strategies in Multi-Agent Systems

Futures Trading Signal using an Adaptive Algorithm Technical Analysis Indicator, Adjustable Moving Average'

Game-Theoretic Risk Analysis in Decision-Theoretic Rough Sets

(High Dividend) Maximum Upside Volatility Indices. Financial Index Engineering for Structured Products

Single Machine Inserted Idle Time Scheduling with Release Times and Due Dates

Solving dynamic portfolio choice problems by recursing on optimized portfolio weights or on the value function?

Chapter 3. Dynamic discrete games and auctions: an introduction

Pass-Through Pricing on Production Chains

Portfolio Optimization using Conditional Sharpe Ratio

Neural Network Prediction of Stock Price Trend Based on RS with Entropy Discretization

Robust Trading Mechanisms with Budget Surplus and Partial Trade

Optimal Online Two-way Trading with Bounded Number of Transactions

Methodologies for determining the parameters used in Margin Calculations for Equities and Equity Derivatives. Manual

ONLINE LEARNING IN LIMIT ORDER BOOK TRADE EXECUTION

Quantitative Trading System For The E-mini S&P

State Switching in US Equity Index Returns based on SETAR Model with Kalman Filter Tracking

A Multi-Agent Prediction Market based on Partially Observable Stochastic Game

Online Appendix: Extensions

Black Box Trend Following Lifting the Veil

Essays on Some Combinatorial Optimization Problems with Interval Data

Lecture 7: Bayesian approach to MAB - Gittins index

Absolute Alpha with Moving Averages

Zhiling Guo and Dan Ma

Optimal routing and placement of orders in limit order markets

Comparative Study between Linear and Graphical Methods in Solving Optimization Problems

Prediction Models of Financial Markets Based on Multiregression Algorithms

Importance Sampling for Fair Policy Selection

User-tailored fuzzy relations between intervals

Optimization of a Real Estate Portfolio with Contingent Portfolio Programming

MS-E2114 Investment Science Lecture 3: Term structure of interest rates

Optimal Security Liquidation Algorithms

Likelihood-based Optimization of Threat Operation Timeline Estimation

Modeling, Analysis, and Characterization of Dubai Financial Market as a Social Network

Copyright 2011 Pearson Education, Inc. Publishing as Addison-Wesley.

Based on BP Neural Network Stock Prediction

Statistical and Machine Learning Approach in Forex Prediction Based on Empirical Data

Mathematical Modeling in Enhanced Index Tracking with Optimization Model

Continuing Education Course #287 Engineering Methods in Microsoft Excel Part 2: Applied Optimization

HETEROGENEOUS AGENTS PAST AND FORWARD TIME HORIZONS IN SETTING UP A COMPUTATIONAL MODEL. Serge Hayward

COMPARING NEURAL NETWORK AND REGRESSION MODELS IN ASSET PRICING MODEL WITH HETEROGENEOUS BELIEFS

Designing short term trading systems with artificial neural networks

Part 1 Back Testing Quantitative Trading Strategies

Creating short-term stockmarket trading strategies using Artificial Neural Networks: A Case Study

CrowdWorx Market and Algorithm Reference Information

CHAPTER 13. Duration of Spell (in months) Exit Rate

PART II IT Methods in Finance

Richardson Extrapolation Techniques for the Pricing of American-style Options

Analysis of the Impact of Leveraged ETF Rebalancing Trades on the Underlying Asset Market Using Artificial Market Simulation

Assortment Optimization Over Time

Optimization Methods. Lecture 16: Dynamic Programming

An enhanced artificial neural network for stock price predications

INVESTMENTS Lecture 2: Measuring Performance

Budget Management In GSP (2018)

Computational Model for Utilizing Impact of Intra-Week Seasonality and Taxes to Stock Return

Asset Selection Model Based on the VaR Adjusted High-Frequency Sharp Index

A MATHEMATICAL PROGRAMMING APPROACH TO ANALYZE THE ACTIVITY-BASED COSTING PRODUCT-MIX DECISION WITH CAPACITY EXPANSIONS

INDICATORS. The Insync Index

Predicting Abnormal Stock Returns with a. Nonparametric Nonlinear Method

Minimum Downside Volatility Indices

Competitive Algorithms for Online Leasing Problem in Probabilistic Environments

Discrete models in microeconomics and difference equations

Using Sector Information with Linear Genetic Programming for Intraday Equity Price Trend Analysis

Stock Prediction Model with Business Intelligence using Temporal Data Mining

Measurement of Radio Propagation Path Loss over the Sea for Wireless Multimedia

Working Paper: Cost of Regulatory Error when Establishing a Price Cap

A Comparative Study of Various Forecasting Techniques in Predicting. BSE S&P Sensex

The Stock Market Crash Really Did Cause the Great Recession

Figure (1 ) + (1 ) 2 + = 2

Neuro-Dynamic Programming for Fractionated Radiotherapy Planning

A Novel Method of Trend Lines Generation Using Hough Transform Method

Sample Reports for The Expert Allocator by Investment Technologies

Research Article Portfolio Optimization of Equity Mutual Funds Malaysian Case Study

A Dynamic Hedging Strategy for Option Transaction Using Artificial Neural Networks

Lower Bounds on Revenue of Approximately Optimal Auctions

A Novel Prediction Method for Stock Index Applying Grey Theory and Neural Networks

MULTISTAGE PORTFOLIO OPTIMIZATION AS A STOCHASTIC OPTIMAL CONTROL PROBLEM

Tug of War Game. William Gasarch and Nick Sovich and Paul Zimand. October 6, Abstract

An Algorithm for Trading and Portfolio Management Using. strategy. Since this type of trading system is optimized

EXAMINATION II: Fixed Income Valuation and Analysis. Derivatives Valuation and Analysis. Portfolio Management

International Journal of Computer Science Trends and Technology (IJCST) Volume 5 Issue 2, Mar Apr 2017

This version is available:

Evolution of Strategies with Different Representation Schemes. in a Spatial Iterated Prisoner s Dilemma Game

Iran s Stock Market Prediction By Neural Networks and GA

Global Financial Management

Dynamic retirement withdrawal planning

Sharper Fund Management

Teaching Bandits How to Behave

SIMULATION CHAPTER 15. Basic Concepts

Lecture One. Dynamics of Moving Averages. Tony He University of Technology, Sydney, Australia

Lecture 9 Feb. 21, 2017

GLOBAL EQUITY MANDATES

Parameter Estimation Techniques, Optimization Frequency, and Equity Portfolio Return Enhancement*

arxiv: v2 [q-fin.cp] 18 Feb 2017

A lower bound on seller revenue in single buyer monopoly auctions

Factor Alignment for Equity Portfolio Management

Yao s Minimax Principle

Optimal Search for Parameters in Monte Carlo Simulation for Derivative Pricing

Transcription:

Trading Financial Markets with Online Algorithms Esther Mohr and Günter Schmidt Abstract. Investors which trade in financial markets are interested in buying at low and selling at high prices. We suggest to solve this type of problem with an online algorithm. This active trading algorithm is based on reservation prices. The effectiveness of the algorithm is analyzed from a worst case and an average case point of view. We also compare the average case and the worst case bounds using simulation on historical data. Moreover, we want to give an answer to the question if the suggested active online trading algorithm shows a superior behaviour to buy-and-hold policies. Keywords: online algorithms, trading rules, average case analysis, worst case analysis 1 Introduction Many major stock markets are electronic market places where trading is carried out automatically. Trading policies which have the potential to operate without human interaction are of great importance in electronic stock markets. Very often such policies are based on data from technical analysis [1, 2, 3]. Many researchers have also studied trading policies from the perspective of artificial intelligence, software agents or neural networks [4, 5, 6]. In order to carry out trading policies automatically they have to be converted into trading algorithms. Before a trading algorithm is applied one might be interested in its performance. The performance analysis of trading algorithms can basically be carried out by three different approaches. One is Bayesian analysis where a given probability distribution for asset prices is a basic assumption. Another one is assuming uncertainty about asset prices and analyzing the trading algorithm under worst case outcomes. This approach is called competitive analysis. The third one is a heuristic approach where trading algorithms are designed and the analysis is done on historic data by simulation runs. In this paper we apply the second and the third approach in combination. We consider a multiple trade problem and analyze an appropriate online trading algorithm from a worst case point of view. Moreover we evaluate its average case performance empirically, compare it to its worst case performance and to the average case behaviour of other trading algorithms. The reminder of this paper is organized as follows. In the next section the problem is formulated and a worst case competitive analysis of the proposed trading algorithm is performed. Section 3 gives a literature overview on heuristic trading rules for

2 Esther Mohr and Günter Schmidt multiple trade problems. In Section 4 new trading policies based on online algorithms for this problem are introduced. Section 5 presents detailed experimental findings from our simulation runs. We finish with some conclusions in the last section. 2 Problem Formulation If we trade in financial markets we are interested in buying at low prices and selling at high prices. Let us consider the single trade and the multiple trade problem. In a single trade problem we search for the minimum price m and the maximum price M in a time series of prices for a single asset. At best we buy at m and sell later at M. In a multiple trade problem we trade assets sequentially in a row, e.g. we buy some asset u today and sell it later in the future. After selling asset u we buy some other asset v and sell it later again; after selling v we can buy w which we sell again, etc. If we buy and sell (trade) assets k times we call the problem k-trade problem with k > 1. As we do not know future asset quotes the decisions to be taken are subject to uncertainty. How to handle uncertainty for trading problems is discussed in [7]. To solve financial search problem a trader which owns some asset at time t = 0 obtains price quotations p(t) with m < p(t) < M at points of time t = 1;2,,T. Each point of time t the trader must decide whether or not to accept the current price for selling. Once some price p(t) is accepted trading is closed and the trader s payoff is calculated. The time horizon T and the possible minimum and maximum prices m and M are known to the trader. If the trader did not accept a price at the first T-1 points of time he must be prepared to accept some minimum price m at time T. The problem which price to accept is solved by an online algorithm. An algorithm ON computes online if for each j = 1,, n-1, it computes an output for j before the input for j+1 is given. An algorithm computes offline if it computes a feasible output given the entire input sequence j =1,, n-1.we denote an optimal offline algorithm by OPT. An online algorithm ON is c-competitive if for any input I ON(I) > 1/c * OPT(I). (1) The competitive ratio is a worst-case performance measure. In other words, any c- competitive online algorithm is guaranteed a value of at least the fraction 1/c of the optimal offline value OPT(I) no matter how unfortunate or uncertain the future will be. As we have a maximization problem c > 1 the smaller c the more effective is ON. For the search problem the policy (selling rule s) [8] accept the first price greater or equal to reservation price p* = (M * m). has a competitive ratio c s = (M / m) where M and m are upper and lower bounds of prices p(t) with p(t) from [m, M]. c s measures the worst case in terms of maximum and minimum prices. This result can be transferred to k-trade problems if we modify the policy to

Trading Financial Markets with Online Algorithms 3 buy the asset at the first price smaller or equal and sell the asset at the first price greater or equal to reservation price p* = (M * m). In the single trade problem we have to carry out the search twice. In the worst case we get a competitive ratio of c s for buying and the same competitive ratio of c s for selling resulting in an overall competitive ratio for the single trade problem of c t = c s * c s = M / m. In general for the k-trade problem we get a competitive ratio of c (k) = t k i= 1 (M(i) / m(i)) (2) If m and M are constant for all trades c t (k) = (M / m) k. The ratio c t (k) can be interpreted as the return ratio we can achieve by buying and selling assets. The bound is tight for arbitrary k. Let us assume for each of the k trades we have to consider the time series (M, (M * m), m, m, (M * m), M). OPT always buys at price m and sells at price M resulting in a return ratio of M / m. ON buys at price (M *m) and sells at price (M * m) resulting in a return ratio of 1, i.e. c t (1) = OPT / ON = M / m. If we have k trades OPT and ON achieve the following return ratios OPT(k) = (M / m) k (3) ON(k) = ( (M * m) / (M * m) ) k = 1 k (4) resulting in the k-trade worst case competitive ratio c t (k) = OPT(k) / ON(k) = (M / m) k (5) In the following we apply the above described reservation price policy to multiple trade problems and compare it to other trading rules. Before doing that we review experimental results for heuristic trading rules. 3 Related Work We give a brief overview on the experimental analysis on heuristic trading policies for multiple trade problems from the literature.

4 Esther Mohr and Günter Schmidt In [1] simple market-timing heuristics are compared to a buy-and-hold policy. Trading signals are generated by the value of the short spread between the Earning- Price (EP) ratio and selected interest rates using S&P500 data from 1970 to 2000. Trading policies either invest in the S&P500 index or in treasury bills over a period of one month depending on predefined thresholds. If the spread is above some threshold level, the policy invests in the S&P500 index for the next month and if the spread is below this level, the portfolio is liquidated at the end of the month and the money is invested in 30-day treasury-bills for the next month. At the end of each month spreads are considered again. The benchmark portfolio return is compared with these of S&P500 index buy-and-hold policy for 1970 to 2000. Results show that the trading policy outperforms the S&P500 index generating higher mean returns. In particular, the policy based on the spread between the EP ratio and a short-term interest rate beats the S&P500 index even when transaction costs are taken into account. In [4] market timing heuristics using combinations of moving averages are compared to rules based on individual moving averages and buy-and-hold. The trading rules are based on the volume adjusted moving average (VAMA) and the ease of movement (EMV) indicators. VAMA is a moving average, where prices are replaced by volume. EMV illustrates the relationship between the rate of price and volume change of an asset. Trading is simulated over a time horizon of 1508 days from January 1998 to December 2003. At each point of time only one asset of the S&P500 index is in the portfolio. Different types of period lengths are investigated: 1 week (5-days), 4 weeks (21-days) and 13 weeks (55-days). Trading signals are generated by VAMA and EMV with and without the use of a neural network (NN). Transaction costs are not considered. The VAMA rule buys if the price of the asset is smaller than the VAMA and sells if the price is greater. The EMV trading rule buys when the smoothing value of EMV crosses above zero from below and sells when the smoothing value of EMV crosses below zero from above. Trading rules might not be executed depending on the results of the NN which predict the next day s VAMA and EMV. Different combinations of trading rules are tested: VAMA+NN, VAMA+NN+Filter, VAMA+NN+SMA, and EMV+NN+VAMA. Benchmarks are VAMA, EMV, a single moving average (SMA) and buy-and-hold. For the combined cases, trading signals must match for all components (for more details see Tables 6 and 7 in [4]). Results show that trading with NN support is helpful to generate better trading decisions. The EMV+NN+VAMA policy outperforms all benchmarks in terms of average returns. In [2] variable length moving average rules are compared to buy-and-hold. Trading rules based on returns are investigated in ten emerging equity markets in Latin America and Asia from 1982 to 1995. Trading signals are generated by two different types of moving average returns (MAR), called short MAR (SMAR) and long MAR (LMAR). SMAR is calculated over period lengths of 1, 2, and 5 days, the LMAR over 50, 150, and 200 days. The different trading policies generate buying signals when the SMAR exceeds the LMAR and selling signals when the LMAR exceeds the SMAR. All policies were tested over the same time horizon from January 1, 1982 to April 1, 1995. The average returns considering transaction costs for each rule and country are compared to buy-and-hold the S&P500 and Nikkei225 indices. Results show that these trading rules applied to emerging markets do not have the ability to outperform the buy-and-hold alternative.

Trading Financial Markets with Online Algorithms 5 In [5] and [6] different heuristic trading policies are evaluated but unfortunately not compared to the buy-and-hold rule. In [5] stock trading policies are evaluated in the context of the Penn-Lehman Automated Trading simulator. Two policies suggested in [3] are used. The first policy is a market-making policy exploiting market volatility without predicting the direction of the stock price movement. The second policy is a reverse policy based on technical analysis. Both policies trade the Microsoft Corp. (MSFT) asset over 15 days from February 24, 2003 to March 18, 2003. The marketmaking policy fixes a selling price x and a buying price y for MSFT. When prices go beyond x a sell order is placed and when prices drop on y a buy order is placed. The reverse policy sells when prices tend to move upwards and buys when prices tend to move downwards. The experimental analysis is designed as a tournament with three rounds, each lasting one week. Both policies survived the first round; the marketmaking policy did not survive the second round. The reverse policy won the tournament but without achieving any profit. In [6] traditional price-based policies are compared to policies based on order book information. Tested policies are called Static Order Book Imbalance (SOBI), Volume Average Weighted Prices (VWAP), Trend Following (TF) and Reverse Policy (RP). SOBI buys (sells) if order book sell prices are greater (smaller) than the order book buy prices. VWAP buys (sells) if the markets average buying (selling) prices are greater (smaller) than VWAP buying (selling) prices. TF calculates a long and a short trend line from ticker prices and buys (sells) if slopes of long (short) and short (long) match (both negative / positive). The fourth policy implemented is the RP discussed in [5]. All four policies were tested over a 15-day period from January 5, 2004 to January 23, 2004 with NASDAQ order book data. Three mixed policies which combine two, three or all of the four policies were considered: SOBI+VWAP+RP+TF, SOBI+RP and SOBI+RP+TF. Results compare achieved returns and the Sharpe ratio. For a period length of 15 days the best combined policy is SOBI +RP+TF in terms of achieved return; the reverse policy is the overall winner in terms of the Sharpe ratio. 3 Trading Policies Based on Online Algorithms For the multiple trade problem we divide the time horizon into several trading periods i of different types p; each trading period consists of a constant number of h(p) days. Periods of type p are numbered with i = 1,, n(p). We will investigate different trading policies. Two elementary ones are buy-andhold (BH), a passive policy, and Market Timing (MT), an active policy. As a benchmark we use an optimal offline algorithm called Market (MA). We assume that for each period i there is an estimate of the maximum price M(i) and the minimum price m(i). Within each period i we have to buy and sell an asset at least once. The annualized return rate R(x), with x from {MT, BH, MA} is the performance measure of a trading policy. At any point of time within the time horizon a policy either holds an asset or it holds cash.

6 Esther Mohr and Günter Schmidt Market Timing (MT) In every period MT calculates reservation prices RP j(t) for each day t for each asset j. In case MT wants to buy an asset j MT chooses that asset with RP j (t)-p j (t) = max {RP j(t) p j (t) p j (t) < RP j (t), j = 1,,m}. In case MT wants to sell asset j the first asset price p j (t) with p j (t) > RP j (t) is accepted for selling. If there was no such price then selling has to be done on the last day T of a period. Let b j be the time at which asset j is purchased and s j be the selling of asset j, b j < s j < T. The asset j which is bought by MT at b j we call MT-asset. The interval [b j, T] we call allowable interval. Buy and Hold (BH) We consider two variants of the buy-and-hold policy. BH-Index invests in an index from the first day of the first period until the last day of the last period. BH-MT buys at each period the same asset on the same day as MT does and sells it on the last day of the period, i.e. it sells possibly later than MT. Market (MA) To evaluate the performance of the above policies empirically we use an optimal offline policy MA as a benchmark. It is assumed that MA knows all MT-asset prices of a period including also these which were not presented to MT if there were any. Each period i MA will buy the MT-asset at the minimum price p min > m(i) and will sell it at the maximum possible price p max < M(i) within the allowable interval. In case that MT sells an asset u and buys another asset v at the same day t < T MA must sell asset u at the latest at day t. In case that MT sells asset u at day t and buys another asset v on day t+k, k > 1 MA must sell asset u at the latest at day t+k. The different situations for buying and selling assets for MT, MA and BH-MT are shown in Figure 1. Fig. 1: Trading constraints for MA, MT and BH-MT

Trading Financial Markets with Online Algorithms 7 Whenever a policy is not invested in an asset it is invested in cash which also achieves return. The performance of the investment policies is evaluated empirically. Clearly, all policies cannot beat the benchmark policy MA. 5 Experimental Results We want to investigate the performance of the trading policies introduced in Section 4 using experimental analysis. Tests are run for p = 1,2,,6 period types with the number of periods n(p) from {520;260;130;40;20;10} and period length h from {7;14;28;91;182;364} days, e.g. for the time horizon of ten years and p=6 we get n(6) = 10 periods with h = 364 days for each period. The following assumptions apply for all tested policies. 1. There is an initial portfolio value greater zero. 2. Buying and selling prices p j(t) of an asset j are the closing prices of day t. 3. At each point of time all money is invested either in assets or in cash; cash is realized if selling and buying of an asset is on different days. 4. At any time there is at most one asset in the portfolio. 5. In each period at least one buying and one selling transaction must be executed. 6. In period i = 1 all policies buy the same asset j on the same day t at the same price p j(t) as MT does. In periods i = 2,, n(p)-1 trades are carried out according to the rules of the different policies. In the last period i = n(p) the asset has to be sold on the last day of that period at the latest. No further transactions are carried out thereafter. 7. If buying and selling of the same asset should take place at the same day and the same price the transaction is not carried out because identical asset prices cause transaction costs but achieve no return. 8. If the reservation price is calculated for a day t in a period of h days then m and M are taken from the interval [t-h, t-1]. 9. All periods have a length of T+1 days where the last day of period i is also the first day of period i+1. We simulate all policies using historical Xetra DAX data from January 1, 1998 to June 6, 2008. We separate the interval into periods according to the above considerations. With this we have 520 periods of length 7 days, 260 periods of length 14 days, etc. We carried out simulation runs in order to find out (1) if MT shows a superior behaviour to buy-and-hold policies (2) the influence of m and M on the performance of MT (3) the average competitive ratio of policies MA and MT

8 Esther Mohr and Günter Schmidt We first concentrate on question (1) if MT shows a superior behaviour to the buyand-hold policies BH-MT and BH-Index. For calculating reservation prices we use estimates from the past, i.e. in case of a period length of h days m and M are taken from those asset quotes preceding the actual day t* of the reservation price calculation, i.e. m = min {p(t) t = t*-1, t*-2,,t*-h} and M = max {p(t) t = t*-1, t*-2,,t*-h}. 1998-2008: Historic m, M Annualized Return Rates Including Transaction Costs for Xetra DAX Transaction costs: 0.0048% of the market value but not less than 0.60 Euro and not more than 18.00 Euro. Cash return: 3% p.a. Period Length 1 Week 2 Weeks 4 Weeks 3 Months 6 Months 12 Months MA 468.29% 371.74% 312.50% 194.67% 138.56% 71.47% MT 6.33% 7.11% 27.27% -0.02% 0.04% -1.58% BH-MT -4.39% 1.11% 13.52% -1.56% -11.09% -13.42% BH-Index 1.99% 1.99% 1.99% 1.99% 1.99% 1.99% Table 1. 1998-2008 annualized returns based on historic estimates In Table 1 the experimental results are shown taking transaction costs into account. First we analyse the absolute performance. MT outperforms BH-Index in half of the cases and BH-MT in all cases. BH-Index outperforms BH-MT in five of six cases. We can skip discussing BH-MT and focus on the comparison of MT and BH-Index. MT generates the best annual return rate of the two policies when applied to a period length of four weeks. If the period length is greater than 4 weeks BH-Index outperforms MT. As we will see later the quality of the reservation price based policies MT and BH- MT using historic estimates of m and M is less influenced by the period length but more by the quality of estimates. The good performance for the four weeks period is due to good estimates of m and M for that period length. If we consider the average performance of the trading policies we have 6.53% for MT, 1.99% for BH-Index and -2.64% for BH-MT. MT is not always the best policy but it is the best on average. From this we conclude that MT shows on average a superior behaviour to buy-and-hold policies under the assumption that m and M are calculated by historical data. In general we would assume that the better the estimates of m and M the better the performance of MT. Results in Table 1 show, that the longer the periods the worse the relative performance of all active policies. This might be due to the fact that for longer periods historical m and M are worse estimates in comparison to those for shorter periods. In order to analyze the influence of the estimates of m and M all simulations are now run with the observed m and M of the actual periods, i.e. we have clairvoyant estimates. Results for these estimates are shown in Table 2.

Trading Financial Markets with Online Algorithms 9 1998-2008: Clairvoyant m, M Annualized Return Rates Including Transaction Costs for Xetra DAX Transaction costs: 0.0048% of the market value but not less than 0.60 Euro and not more than 18.00 Euro. Cash return: 3% p.a. Period Length 1 Week 2 Weeks 4 Weeks 3 Months 6 Months 12 Months MA 652.92% 618.94% 583.33% 510.05% 360.36% 200.63% MT 644.65% 602.44% 27.27% 339.76% 235.92% 135.76% BH-MT 444.06% 338.84% 216.81% 149.01% 55.35% 35.32% BH-Index 1.99% 1.99% 1.99% 1.99% 1.99% 1.99% Table 2. 1998-2008 annualized returns based on precise estimates Answering Question (2) it turns out that in all cases the return rate of MT now dominates all return rates of all buy and hold policies. It can also be seen that for clairvoyant estimates of m and M the policy BH-MT now outperforms BH-Index. From this we conclude that the estimates of m and M are of major importance for the performance of reservation price guided policies MT and BH-MT. Moreover we see, if trading is forced all policies improve in achieving return rates. Now we concentrate on Question (3) comparing the experimental and the analytical competitive ratios. Again we base our discussion on annualized return rates as performance measure. Moreover, we assume that we have precise estimates for m and M. We define the rate of return for a policy x by R(x) = PV b / PV e where PV b and PV e are beginning and ending portfolio values before and after trading. For the experimental competitive ratio we get c ex = R(MA) / R(MT) and for the analytical competitive ratio we get c wc = R(OPT) / R(ON) = c t (k) (cf. Equation 5). A detailed example for the calculation of the competitive ratio is shown in Table 3 using 10 trades. For each trade the analytical competitive ratio c wc is calculated and compared to the experimental competitive ratio c ex. Calculating the analytical competitive ratio c wc = R(OPT) / R(ON) = R(MA) / R(ON) and c ex / c wc = R(ON) / R(MT) = 1 / R(MT).

10 Esther Mohr and Günter Schmidt Table 3: Return rates per trade The ratio c E/A = c ex / c wc relates the experimental competitive ratio to the analytical competitive ratio; if c E/A = 1 then the average experimental ratio is as bad as the worst case analytical ratio. We compared the analytical results with the experimental results based on annualized return rates for the period lengths 1, 2, 4 weeks, 3, 6, and 12 months. The overall competitive ratios are presented in Table 4.

Trading Financial Markets with Online Algorithms 11 1998-2008: Clairvoyant m, M Period # Trades Length MA MT Analytics (A) Experiments (E) E vs. A OPT ON c wc = OPT / ON MA MT c ex = MA / MT c E/A = c ex / c wc 12 months 45 45 3.0036 1.0000 3.0036 3.0036 2.3576 1.2752 42.42% 6 months 99 101 4.6036 1.0000 4.6036 4.6036 3.3592 1.3705 29.77 % 3 months 166 173 6.1005 1.0000 6.1005 6.1005 4.3976 1.3872 22.74 % 4 weeks 298 329 6.8333 1.0000 6.8333 6.8333 6.6190 1.0324 15.11 % 2 weeks 444 501 7.1894 1.0000 7.1894 7.1894 7.0244 1.0235 14.24 % 1 week 637 731 7.5292 1.0000 7.5292 7.5292 7.4465 1.0111 13.43 % Table 4. Competitive ratio and annualized return rates for 1998-2008 The number of trades executed may differ between MA and MT. In case MA would buy and sell the MT-asset on the same day this trade is not carried out because it would only generate transaction costs but no return. Transaction costs are not taken into account in order not to bias results. E.g. for the period length of 12 months the analytical worst case ratio OPT / ON is 3.0063 and the average experimental ratio MA / MT is 1.2752. This corresponds to the results given in Table 2 in the following way. The initial portfolio value was 8.000 Euro for MA and MT resulting in a final portfolio value of 18,860.80 Euro for MT and 24,050.40 Euro for MA. This corresponds to a return of 135.76 % for MT and of 200.63% for MA (cf. Table 2). As MA represents OPT the analytical worst case ratio can be calculated via portfolio values: 24,050.40 Euro / 8,000 Euro = 3.0063. The return ratio of MT is 18,860.80 Euro / 8,000 Euro = 2.3576. With this c ex = MA / MT = 3.0063 / 2.3576 = 1.2752. The values of the competitive ratios for the other period lengths are also given in Table 4. The return of MT in the experiments reaches at least 72.09% for period length three months, at most 98.90% for period length one week and on average 82.02% of the return of MA. The ratio of the experimental average case bound and the worst case bound reached is at least 13.43%, at most 42.42% and on average 22.95%. Moreover it is shown that the shorter the periods are the better gets MT in comparison to MA. 6 Conclusions In order to answer the three questions raised in this paper twelve simulation runs were performed. If we have precise estimates for m and M then MT outperforms buy-andhold policies in all cases even when transaction costs are considered. Simulation on historical estimates of m and M show, that MT outperforms buy-and-hold on half of the cases and also on average. We conclude that if the period length is small enough MT outperforms BH also for historical estimates of the reservation price parameters.

12 Esther Mohr and Günter Schmidt It is obvious that the better the estimates of m and M the better the performance of MT. Results show also that the shorter the periods, the better are estimates by historical m and M. The performance of MT is expected to get worse for historical estimates the longer the periods become. In real life it is very difficult for MT to get close to the (analytical) worst cases. The paper leaves also some open questions for future research. One is looking for better forecasts of future upper and lower bounds on asset prices to improve the performance of MT. The suitable period length for estimating m and M is an important factor to provide a good trading signal, e.g. if the period length is h days estimates for historical m and M were also be calculated over h past days. Simulations with other past period lengths for estimating m and M would be of interest. References 1. Shen, P.: Market-timing strategies that worked. Working Paper RWP 02-01, Federal Reserve Bank of Kansas City, Research Division (2002) 2. Ratner, M., Leal, R.P.: Tests of technical trading strategies in the emerging equity markets of latin america and asia. Journal of Banking and Finance 23, 1887 1905 (1999) 3. Ronggang, Y., Stone, P.: Performance analysis of a counter-intuitive automated stock trading stategy. In: Proceedings of the 5th International Conference on Electronic Commerce, ACM International Conference Proceedings, vol. 50, pp. 40 46 (2003) 4. Chavarnakul, T., Enke, D.: Intelligent technical analysis based equivolume charting for stock trading using neural networks. Expert Systems and Applications 34, 1004 1017 (2008) 5. Feng, Y., Ronggang, Y., Stone, P.: Two stock trading agents: Market making and technical analysis. In: P. Faratin, D. Parkes, J. Rodriguez-Aguilar, W. Walsh (eds.) Lecture Notes in Artificial Inteligence, Agent Mediated Electronic Commerce V: Designing Mechanisms and Systems, pp. 18 36. Springer (2004) 6. Silaghi, G., Robu, V.: An agent policy for automated stock market trading combining price and order book information. In: ICSC Congress on Computational Intelligence Methods and Applications, pp. 4 7 (2005) 7. El-Yaniv, R., Fiat, A., Karp, R., Turpin, G.: Optimal search and one-way trading algorithm. Algorithmica 30, 101 139 (2001) 8. El-Yaniv, R.: Competitive solutions for online financial problems. ACM Computing Surveys 30(1), 28 69 (1998)