optimization importance in high-frequency …528567/fulltext01.pdfoptimization importance in...

31
Optimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1

Upload: others

Post on 25-May-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Optimization importance in high-frequencyalgorithmic trading

Vadim SuvorinDmytro Sheludchenko

26th May 2012

1

Page 2: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Contents1 Introduction 4

2 Data and methodology 62.1 Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2 Trading strategy definition . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2.1 Moving Average . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2.2 Relative Strength Index . . . . . . . . . . . . . . . . . . . . . . . . . 82.2.3 Tweezer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2.4 Trading Range Break . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2.5 Momentum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.3 Optimization framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.4 Testing methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 Empirical results 133.1 Optimizing the algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.2 Choosing the strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.3 Walk forward results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

4 Conclusion 18

References 19

Appendices 20

A Backtesting results 20

B Weights calculation 29

2

Page 3: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Abstract

The thesis offers a framework for trading algorithm optimization and tests statisticaland economical significance of its performance on American, Swedish and Russian fu-tures markets. The results provide strong support for the proposed method, as using thepresented ideas one can build an intraday trading algorithm that outperforms the marketin long term. Section 1 formulates the problem and reviews previous investigations inthe area. Section 2 describes the data, trading algorithms, their optimization frameworkand testing methodology. Section 3 presents the empirical results of proposed frameworkimplementation, compares its performance with random parameters trading and marketbuy-and-hold profit.

3

Page 4: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

1 IntroductionTrading strategies have existed ever since first capital markets emerged, as every market

participant follows some sort of trading rules. Ability of a trading algorithm to generate ex-cess return has always been closely connected to the Efficient Markets Hypothesis (EMH),which was independently proposed by Eugene Fama and Paul Samuelson in 1965. Accordingto EMH, the market is efficient when prices of traded instruments fully reflect all availableinformation. This theory is one of the most controversial in finance and has provoked manyheated discussion between its supporters and challengers.

EMH theory suggests that there is no point in trying to identify mispriced securities or toutilize different analysis techniques to predict future price movements. As it was pointed outby Shostak (1997), EMH implies that the simplest buy-and-hold strategy is as profitable asany other and that there is no place for entrepreneurial activity in financial markets [8].

One of the biggest EMH supporters, Malkiel from Princeton University, claimed in 1973that a blind-folded chimpanzee throwing darts at the Wall Street Journal could be as success-ful at selecting stocks as portfolio managers and stock analysts with many years of marketexperience and training [5].

The first tests of EMH were aimed at proving its weak efficiency, which implies that currentstock prices fully reflect the information about historical prices. This question is thoroughlyinvestigated in Fama’s working papers in 1965 and 1970 that revolved around measuring theserial correlation of stock market returns [4].

Similar studies were later performed by Conrad, Kaul, Lo and MacKinlay in 1988. Theyanalyzed returns of NYSE stocks on per-week basis and found positive serial correlationsover short time periods. However, the correlations were rather low, especially for large-capstocks. Due to this fact, the respective authors could not prove existence of opportunities toearn excessive returns despite proving existence of short term trends.

The study by Jegadeesh and Titman (1993) pointed out ”momentum effect” in stock per-formance that continued over time. They compared two different stock portfolios: one con-sisting of best performing stocks in the past, while the other contained stocks that performedbadly. They proved that the portfolio of best-performing stocks led to higher returns in the fu-ture, thus creating profit opportunities for investors. This fact is considered to prove short-termprice momentum and undermine EMH.

Papers by Fama and French (1988) and Poterba and Summers (1988) found existence ofprolong negative long-term serial correlation of the aggregate market, which implied market’soverreaction to particular news in one time period. This effect led to positive correlation overshort-term horizon and eventual correction in following time period.

The first studies that investigated the ability of technical analysis to boost returns wereconducted by Fama and Blume in 1966 and Jensen and Benington in 1970 and concludedthat technical algorithms did not lead to increased returns. This result was not questioned formore than two decades. The study by Brock, Lakonishok and LeBaron published in 1992changed this perception [1]. The authors investigated two very popular trading strategies,moving average and trading-range breaks, on a huge data sample of Dow Jones Average Indexfrom 1897 to 1986 and concluded that even the simplest trading strategies had predictive

4

Page 5: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

power and led to increase in returns. The researchers also proved that popular fitted timeseries models (random walk with a drift, AR, GARCH-M and EGARCH) could not explainthe returns, generated by the trading strategies [2].

Similar results were obtained by Bessembinder and Chan in 1997. The authors examinedreturns of DJIA on four sub-periods from 1926 to 1991 and came to results, which support theprevious study by Brock et al. However, they also suggested that high transaction costs coulddismiss abnormal returns provided by market timing and lead to returns lower than market [1].

More modern studies, such as Holzmann and Reschenhofer (2010), confirm findings ofBrock, Bessembinder and Chan, and also suggest that transaction costs are much lower nowadaysand many brokers offer flat transaction rate, which is especially advantageous for high-frequencytrading systems [7].

Despite a lot of studies concluded that algorithmic trading could outperform the market,there are not many works that investigate if historical performance of strategies is represent-ative. The latter is becoming a dominant issue as trading strategies’ complexity evolves onday-to-day basis and many practitioners, facing the challenge of choosing right trading ruleswith adequate parameters, base their decisions on backtesting results.

Although it’s obvious that history doesn’t always repeat itself on financial markets, someresults from the business world suggest a positive effect of historical optimization on perform-ance of algorithmic trading strategy. One of numerous examples is XT-99, the algorithmictrading program that has generated average yearly return of 27,17% during time period between1999 and 2011, while the average yearly return of S&P500 for the mentioned time period was3,3% and return of Altegris 40 Index, which compiles 40 best returns from 500 CTA tradingprograms, was 6,56% [6].

The purpose of this paper is to determine if a trading strategy benefits from properly de-signed optimization. To achieve the purpose we test the hypothesis: historical optimization isable to improve out-of-sample performance of an algorithm.

The remainder of the thesis is organized as follows: Section 2 describes the data, tradingstrategies under consideration and optimization methodology; Section 3 presents the empir-ical results of proposed framework implementation, compares its performance with randomparameters trading and the market; Section 4 concludes and summarizes our results.

5

Page 6: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

2 Data and methodology

2.1 DataIn this study we focus on futures contracts, as transaction costs on this market are low

enough to implement high-frequency trading ideas. We have chosen three markets with itsmost liquid instruments: E-mini S&P 500, OMXS30 and RTS index contracts, traded onCME, NASDAQ OMX and RTS Forts respectively. The sample contains minute timeframesfrom 15 Dec 2005 till 15 Feb 2012, which is equal to approximately 600 thousand returnsfor each market. The start date is chosen in such a way that volumes suffice for trading onminute timeframes. American market had enough liquidity even before the chosen date, butwe decided to have the equal size of sample for all three instruments in order to facilitate theperformance comparison. Due to lack of trading volumes, the night session was excludedfrom E-mini S&P 500 time series as well as the evening session on Russian market.

2.2 Trading strategy definitionIn order to proceed, we should give a proper definition to a term trading strategy. It can be

defined as a predetermined set of rules that one applies while making trading decisions [6]. Inother words, it is an algorithm that one employs to filter out possibly predictive periods fromnon-predictive periods in time series. To give a mathematical definition, we must introducethe following notations:

Ot = open price for period tHt = highest price for period tLt = lowest price for period tCt = closing price for period tVt = number of contracts traded in period trt =Ct/Ct−1−1 = market return for period t

The processes above comprise a sequence of market information flow for technical trad-ing system. Then a trading strategy will be a function φ with parameters ψ , which mapsinformation available up to moment (t-1) to trading signals (χt,φ ,ψ ) (unique for every strategy)and stop loss/ take profit prices both for long positions ( ˆSLt,φ ,ψ , ˆT Pt,φ ,ψ ) and short positions( ˇSLt,φ ,ψ , ˇT Pt,φ ,ψ ):

ˆSLt,φ ,ψˆT Pt,φ ,ψˇSLt,φ ,ψˇT Pt,φ ,ψ

χt,φ ,ψ

= φ(ψ,Oi,Hi,Li,Ci,Vi), i = 1,2, . . . , t−1

Based on trading signals χ we can define a set ˆAφ ,ψ that contains periods, during which astrategy φ with parameters ψ stays in long position, and a set ˇAφ ,ψ that contains corresponding

6

Page 7: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

periods for short positions. To determine when a position is closed by stop loss or take profitwe introduce following sets:

ˆBφ ,ψ = ˆAφ ,ψ ∩{t : Ht ≥ ˆT Pt,φ ,ψ}ˆCφ ,ψ = ˆAφ ,ψ ∩{t : Lt ≤ ˆSLt,φ ,ψ}ˇBφ ,ψ = ˇAφ ,ψ ∩{t : Lt ≤ ˇT Pt,φ ,ψ}ˇCφ ,ψ = ˇAφ ,ψ ∩{t : Ht ≥ ˇSLt,φ ,ψ}

Returns process for long positions of strategy φ with input parameters ψ will be:

ˆrt,φ ,ψ = rt1A\(B∪C)+T Pt/Ct−11B\C +SLt/Ct−11C

where T Pt = ˆT Pt,φ ,ψ , SLt = ˆSLt,φ ,ψ , A = ˆAφ ,ψ , B = ˆBφ ,ψ , C = ˆCφ ,ψ and 1A(t) denotes anindicator function:

1A(t) =

{1, t ∈ A0, t /∈ A

For short positions process of strategy returns is built by analogy:

ˇrt,φ ,ψ =−rt1A\(B∪C)−T Pt/Ct−11B\C−SLt/Ct−11C

where T Pt = ˇT Pt,φ ,ψ , SLt = ˇSLt,φ ,ψ , A = ˇAφ ,ψ , B = ˇBφ ,ψ , C = ˇCφ ,ψ

Out of the described processes we obtain strategy returns rt,φ ,ψ = ( ˇrt,φ ,ψ + ˆrt,φ ,ψ)/2, whichcan be easily transformed to value process for our trading portfolio:

V (T ) =V (0)T

∏t=1

(rt,φ ,ψ +1)

where t = 1,2, . . . ,T are rebalancing points for individual strategy [3].

In this paper we look closely at five different trading algorithms: Moving average, RelativeStrength Index, Tweezer, Trading Range Break and Momentum. In order to obtain a repres-entative estimate of optimization applicability, the strategies were chosen in such fashion thatthey work completely different.

2.2.1 Moving Average

This is a classical technical analysis trading strategy, which employs two moving aver-ages of different time periods in order to find a trend’s direction. The buying opportunityoccurs when the fast moving average goes above the slow moving average (the trend seemsto become bullish). The trading strategy is set to open a short position when the fast movingaverage intersects the slow moving average from above. In our tests, we use this strategy inthe canonical way described above. No stop loss or take profit is involved, which means thatstrategy is always in position. As we see from Figure 1, position is open on the next bar aftermoving averages cross.

7

Page 8: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 1: Moving Average trade example.

Optimization parameters:ψ1 = 10,15, . . . ,60 = length of fast moving average1;ψ2 = 2,3, . . . ,6 = ratio of slow moving average length to length of fast moving average.

2.2.2 Relative Strength Index

The Relative Strength Index strategy is also very popular among traders. It measures thecurrent and historical strength or weakness of an instrument.

The trading strategy takes long position when RSI value crosses up a lower barrier (ψ1)and closes it when the indicator reaches middle level 50. Short position is opened, whenstock price is considered overbought but starts to move back to regular levels, e.g. when theindicator crosses below a higher barrier (100-ψ1).

Stop loss for long position is put ψ3 minimum price changes lower than the lowest priceof the signal bar. For short position stop loss is placed ψ3 ticks higher than its highest price.Full trade example is depicted in Figure 2.

Figure 2: Relative Strength Index short trade example.

1The choice of input parameters and optimization step size is reasoned in Section 2.3

8

Page 9: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Optimization parameters:ψ1 = 15,18, . . . ,42 = lower barrier;ψ2 = 10,12, . . . ,20 = length of the indicator;ψ3 = 1,2, . . . ,5= distance between high/low and stop loss price in minimum price changes.

2.2.3 Tweezer

Tweezer belongs to the family of candlestick strategies. The long position is opened afterthe specific pattern Bullish Tweezer, which is defined as a black candle, followed by a whitecandle with the same low level. Stop loss is placed on the lowest price of the candlestickformation with an indent of ψ1 ticks. Take profit is put ψ2 minimum price changes from theprice of position opening. The short sale is performed by analogy after Bearish Tweezer.

Figure 3: Tweezer short trade example.

Optimization parameters:ψ1 = 1,3,5 = distance between high/low and stop loss price in ticks.ψ2 = 12,16, . . . ,80 = the value of take profit in minimum price changes.

2.2.4 Trading Range Break

With this rule signals are generated when the price moves above or below predefined sup-port and resistance level(this strategy is also known as Support/Resistance strategy). Supportlevel is constructed upon the minimum of four last down fractals. Resistance level is basedon four last up fractals2. Stop loss for long trades is placed ψ1 minimum price changes lowerthan former resistance level. Take profit is calculated according to ψ2.

2Up fractal is a candlestick pattern, which has its highest high in the middle and two lower highs on the sidesof formation. Down fractal also contains five candlesticks with lowest low in the middle and two higher low onthe sides.

9

Page 10: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 4: Trading Range Break trade example.

Optimization parameters:ψ1 = 1,2, . . . ,5 = distance between support/resistance level and stop loss price in ticks.ψ2 = 5,6, . . . ,30 = the value of take profit in minimum price changes.

2.2.5 Momentum

This strategy is mainly aimed to obtain quick profits on rapid market swings. The mainfocus is to catch movement of price in one direction on high volume. As soon as a tradernotices acceleration in stock price or trading volume the trader will either buy or short sell inhope that the impulse is going to have a positive response. To identify the impulse averagemarket return and average trading volume are calculated for the last 30 time periods.

rt =|rt−30|+ . . .+ |rt−1|

30

Vt =Vt−30 + . . .+Vt−1

30Long position is taken when rt/rt ≥ ψ1 and Vt/Vt ≥ ψ2.Short selling is initialized when −rt/rt ≥ ψ1 and Vt/Vt ≥ ψ2. Positions are held for 10

time intervals.Optimization parameters:ψ1 = 2,3,4,5 = current return to the average value ratio, sufficient to open a positionψ2 = 2,3,4 = current volume to the average value ratio, sufficient to open a position

2.3 Optimization frameworkAs it was mentioned before, the purpose of optimization is to choose right strategy with ad-

equate parameters from a myriad of different trading techniques. We base our choice solely onin-sample performance of trading algorithm, however there’re several nuances of optimizationprocedure that are worth mentioning.

To avoid overfitting, we introduce the following requirements for the optimization sample:• statistical representativeness, which implies contents of market movements of different

direction and amplitude (uptrends, downtrends, flat market, periods of both high andlow volatility);

10

Page 11: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

• sufficient length that leaves more than 99% of degrees of freedom after exclusion of datapoints, consumed by optimization parameters and trading rules.

The optimization method we use is the grid search, which calculates and ranks every histor-ical simulation specified. Only key parameters that have a significant impact on performanceare optimized. The range of every parameter is chosen subjectively in such a way that evenminimum and maximum values are common-sense and tradable. The optimization step is setto be minimal after consideration of computational speed.

To build objective function we use three factors:• return over the sample;• maximum drawdown of capital in percentage;• correlation with the market.The exact forms of objective functions are given in Section 3.

The open size is equal to one contract and position is always closed on the last bar of atrading day. Realistic transaction costs are incorporated in every trade.

After historical simulations a performance of every unique set of parameters is measuredand an optimal ψ∗ is determined as the one that maximizes the objective function. Thenwe compare optimized strategies with each other and form a trading portfolio of several al-gorithms.

2.4 Testing methodologyFor in-sample performance cannot be a representative estimate of real results, we construct

so called rolling optimization with walk forward analysis. It implies that the trading rules aredetermined in-sample, following the framework from Section 2.3, but tested out-of-sample.Then both periods are shifted forward and optimization with consequent walk-forward testsare repeated. In order to implement this framework we divide the full sample into subsamplesof equal size τ .

Final return of trading algorithm φ with parameters ψ over subsample i is denoted by:

Ri,φ ,ψ =τi

∏t=1+τ(i−1)

(rt,φ ,ψ +1)−1, i = [1;N]

The final return over the full sample is:

Rφ ,ψ =N

∏i=1

(Ri,φ ,ψ +1)−1

The length of subsample τ is chosen in such a way that every interval corresponds topreviously specified requirements. This can be achieved by inclusion of approximately 80000intraday returns in each subsample. Even the most data consuming strategy Moving AverageIntersection with maximum length of indicators requires only 360 input points, which deprivesus of approximately 0.45% of freedom.

11

Page 12: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

To test statistical significance we use bootstrapping methodology, as it’s unrealistic todraw any assumptions about returns distribution [2]. To determine if optimization is helpfulfor a strategy φ we randomly choose parameters before each subsample and evaluate P(R >R∗) as a portion of randomly obtained returns that outperform the chosen optimal ψ∗ out-of-sample. Parameters are chosen from the predefined set that is used for optimization. Numberof simulations is equal to 100 000. Null-hypothesis about randomness of achieved result isrejected, when p-value falls under specified significance level.

The framework performance is tested by analogy, but random strategies with random para-meters are taken to trade forward.

Final results are compared with the market performance to reason economical significanceof the optimization algorithm.

12

Page 13: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

3 Empirical resultsIn this section we implement the proposed framework to find out the set of optimal para-

meters ψ∗ for each algorithm and calculate weights of strategies upon the results of optimiz-ation. Hereupon we perform walk-forward analysis and compare the final performance withrandom parameters trading and buy-and-hold market result.

3.1 Optimizing the algorithmFirst we optimize each algorithm and check if it gives us significantly better results than

trading the strategy with random parameters. To find ψ∗i we employ four different objectivefunctions.

At first, we ignore the question of risk and assume that we can maximize strategy out-of-sample performance by taking the set of parameters that has given us the highest return oversubsample. Therefore we use ψ∗i that solves maxψ(Ri−1,φ ,ψ). The walk-forward results ofusing return as an assessment criterion are given in Table 1.

Table 1: Walk-forward results for the Highest Return Optimization

φE-mini S&P 500 OMXS30 Futures RTS Futures

R p-val R p-val R p-valTweezer −47.42% 2.68% 69.99% 5.42% 71.52% 4.78%MA 61.30% 13.82% 56.35% 73.06% 31.29% 86.51%RSI −11.55% 13.77% 114.96% 0.00% 373.25% 0.00%Support/resistance −55.47% 0.21% 27.33% 64.57% 93.82% 0.03%Market Impulse −7.23% 8.19% 6.26% 40.36% 23.97% 27.60%

Optimization with Highest Return objective function clearly gives us substantial excessperformance over random parameters trading for Tweezer and Relative Strenght Index. Ob-tained p-values are lower than 10% significance level or close to it, pointing out that thesereturns are not achieved by chance. The results of the other strategies are controversial. Op-timization of Moving Average and Market Impulse shows some considerable improvementover trading with random parameters only on the American market. Support/Resistance ex-cess return is statistically significant on the American and Russian markets, but negligiblewhile trading Swedish OMXS30 futures.

As a second criterion we use Reward to Risk Ratio, which interprets risk as a maximumdrawdown of capital:

RRRi,φ ,ψ =

{Ri,φ ,ψ/DDi,φ ,ψ , if Ri,φ ,ψ ≥ 0Ri,φ ,ψDDi,φ ,ψ , if Ri,φ ,ψ < 0

The maximization of RRRi,φ ,ψ gains results, depicted in Table 2.

13

Page 14: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Table 2: Walk-forward results for the Highest RRR Optimization

φE-mini S&P 500 OMXS30 Futures RTS Futures

R p-val R p-val R p-valTweezer −47.59% 3.23% 74.22% 2.97% 62.31% 13.76%MA 53.25% 29.85% 60.15% 65.67% 17.21% 94.23%RSI −14.60% 20.84% 97.39% 0.00% 294.00% 0.02%Support/resistance −55.47% 0.28% 28.87% 59.84% 74.82% 0.33%Market Impulse −7.23% 8.28% 7.16% 30.69% 17.34% 69.77%

After incorporation of risk in objective function, the returns of some trading strategiesvisibly decline. The corresponding p-values for Moving Average and RSI on the Americanmarket are no longer close to critical area, making these returns statistically insignificant. Therest of strategies perform almost the same as with the Highest Return optimization.

Designing the consecutive evaluation criteria we take into consideration the dependenceon the market β , which is estimated as correlation between market and strategy returns withinsubsample. The combination of profitability and market dependence gives us two followingindicators, which basically differ only in weights of described factors.

ζi,φ ,ψ =

{Ri,φ ,ψ / |βi,φ ,ψ |, if Ri,φ ,ψ ≥ 0Ri,φ ,ψ |βi,φ ,ψ |, if Ri,φ ,ψ < 0

ζ′i,φ ,ψ =

{Ri,φ ,ψ /

√|βi,φ ,ψ |, if Ri,φ ,ψ ≥ 0

Ri,φ ,ψ√|βi,φ ,ψ |, if Ri,φ ,ψ < 0

βi,φ ,ψ = Cor(rt ,rt,φ ,ψ), t = 1+ τ(i−1) . . . τi

Corresponding results are displayed in Tables 3 and 4.

Table 3: Walk-forward results for the Highest ζ Optimization

φE-mini S&P 500 OMXS30 Futures RTS Futures

R p-val R p-val R p-valTweezer −60.17% 92.67% 27.61% 92.69% 59.87% 18.04%MA 44.76% 50.21% 57.48% 72.03% 170.09% 11.45%RSI −23.88% 53.92% 36.94% 5.68% 217.59% 0.62%Support/resistance −59.73% 5.69% 27.02% 65.91% 84.11% 0.14%Market Impulse −8.29% 25.62% 10.81% 6.60% 21.32% 42.20%

14

Page 15: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Table 4: Walk-forward results for the Highest ζ ′ Optimization

φE-mini S&P 500 OMXS30 Futures RTS Futures

R p-val R p-val R p-valTweezer −53.84% 41.78% 35.22% 81.75% 73.88% 3.84%MA 39.04% 64.20% 60.35% 65.30% 198.06% 6.39%RSI −16.90% 28.13% 102.70% 0.00% 315.11% 0.00%Support/resistance −55.59% 0.28% 28.55% 59.65% 98.61% 0.00%Market Impulse −8.29% 25.11% 7.75% 24.74% 23.96% 27.08%

Incorporation of the market correlation considerably worsens out-of-sample return of allstrategies. The only exception is Moving Average on the Russian market, whose perform-ance soars after taking β into account. Lowering the weight of β in the evaluation criterionincreases the returns inessentially (Table 4). As an improvement over the Highest Return op-timization takes place only in one case on one market, we exclude ζ and ζ ′ from the list ofperformance indicators while comparing the algorithms with each other.

To sum up, maximization of in-sample final return has a significant positive impact onout-of-sample performance of Tweezer and Relative Strength Index. Optimization of MovingAverage, Support/Resistance levels and Market Impulse also gives significantly better resultsthan trading with random parameters, but not on all the markets. Incorporation of capitaldrawdown in the objective function exerts a negative influence on performance in general, butthe most of algorithms maintain the returns on the same level. Correlation with the market isnot relevant to evaluate strategy performance.

3.2 Choosing the strategyNext step after parameters optimization is choosing the strategy to trade forward. Fol-

lowing the rules of diversification, it seems reasonable to include more than one algorithmin trading portfolio, therefore we divide invested capital into several parts. By analogy withoptimization of parameters, the weights are based solely on in-sample performance, whichrepresents a degree of strategy credibility. Performance is assessed with the help of two indic-ators: Return over the subsample and Reward to Risk Ratio.

We also introduce barriers and don’t trade forward the strategy if its best return is neg-ative in optimization subsample or maximum RRR is less than one. Weight of strategy φ insubsample i is calculated as following:

ωi,φ = (R∗i−1,φ )+ / ∑φ

(R∗i−1,φ )+

ω′i,φ = (RRR∗i−1,φ −1)+ / ∑

φ

(RRR∗i−1,φ −1)+

R∗i−1,φ = maxψ

(Ri−1,φ ,ψ), RRR∗i−1,φ = maxψ

(RRRi−1,φ ,ψ), (x)+ ≡max(x,0)

The tables with weights calculation are adduced in Appendix B.

15

Page 16: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

3.3 Walk forward resultsWalk forward results for the American market are displayed in Tables 5 and 6. We also

calculate p-values for final returns over the full sample by simulating the trading of randomstrategy with random parameters.

Table 5: E-mini S&P 500. Walk forward results for the Highest Return optimization.

SubsamplePortfolio Market

R DD RRR R DD RRR2 0.11% 4.63% 0.02 6.67% 12.23% 0.553 5.94% 5.23% 1.14 −16.49% 22.73% 0.004 25.22% 8.45% 2.99 −25.84% 49.18% 0.005 2.44% 3.99% 0.61 25.51% 9.47% 2.696 4.41% 3.57% 1.21 10.60% 17.2% 0.627 5.82% 3.20% 1.82 5.28% 19.68% 0.27Final 50.16% 8.45% 5.94 −3.42% 57.94% 0.00

Table 6: E-mini S&P 500. Walk forward results for the Highest RRR optimization.

SubsamplePortfolio Market

R DD RRR R DD RRR2 0.3% 4.50% 0.07 6.67% 12.23% 0.553 7.74% 3.50% 2.21 −16.49% 22.73% 0.004 20.32% 11.07% 1.84 −25.84% 49.18% 0.005 0.38% 2.02% 0.19 25.51% 9.47% 2.696 4.15% 2.76% 1.51 10.60% 17.2% 0.627 0.16% 0.47% 0.35 5.28% 19.68% 0.27Final 36.22% 11.07% 3.27 −3.42% 57.94% 0.00

P-values for returns of both strategy portfolios are less than 0.01%, which suggests thatboth optimization frameworks result in statistically significant improvement over randomparameters trading. The Highest Return objective function helps to outperform the marketin 4 of 6 subsamples and results in substantial performance improvement over the full sample.The Highest RRR objective function gives better results than the market in 3 of 6 cases andmaintains outperformance of the overall return, though slightly decreasing the returns.

16

Page 17: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Table 7: OMXS30 futures. Walk forward results for the Highest Return optimization.

SubsamplePortfolio Market

R DD RRR R DD RRR2 11.6−% 4.62% 2.51 −13.5% 31.50% 0.003 18.14% 6.82% 2.66 −34.06% 45.21% 0.004 8.73% 3.51% 2.49 44.45% 10.29% 4.325 4.45% 3.28% 1.36 15.10% 13.04% 1.166 12.43% 3.71% 3.35 −15.71% 29.46% 0.00Final 68.35% 6.82% 10.02 −20.06% 57.94% 0.00

Table 8: OMXS30 futures. Walk forward results for the Highest RRR optimization.

SubsamplePortfolio Market

R DD RRR R DD RRR2 11.69% 3.51% 3.33 −13.5% 31.50% 0.003 21.54% 5.27% 4.09 −34.06% 45.21% 0.004 6.94% 4.13% 1.68 44.45% 10.29% 4.325 5.84% 2.79% 2.10 15.10% 13.04% 1.166 9.88% 3.16% 3.13 −15.71% 29.46% 0.00Final 68.85% 5.27% 13.06 −20.06% 57.94% 0.00

The Swedish market (Tables 7 and 8) is outperformed in 3 of 5 cases by both objectivefunctions. Corresponding p-values are 2.28% and 2.02%. The overall excess return, given bythe algorithm is almost 90%, which is three times higher than one obtained on the Americanmarket. The latter supports the statement of less efficiency of NASDAQ OMX Nordic, asinformation on less efficient markets is absorbed slower giving additional opportunities fortraders.

Table 9: RTS futures. Walk forward results for the Highest Return optimization.

SubsamplePortfolio Market

R DD RRR R DD RRR2 10.43% 5.96% 1.75 −1.79% 23.76% 0.003 36.58% 13.19% 2.77 −70.46% 78.26% 0.004 23.92% 6.51% 3.68 128.64% 36.11% 3.565 3.05% 6.88% 0.44 −8.46% 26.99% 0.006 7.06% 2.94% 2.41 33.78% 12.93% 2.617 5.50% 3.04% 1.81 10.88% 16.70% 0.658 11.19% 5.40% 2.07 −16.79% 41.43% 0.00Final 141.86% 13.19% 10.76 −25.17% 81.34% 0.00

17

Page 18: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Table 10: RTS futures. Walk forward results for the Highest RRR optimization.

SubsamplePortfolio Market

R DD RRR R DD RRR2 13.42% 3.84% 3.49 −1.79% 23.76% 0.003 33.43% 10.00% 3.34 −70.46% 78.26% 0.004 21.37% 6.21% 3.44 128.64% 36.11% 3.565 7.35% 2.88% 2.55 −8.46% 26.99% 0.006 6.56% 1.79% 3.67 33.78% 12.93% 2.617 7.25% 1.87% 3.88 10.88% 16.70% 0.658 9.61% 2.70% 3.43 −16.79% 41.43% 0.00Final 147.01% 10.00% 14.7 −25.17% 81.34% 0.00

The Russian futures market (Tables 9 and 10) is outplayed in 4 of 6 cases, giving theoverall surplus return of 170%. These results are consistent with the notion that the Russianmarket is thought to be less efficient than Swedish or American. P-values are 6.05% for theHighest Return optimization and 5.43% for the Highest RRR.

The other important detail is the drawdown over the full sample. The first objective func-tion has given us 9% versus 58% on the American market, 7% versus 58% on the Swedishmarket and 13% versus 81% on the Russian market. The maximization of RRR has achievedthe level of risk to 11%, 5% and 10% for corresponding markets.

Upon the simulation results we can conclude that on all markets under investigation theoptimization helped to attain a significant outperformance both in return and risk level.

4 ConclusionIn the paper we investigate optimization of five high-frequency trading algorithms by util-

izing the minute time series of E-mini S&P 500, OMXS30 and RTS futures for six years. Fourdifferent objective functions are used to specify trading algorithm parameters. For statisticalinferences we compare the walk forward results with random parameters trading.

We find that maximization of in-sample return has a significant positive impact on out-of-sample performance of two trading algorithms. The other strategies also perform better thanby chance, but not on all the markets. Inclusion of capital drawdown in the objective functionexerts a negative influence on performance in general, but the most of algorithms maintain thereturns on the same level. Correlation with the market is not relevant to evaluate a strategyperformance.

After choosing optimal parameters we build a trading portfolio with weights, based on his-torical performance of each algorithm. The results reveal statistically significant improvementover trading the randomly chosen strategy on all three markets. We should also emphasize thatproposed optimization framework helped to outperform the buy and hold result both in returnand risk level, giving additional 170% of profit on the Russian market, 90% on NASDAQOMX and 50% on CME. The latter is consistent with notion that the American futures marketis considered to be more efficient than Swedish or Russian, and therefore gives its participantsless opportunities.

18

Page 19: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

References[1] Bessembinder, H., Chan, K., Market Efficiency and the Returns to Technical Analysis,

Financial Management, Summer, 1998.

[2] Brock, W., Lakonishok, J., LeBaron, B., Simple Technical Trading Rules and theStochastic Properties of Stock Returns, The Journal of Finance Volume 47, Issue 5(December 1992), 1731-1764.

[3] Kijima, M., Stochastic process with Applications to Finance, Chapman and Hall, 2003.

[4] Lo, A.W., Efficient Markets Hypothesis, The New Palgrave: A Dictionary of Economics,Second Edition, New York: Palgrave McMillan, 2007.

[5] Malkiel, B.G., The Efficient Market Hypothesis and Its Critics, Princeton UniversityWorking papers, 2003.

[6] Pardo, R., Evaluation and optimization of trading strategies, 2nd ed., Wiley, 2008.

[7] Reschenhofer, E., Holzmann, C., How Do Apparently Successful Trading Strategies ReallyWork?, The Open Business Journal, No.3, 2010.

[8] Shostak, F., In Defense of Fundamental Analysis: A Critique of the Efficient Market,Review of Austrian Economics 10, No.2, 1997.

[9] Tsay, R. S., Analysis of financial time series, 2nd ed., Wiley, 2010.

19

Page 20: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

A Backtesting results

Figure 5: E-mini SnP 500. Tweezer.

Figure 6: E-mini SnP 500. Moving Average Intersection.

20

Page 21: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 7: E-mini SnP 500. Relative Strength Index.

21

Page 22: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 8: E-mini SnP 500. Support/Resistance.

Figure 9: E-mini SnP 500. Market Impulse.

22

Page 23: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 10: OMXS30 Futures. Tweezer.

Figure 11: OMXS30 Futures. Moving Average Intersection.

23

Page 24: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 12: OMXS30 Futures. Relative Strength Index.

24

Page 25: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 13: OMXS30 Futures. Support/Resistance.

Figure 14: OMXS30 Futures. Market Impulse.

25

Page 26: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 15: RTS Futures. Tweezer.

Figure 16: RTS Futures. Moving Average Intersection.

26

Page 27: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 17: RTS Futures. Relative Strength Index.

27

Page 28: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Figure 18: RTS Futures. Support/Resistance.

Figure 19: RTS Futures. Market Impulse.

28

Page 29: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

B Weights calculation

Table 11: E-mini S&P 500. The Highest Return optimization

φSubsample

2 3 4 5 6 7

R∗i−1,φ

Tweezer −8.25% −2.77% −11.71% −5.51% −13.06% −4.02%MA 7.87% 8.51% 11.56% 37.88% 9.5% 6.2%Rsi 6.62% 0.9% 0.16% 2.88% 15.15% 5.3%Channels −2.09% −1.76% −12.63% −21.58% −9.75% −7.35%Momentum 0.02% −1.38% 1.12% 1.58% 2.01% 0.31%

ωi,φ

Tweezer 0% 0% 0% 0% 0% 0%MA 54.22% 90.45% 90.02% 89.47% 35.63% 52.54%Rsi 45.64% 9.55% 1.28% 6.8% 56.82% 44.86%Channels 0% 0% 0% 0% 0% 0%Momentum 0.15% 0% 8.69% 3.73% 7.55% 2.61%

Table 12: E-mini S&P 500. The Highest Reward to Risk Ratio optimization

φSubsample

2 3 4 5 6 7

RRR∗i−1,φ

Tweezer −0.95 −0.66 −0.87 −0.36 −0.93 −0.57MA 4.98 4.09 4.42 7.24 3.22 1.15Rsi 3.52 0.69 0.05 15.27 12.28 22.23Channels 0 0 0 −0.01 0 0Momentum 0.02 0 0.69 0.59 2.65 0.12

ωi,φ

Tweezer 0% 0% 0% 0% 0% 0%MA 58.59% 100% 100% 32.16% 17.76% 4.92%Rsi 41.41% 0% 0% 67.84% 67.67% 95.08%Channels 0% 0% 0% 0% 0% 0%Momentum 0% 0% 0% 0% 14.58% 0%

29

Page 30: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Table 13: OMXS30 Futures. The Highest Return optimization

φSubsample

2 3 4 5 6

R∗i−1,φ

Tweezer 11.96% 12.74% 31.47% 10.51% 11.95%MA 32.09% 14.3% 38.77% 17.86% 16.52%Rsi 7.46% 19.74% 35.99% 18.94% 9.87%Channels 26.42% 18.82% 36.22% 12.91% 6.69%Momentum 1.29% 6.28% 7.7% 2.9% 2.78%

ωi,φ

Tweezer 15.1% 17.72% 20.96% 16.65% 25%MA 40.51% 19.9% 25.82% 28.3% 34.55%Rsi 9.41% 27.46% 23.97% 30% 20.65%Channels 33.35% 26.18% 24.12% 20.45% 13.99%Momentum 1.63% 8.74% 5.13% 4.6% 5.81%

Table 14: OMXS30 Futures. The Highest Reward to Risk Ratio optimization

φSubsample

2 3 4 5 6

RRR∗i−1,φ

Tweezer 7.65 4.69 6.68 4.56 5.47MA 14.51 3.25 7.11 4.76 5.52Rsi 6.78 14.34 11.21 18.08 7.63Channels 16.7 7.01 8.89 6.11 1.63Momentum 3.03 5.5 3.9 1.59 1.95

ωi,φ

Tweezer 15.72% 13.48% 17.68% 12.99% 24.64%MA 29.81% 9.33% 18.81% 13.57% 24.85%Rsi 13.94% 41.23% 29.66% 51.52% 34.37%Channels 34.31% 20.15% 23.52% 17.4% 7.36%Momentum 6.23% 15.81% 10.33% 4.53% 8.78%

30

Page 31: Optimization importance in high-frequency …528567/FULLTEXT01.pdfOptimization importance in high-frequency algorithmic trading Vadim Suvorin Dmytro Sheludchenko 26th May 2012 1 Contents

Table 15: RTS Futures. The Highest Return optimization

φSubsample

2 3 4 5 6 7 8

R∗i−1,φ

Tweezer 14.75% 2.03% 33.43% 23.18% 1.7% 3.49% 9.59%MA 28.27% 13.57% 145.97% 52.58% 17.77% 10.69% 17.31%Rsi 32.45% 23.56% 83.33% 44.69% 18.39% 8.81% 13.3%Channels 1.22% 5.42% 16.23% 16.3% 12.38% 9.77% 9.39%Momentum 2.59% 11.74% 5.44% 9.66% −0.12% 5.24% 5.76%

ωi,φ

Tweezer 18.61% 3.61% 11.75% 15.83% 3.37% 9.18% 17.32%MA 35.66% 24.09% 51.33% 35.92% 35.37% 28.12% 31.27%Rsi 40.93% 41.84% 29.3% 30.52% 36.6% 23.2% 24.03%Channels 1.54% 9.62% 5.71% 11.13% 24.65% 25.72% 16.97%Momentum 3.26% 20.85% 1.91% 6.6% 0% 13.78% 10.41%

Table 16: RTS Futures. The Highest Reward to Risk Ratio optimization

φSubsample

2 3 4 5 6 7 8

RRR∗i−1,φ

Tweezer 13.63 0.34 6.84 7.88 0.53 2.89 5.32MA 12.42 3.37 12.54 7.39 3.84 3.15 4.54Rsi 44.38 18.6 19.38 22.26 13.17 4.46 8.75Channels 0.52 1.34 2 9.57 11.95 14.5 17.91Momentum 1.03 8.49 1.25 4.27 0 3.04 6.26

ωi,φ

Tweezer 19.07% 0% 16.28% 15.34% 0% 10.32% 12.44%MA 17.37% 10.6% 29.86% 14.38% 13.25% 11.23% 10.61%Rsi 62.11% 58.5% 46.13% 43.33% 45.48% 15.91% 20.45%Channels 0% 4.2% 4.76% 18.62% 41.27% 51.71% 41.88%Momentum 1.44% 26.69% 2.97% 8.32% 0% 10.83% 14.63%

31