0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)

15 Ansichten16 Seiten#Algotrading #Value INvesting #Indian Traders

Mar 03, 2020

© © All Rights Reserved

#Algotrading #Value INvesting #Indian Traders

© All Rights Reserved

0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)

15 Ansichten16 Seiten#Algotrading #Value INvesting #Indian Traders

© All Rights Reserved

Sie sind auf Seite 1von 16

Market Timing Signals

Under the guidance of: Ritabrata Bhattacharyya

WorldQuant University MScFE

neilstrong2003@yahoo.com; varunkumarpothula@gmail.com;

ritabrata.bhattacharyya@wqu.org

Abstract

In this exercise, we attempt to develop an institutional quality investment cum trading strategy with

small and retail investor in mind. Apart from lack of professional expertise and smaller investible

amounts, individual investors also face limitations in their ability to taking short positions. Considering

these restrictions, we attempt to develop a value investment strategy and augment the portfolio

performance by timing its positions. Every quarter, we screen value stocks (having high book-to-market

ratio) based on Piotroski F-Score algorithm (and a Modified FS-Score algorithm); and take active

positions in these stocks, in the interim. We compare the performance of our algorithms with that of

original Piotroski F-Score algorithm and with that of S&P 500 Value index (SPYV).

Keywords: Piotroski, value investing, technical indicators, Quantopian

Introduction

The recent advances in areas like AI, cloud-computing infrastructure and various other technologies

has led the current trend in data-driven decision making across the economy, and investment

management is no exception. With development of crowd-sourced trading and backtesting platforms

like Quantopian™, QuantConnect™ and so on, the bar for access to sophisticated investments like

Hedge Funds has been reduced. As such any retail investor with just a nominal amount to invest can

adopt scientific investment system that was previously accessible only to institutional investors. We

hereby intend to offer retail investors an investment cum trading strategy developed with a rigor applied

by institutional investors. While doing so, we hold Asset Management viewpoint, described by [Anson,

M. (2004)]. [Anson, M. (2004)] states that two important components of investment performance are

strategic and tactical asset allocation. Strategic asset allocation provides an institutional investor with

target allocation among the major asset class viz., debt, equity, real assets etc. It is designed to meet

goals of the organization under normal market conditions over a full market cycle, ranging from two to

ten years. Tactical asset allocation on the other hand is designed to take advantage of opportunities in

the financial markets when certain markets appear to be out of sync. In other words, tactical asset

allocation attempts to ‘beat’ the market. [Anson, M. (2004)] goes on to state that an effective way to

manage total funds is to divide into two asset classes, i.e., alpha drivers and beta drivers. While beta

drivers determines fund’s overall market exposure, alpha risk measures a fund’s deviation from beta

risk. Alpha can be measured by an underweights or overweight to a benchmark; this represents tactical

asset allocation.

[Anson, M. (2008)] suggests further advancement to the above doctrine wherein he describes

bifurcation between beta and alpha drivers and christens it beta continuum. He states that there are

different forms of beta that lead the way up to (pure) alpha. These factors are:

Classic beta typically defined with respect to broad stock market index viz., S&P 500,

DOWJONES 30, Russell 1000 etc.

Bespoke beta describes method in which asset managers capture local risk premiums.

Alternative beta any beta that is not sourced from broad market

Fundamental beta is connected to fundamental indexation and hold notion that capitalization

weighted index have an inherent inefficiency.

Copyright ⓒ XXXX SERSC

Working Paper May 19

Vol. x, No. x, (20xx)

Cheap beta beta that can be embedded as a complex basket of or risk premium capture such

as index funds as ETFs.

Active beta constitutes world of products that use quantitative tools and models to capture

so-called systematic irregularities in the markets..

Bulk beta contain a considerable amount of systematic risk in their returns but the trade-off

is that there is a large capacity for AUM….and finally

Pure alpha

In order to be able to beat the market, a manager must possess either stock picking skills or market

timing skills or both. Stock picking (selection) is a process of identifying which stocks to overweight

and which to underweight the portfolio. Most of stock selection is based around fundamental analysis,

i.e., finding intrinsic value of a stock. Value investing is an investment discipline that involves taking

long position on stocks at prices lower than their intrinsic value, while shorting the ones that are

significantly above its intrinsic value. One of the most prolific stock picking strategies of our time is

[Piotroski, J.D. 2000]. Piotroski lays down an approach to select securities among the universe of high

book-to-market securities based on their fundamental strength inscribed by a 9 point distinct score (in

slow information disseminating environment).

Piotroski attempts to generate stock selection signals by assessing firms that meet three criteria, viz.,

quality of current profitability, leverage and operational efficiency. Each criterion is expressed as a

binary score; making a total score out of 9. The equation is represented as:

1 F-Score

∴ 𝐹_𝑆𝐶𝑂𝑅𝐸 = 𝐹 (1)

where

EBIT

F1 = 1 If > 0, else 0

Total Assets

CFO

F2 = 1 If > 0, else 0

Total Assets

EBIT EBIT

F3 = 1 If − > 0, else 0

Total Assets Total Assets

CFO − EBIT

F4 = 1 If > 0, else 0

Total Assets

F5

LT Debt LT Debt

= 1 If − < 0, else 0

AVG(Total Assets ,Total Assets ) AVG(Total Assets ,Total Assets )

Current Assets Current Assets

F6 = 1 If −

Current Liabilities Current Liabilities

> 0, else 0

Sales Sales

F7 = 1 If − >0, else 0

Total Assets Total Assets

F8 = 1 If Gross Profit Margin − Gross Profit Margin

> 0, else 0

F9 = 1 If Shares Outstanding − Shares Outstanding

≤ 0, else 0

The idea is to long the high-scorers and short the low-scorers (for market neutral strategy). Piotroski

claimed that the mean return earned by the high book-to-market investor can be increased by ≥ 7.5%

annually through a selection of financially strong high book-to-market firms. Further, his long-short

strategy generated a 23% annual return for the research horizon.

[W. Gray, 2015] suggests a little tweak in the original F-Score equation to FS-score (Financial

Strength), wherein variables of i) operating cash flows are replaced with Free cash-flows, ii) includes

additional variable as ΔFCFTA and iii) equity issuance is replaced with net equity issuance;

2 FS-Score

∴ 𝐹𝑆 = 𝐹𝑆 (2)

where

2

Working Paper May 19

Vol. x, No. x, (20xx), pp. xx-xx

FCF

F2 = 1 If > 0, else 0

Total Assets

FCF FCF

F3 = 1 If - >0, else 0

Total Assets Total Assets

F10 = 1 If (Net Shares Outstanding) − (Net Shares Outstanding) >0

Now, though the proponents of EMH [EF Fama – 1960] argue that investors are precluded from

consistently exploiting mispriced securities; pricing inconsistencies are ubiquitous. The natural question

would be; whether both stock picking and market timing signals can be combined to generate excess

returns consistently?

While choosing a trading signal, we must consider following two facts. First, the stocks in our

universe are value stocks, i.e., they are currently trading at prices lower than their intrinsic value and

are usually low beta1 stocks. Secondly, while applying Piotroski F-Score algorithm, we expect that

certain stock will revert from their current trend. Therefore the natural choice is to exploit mean

reversion signal(s) to identify when the current trend will revert. In other words, we are interested in

identifying an extraordinary prices post which the prices should regress to its mean.

Now, given that Piotroski F-Score screens out potential mean reverting candidates on a quarterly

basis, it would be worthwhile to explore whether mean reverting tendencies of this Piotroski portfolio

can be exploited in lower frequencies, say, daily, or weekly? Given the selected securities are

fundamentally sound yet neglected securities, intuitively, sooner or later their prices shall revert towards

their true potential, i.e., the such securities display mean reverting tendencies. However, market price

by themselves are noisy. So we look at the mean reversion in volume of the security. Volume signal

conferring with the price signal would buttress our belief about the movement. Further, volatility signal

also contains information in that it helps to confirm the strength of the current price movement. We

therefore intend to develop a combined signal out of individual price, volume and volatility indicators.

Precisely, our algorithm will try to time the cusp in rise in price levels of the stocks, screened by F-

Score or FS-Score algorithm, with the help of feature(s) that signify (positive) direction in current price

trend, its magnitude (volume) and strength (volatility) of the signal. We shall compare the performance

of our algorithm with that of original Piotroski algorithm and that of our chosen benchmark.

Several studies have been carried out to validate performance of Piotroski F-score in various context,

say across geographies, economies, styles and so on. Likewise, several studies have been conducted on

the merits of, or presence of either stock picking or market timing skills. More recently, several

researches have demonstrated how machine-learning based approaches can aid technical analysis in

stock trading. Though, In this exercise, we try to keep it simple by using financial statement heuristics

for stock picking, as described in [Piotroski, J.D. 2000] and standard technical indicators that most stock

traders are familiar with. In particular, we intend to test our algorithm with rigor applied in academia

yet be robust to real life trading environment; i.e., as mentioned before, most individual and retail

investors do not have the capacity to take (and maintain) short positions. Therefore, ours is a long only

strategy with an active risk management feature (trailing stop loss). We conduct the Backtest with a

nominal amount that is typical of the ticket size of small and marginal investors. The market impact in

such case is almost negligible.

Asset selection

[EF Fama – 1960] state that in a semi-strong form efficient market, the security’s current price

reflects all publicly available information in that the investors cannot earn excess returns by simply

picking stocks on the basis of fundamental analysis. In weak form efficient markets the current price of

the security fully reflects all past prices and data in that investors cannot earn excess returns by

conducting technical analysis.

1

Less sensitive to broad market movements

3

Working Paper May 19

Vol. x, No. x, (20xx)

Empirical evidence has been mixed and generally do not support strong forms of market

efficiency234; market participants, as well as academia, acknowledge the existence of anomalies, from

time to time, which negates the efficient market hypothesis. Examples of anomalies include, but are not

limited to observations that, neglected stocks and those with high book-to-market tend to achieve

abnormally higher returns than would otherwise be stipulated by CAPM. Further, [Dreman and Berry,

1995] also find that low P/E stocks have greater returns. In other words, it is not completely impossible

to earn excess returns. As stated above, excess returns, i.e., alpha, comprises of stock selection

component (fundamental analysis) as well as market timing component (technical analysis).

There are many approaches to stock selection, the two canonical ones are value investing and growth

investing (there are others that are hybrid of value and growth, income investing, etc.). Initially proposed

by B Graham and D Dodd5, value investing is an investment paradigm that involves buying securities

that are underpriced in the hope that the market will soon discover its true value. Since then the subject

has been extensively researched. One such work that has captured the imagination of many (including

ours) is [Piotroski, J.D. 2000]. Piotroski lays down an approach to select securities among the universe

of high book-to-market securities based on their fundamental strength inscribed by a 9 point distinct

score (in slow information dissecting environment).

[W. Gray, 2015] suggests a little tweak in the original 1 F-Score1 F-Score equation to 2 FS-Score

(Financial Strength Score), wherein variables of i) operating cash flows are replaced with a ratio of Free

Cash-Flows to firm to Total Assets (FCFTA), ii) includes additional variable as 𝛥FCFTA and iii) equity

issuance is replaced with net equity issuance (which differs with original equity issue in case there’s a

buyback)6. So their final FS-Score is out of 10 (as opposed to 9 of the original 1 F-Score). It is claimed

that, for the period 1974 through 2014, FS-score delivered a tad better result than F-score which in turn

beat the broader market 7.5% p.a.

The Piotroski F-Score strategy works well for securities that are neglected by the analyst, and where

there is generally low information dissemination. The low book-to-market stocks, however, display

different characteristics. [Mohanram, 2005] classifies that top 20% of low book-to-market stock

universe, which is covered by the analyst community and for which the investors are more optimistic

about, resulting almost instantaneous price reaction (usually positive), such stocks are coined, “glamor

stocks”. Mohanram claims that the returns on stocks selected by fundamental analysis (such as

Piotroski’s F-Score) alone are inconsistent. Certain measures tailored for glamor (growth) stocks, viz.,

earnings stability, growth stability, intensity to R&D/ capital expenditure/ Advertising enables a far

more consistent performance. Like Piotroski, Mohanram proposes G-Score, a sum of 8 binary signals

relating to earnings and cash flow as follows:

3 G-Score

𝐺 − 𝑆𝑐𝑜𝑟𝑒 = 𝐺𝑖 (3)

where

𝐺1 = 1 if Stock ROA ≥ Industry median ROA, 0 otherwise

𝐶𝐹𝑂

𝐺2 = 1 if Stock

AVG(TAt ,TAt-1 )

𝐶𝐹𝑂

≥ Industry median , 0 otherwise

AVG(TAt ,TAt-1 )

2

Francis Nicholson. Price-Earnings Ratios in Relation to Investment Results. Financial Analysts Journal. Jan/Feb 1968:105–

109.

3

Basu, Sanjoy (1977). "Investment Performance of Common Stocks in Relation to Their Price-Earnings Ratios: A test of the

Efficient Markets Hypothesis". Journal of Finance. 32 (3): 663–682. doi:10.1111/j.1540-6261.1977.tb01979.x.

4

Rosenberg B, Reid K, Lanstein R. (1985). Persuasive Evidence of Market Inefficiency. Journal of Portfolio Management

13:9–17.

5

Graham, B., Dodd, D.L.F. and Cottle, S., 1934. Security analysis (pp. 44-45). New York: McGraw-Hill.

6

Gray, W. R. (2015, May). Simple Methods to Improve the Piotroski F-Score. Retrieved from

https://www.aaii.com/journal/article/simple-methods-to-improve-the-piotroski-f-score.touch AAII Journal

4

Working Paper May 19

Vol. x, No. x, (20xx), pp. xx-xx

𝐶𝐹𝑂

𝐺3 = 1 If Stock ≥ ROA, 0 otherwise

AVG(TAt ,TAt-1 )

𝐺4 = 1 If stock 𝜎 ≤ Industry median 𝜎 , 0 otherwise

𝐺5 = 1 If Stock 𝜎

≤ Industry median 𝜎 , 0 Otherwise

𝑅&𝐷 𝑝. 𝑎.

𝐺6 = 1 If Stock

𝑇𝑜𝑡𝑎𝑙 𝐴𝑠𝑠𝑒𝑡𝑠 (𝑠𝑡𝑎𝑟𝑡)

𝑅&𝐷 𝑝. 𝑎.

≥ Industry median , 0 otherwise

𝑇𝑜𝑡𝑎𝑙 𝐴𝑠𝑠𝑒𝑡𝑠 (𝑠𝑡𝑎𝑟𝑡)

𝐶𝑎𝑝𝐸𝑥

𝐺7 = 1 If Stock

𝑇𝑜𝑡𝑎𝑙 𝐴𝑠𝑠𝑒𝑡𝑠 (𝑆𝑡𝑎𝑟𝑡)

𝐶𝑎𝑝𝐸𝑥

≥ Industry median , 0 otherwise

𝑇𝑜𝑡𝑎𝑙 𝐴𝑠𝑠𝑒𝑡𝑠 (𝑆𝑡𝑎𝑟𝑡)

𝐴𝑑𝑣𝑡. 𝑆𝑝𝑒𝑛𝑑

𝐺8 = 1 If Stock

𝑇𝑜𝑡𝑎𝑙 𝐴𝑠𝑠𝑒𝑡𝑠

𝐴𝑑𝑣𝑡. 𝑆𝑝𝑒𝑛𝑑

≥ Industry median , 0 otherwise

𝑇𝑜𝑡𝑎𝑙 𝐴𝑠𝑠𝑒𝑡𝑠

Market timing

Market timing implies generating technical signals based on price trends. The two fundamental

trends observed in an asset market are momentum, i.e., the rising security will continue to rise and

falling security will continue to fall; and mean reversion, i.e., rising or falling security reverting to its

mean levels. Mean Reversion in finance is an assumption that the price of a stock tends to move towards

the long term mean or average price level. Most of the people in economics believe that what goes up

would eventually come down [De Bondt 1991]. This is the concept of mean reversion whose presence

or absence in an asset class is an important factor in designing its investment/ trading methodology.

A simple approach to trade mean reversion is to take a long position when there is a huge drop in

stock price and short the stock when there is a sharp rise in stock price. Most recently, [R.

Krishnamurthy, 2018] examined the possibility of a profitable mean reversion trading strategy by

creating and backtesting a mean-reverting trading algorithm.

However, there are more defined and standard ways to trade mean reversion. Per [Marwood, 2018]

There are four major ways to trade mean reversion, viz., technical indicators like Bollinger Bands,

Relative Strength Index (RSI), Moving Average Convergence Divergence (MACD), Standard

Deviation, Money Flow Index and so on; financial information/ news; economic indicators such as

GDP, inflation, interest rates, etc.; sentiment indicators which seek to quantify what a group feels about

the market economy, these sentiments signal the future course of direction7.

Mean reversion strategies don’t produce good results for all kinds of stocks. Stocks with high

momentum such as growth stocks are not suitable for mean reversion strategies. On the other hand, the

stocks that have more stationary prices and less momentum produces better results when traded with

mean reversion strategies. Value stocks are one such example of stocks with relatively stationary prices

and less momentum.

We aim to test three long-only portfolios, as follows:

1. Buy and hold portfolio based on Piotroski F-Score algorithm, rebalanced effectively Y-o-Y

2. Active portfolio comprised of securities selected based on F-Score algorithm, which are

actively traded in the market based on mean reverting signals

3. Active portfolio comprised of securities selected based on FS-Score algorithm, which are

actively traded in the market based on mean reverting signals.

7

Marwood, J. (2018). How To Build A Mean Reversion Trading Strategy • JB MARWOOD. [online] JB MARWOOD.

Available at: https://jbmarwood.com/mean-reversion-trading-strategy/ [Published 20 Apr. 2018].

5

Working Paper May 19

Vol. x, No. x, (20xx)

Our tradable universe comprises of most prominent class of common stock of all listed US equities

(on all exchanges or OTC). For a holding period, before beginning of each trading day (based on NYSE

calendar) our algorithm computes F(S)-Score for entire tradable universe and selects 8s, 9s or 10s out

of that universe, as our basket of stocks to trade. Next, it would take positions in these stocks based on

the signals generated by our indicators. It is worth mentioning that F(S)-Scores are computed on a 252

trading days window; so effectively, we compute Y-o-Y F(S)-Scores that update quarterly once 10-Q

for each stock is released.

We choose SPDR Portfolio S&P 500 value index ETF (SPYV) as our benchmark. SPYV tracks

performance of US large-Capitalization stocks that display strong characteristics of value stocks.

Note that, being a long-only strategy makes it sensitive to market risk, making it fall short of pure

alpha.

The parameters of the technical indicators are validated on training data (for initial period of 10

years). Whereas, the results and conclusions are drawn on test data (for the period following the training

period. Refer Results for details.

Refer Appendix 1: explanation of the source code and standard assumptions for details

regarding entire algorithm syntax logic.

Why do we care for Piotroski F-Score and Modified FS-Score?

As one may be already familiar, the rational for applying Piotroski's F-Score algorithm (as stated in

[Piotroski, J.D. 2000]) is to separate winners from losers among the universe of high book-to-market

stocks. [Piotroski, J.D. 2000] argues that not all high book-to-market firms are winners; in fact only

44% of the stocks produce positive market-adjusted returns over two years following portfolio

formation. Typical characteristics of high book-to-market firms is that, firstly, they are neglected by the

investors as well as analyst community; secondly, they do not possess 'information dissemination'

resources like many of the 'glamour' low book-to-market stocks do; and finally, they are "financially

distressed"; as a result, the valuation of these firms focus on accounting fundamentals such as leverage,

liquidity, profitability trends and cash flow adequacy.

Effectively, the Piotroski F-Score ascertains whether or not has any aspect of a firm's financial health

improved over previous period

However, based on [W. Gray, 2015], we want to improvise on this 9 point criteria in that we are

interested in:

1. Free Cash Flow to Firm (FCF) more accurately indicates firm's financial health than the Cash

Flow from Operations because the former accounts for capital and other extra-ordinary

expenditures as well.

2. Whether this FCF has improved over time; and

3. Lastly, the 'net' stock issue; considering stock buy-back may not be unusual.

As a result, we look up to modified Piotroski FS-Score8.

Technical Indicators

For our stock screener, based on F-Score (FS-Score), we want to identify potential mean reverting

opportunities. How to be sure of a bullish opportunity? As mentioned before, a security's price, volume

and volatility possesses information about its price trend and the strength of the trend. We use the

following list of indicators.

Mean Reversion of Price:

Relative Strength Index (RSI) though a momentum oscillator, RSI is used to measure

magnitude of recent price changes to evaluate overbought and oversold conditions in the price.

8

At this point we would like to bring to notice that [W. Gray, 2015] did not find the performance of the FS-

Score to be significantly better than original F-Score algorithm. He tested for thirty year period beginning from

1974 onwards, the details for which aren’t documented in public domain.

6

Working Paper May 19

Vol. x, No. x, (20xx), pp. xx-xx

Volume:

Money Flow Index is a volume weighted indicator that identifies overbought and oversold

conditions of the stock price based on volume and price data of a security.

Volatility:

Average Directional Index (ADX) Also an oscillator, is used to determine the strength of

a trend. The reading of this indicator ranges from 0 to 100. This value determines the strength

of the current price trend in that strength increases as the reading of ADX increases. Value ≤25

represents absence of trend; whereas a value of 75≤ represents an extremely strong trend.

By way of example, a F(S)-8, F(S)-9 (or FS-10) scorer security scoring lower than say 25 or 30 on

both RSI and MFI, indicates the security is currently oversold; likewise with an ADX greater than 25

confirms the strength of the current trend. Further, when the positive directional index (part of ADX) is

greater than the negative directional index, it’s an indication that the bulls have begun to edge over

bears. To sum it up, value stocks are expected to rise in price.

Backtesting Infrastructure

A quant/ algorithmic trader might want to run simulations and backtest his algorithms before

implementing in live trading.

Recently, Python has become de-facto programming language in quantitative finance. There are

several libraries for backtesting, performance analysis and designing strategies that are made available

by the Python community, viz., Backtrader, Backtesting, PyAlgoTrade, Bt, Alphalense etc. One could

use them locally or use on specific trading platforms like QuantConnect, Websim etc. The advantage

of using online backtesting platform is that they are often accessible from a browser and perform heavy

computing remotely; plus they come with several well curated and standardized datasets. This precludes

the user from hassles of data loading and cleaning. We intend to use one such platform, Quantopian.

Quantopian is a crowd sourced hedge fund that trades in US equity long-short strategies. It aggregates

crowd sourced algorithms by way of algorithm design contest. The advantage of choosing Quantopian

over others is bias free backtesting environment covering entire, liquid US equity universe. It is

important to note that we don't intend to enter into the contest and therefore do not confirm to their risk

model.

Performance Evaluation

The results of the backtest are used to compute various performance metrics viz., annual returns,

Sharpe etc., refer Appendix 2: performance summary of in-sample backtests and Appendix 3:

performance summary of out-sample backrests for exhaustive list of metrics. Also included in

the said appendices is, a snapshot of stress period performance and Style analysis. There are ~14

identified stress periods ranging from 2007 subprime crises to 2008 Lehman bankruptcy and the ensuing

financial turmoil through 2012 Euro crisis and 'new normal' period of 2015. The style analysis captures

performance attributes of a strategy to various know factors viz., industry segments, size, value vs

growth etc.

To be certain that the results of the strategy were not one off fluke, we also conducted Bayesian

portfolio analysis.

Results

Implementation and Performance

As stated above, we compare three strategies in all, i.e., Piotroski long-only (Strategy 1), Piotroski

plus market timing signals long-only (strategy 2) and modified Piotroski plus market timing signals

long-only (Strategy 3). We optimized our strategies using data for the period beginning of 2006 through

end of 2015 (training data).

7

Working Paper May 19

Vol. x, No. x, (20xx)

The training data spans across seventeen stress event periods, including global financial meltdown

(Lehman bankruptcy) that occurred during fall of 2008 and lasted through spring 2009; the US

downgrade and European debt crisis that occurred circa Aug-2011.

For this period, the strategy 3 outperformed the other two in all respects. Strategy 3 earned 6.7% and

10.9% higher annual returns than Strategies 1 & 2, respectively, while reporting lowest annual volatility

of the three strategies; thereby generating higher risk-adjusted returns.

At ~35%, Strategy 3 also recorded the lowest Max Drawdown for the training period among the

three. The result of highest average annual (compounded) returns and lowest max drawdown is that the

Calmer ratio, i.e., the ratio of average annual returns to max drawdown, for strategy 3 was recorded the

highest (0.42) as well. The higher the returns generated per unit of risk, the better.

Strategy 3 outperformed the pack in yet another metric, Omega ratio. Omega ratio is the relative

measure of likelihood of achieving the reported return over a chosen benchmark. Omega ratio for

strategy 3 at 1.17 is marginally superior to that of strategy 1 (1.12)9.

Returns of strategy are slightly right skewed, whereas those of strategy 1 and 2 are left and centered,

respectively. The only metric where none of the strategy are significantly different is tail ratio. For all

the strategies, negative returns and positive returns are equally likely.

Above all, strategy 3 also generates highest alpha of 0.12, which is higher than the base algorithm

by a third.

However, we also report that strategy 3 exhibits high beta exposure.

This was the performance on 'training' dataset. However, for a strategy to be considered, it should

perform consistently on data it hasn't been trained on. We therefore conduct a second backtest for the

period beginning of 2016 through Q2 2019 (test data). We report that both, strategy 1 and 2 exhibited

signs of overfitting in that their annual returns dropped to 1.4% and -10.8%, respectively; whereas, that

of strategy 3 grew to 24.8%10. Here too, it topped all the metrices.

For details regarding the performance metrics for training and test data, one may refer __ and __,

respectively. Further, observing the style and factor summary table in _, we see that strategies 1 and 2

earn annual specific returns of -1.5% and -12.1%, respectively, whereas strategy 3 earns 18.6%. This

implies that returns of strategy 3 are not completely sourced from known risk and style factors and that

our stock selection and market timing signals have some explanatory power. Additionally, it would also

be worthwhile to note our strategies (strategy 3 especially) are perfectly correlated to value factor.

Investigating deeper into our backtest data, we found that strategy 1 and 2, which is based on original

Piotroski algorithm, did not hold enough positions to diversify away market risk. As a result the

volatility was high, yet at times the strategy just held cash. The Figure below contrasts the size of

holdings between strategies 1 and 2 with that of strategy 3.

9

Although we couldn’t find back-up to our claim, we believe the benchmark selected for Omega ratio is

SPYDER ETF returns.

10

Although, financial data is generally non-stationary and standard bifurcation of train-test data isn’t feasible

for drawing conclusion, we will buy this claim for now. In the next sub-section we will demonstrate the results

of our Bayesian Analysis, which is more robust.

8

Working Paper May 19

Vol. x, No. x, (20xx), pp. xx-xx

For more details on details complete performance analysis, refer Appendix 5: Tearsheets – out-

sample, accompanied in the i-Python notebook accompanying this document.

Bayesian Analysis11: Like every strategy, our strategy is subject to certain risk factors, namely the

model risk factors of estimation, model misspecification data biases, programming errors, or we face

uncertainty surrounding systematic and unsystematic factors. The results presented above are based on

backtests conducted, which is one of the sample path, which in turn is based on past events. With single

path, the chances of overfitting is high. In order to derive robust conclusions about the performance of

the strategy, we resorted to Bayesian estimation and prediction of strategy performance parameters viz.,

returns, volatility, Sharpe ratio and so on.

11

Source: Weicki, T., & Kumar, R. Bayesian performance analysis example in pyfolio. Retrieved July 25, 2019, from

https://quantopian.github.io/pyfolio/notebooks/bayesian/

9

Working Paper May 19

Vol. x, No. x, (20xx)

First, we conducted forward looking analysis based on past data, a.k.a. Bayesian cone. This analysis

applies t-statistic to determine posterior distribution for each parameter. For instance, our sample

performance of our strategy 3 is a little optimistic in that its cumulative returns were over 75 percentile

score. This indicates that the strategy may or may not deliver such exceptional performance given a

stress scenario in future, including exposure to idiosyncratic risk through individual positions.

Next we compared average daily returns, standard deviation of daily returns and (6-month rolling)

Sharpe ratio between in-sample and out-sample tests. We see that average daily returns are somewhat

more dispersed in out-sample tests compared to in-sample test; though it's comforting to see a

significant overlap between the two. The fact that out-sample has lower kurtosis and a tad higher skew

(visually) indicates that our strategy might pose slightly higher volatility with right skewedness in

reality than in in-sample test. Further, as a result the Sharpe ratio also sees greater dispersion in the out-

sample compared to its in-sample counterpart. The difference between the in-sample and out-sample

average daily returns could potentially reach ±0.1%; likewise the difference between average daily

volatilities could be as high as 6% (with 95% confidence level).

Next plot depicts the size effect by way of plotting the distribution of normalized (by standard

deviation) mean daily returns. Here we get a sense of how far apart the two distributions are. The gap

(between 5 and 97.5 percentile) is roughly 25%, considered towards higher side.

Lastly our 1 day and 5 day Bayesian VaR equal (𝛼 5%) -2% and -6%, respectively.

Refer Appendix 4: Bayesian analysis of out-sample backtests for details.

Concluding Remarks

Through this exercise, we attempted to explore possibilities beyond the original F-Score algorithm.

We designed our algorithm considering portfolio constraints faced by retail (individual) investors.

However, this need not be the case. One may include only those constraints that are relevant to them.

Secondly, as evident from Appendix 5, our portfolio is still exposed to various known risk factors. The

portfolio could be diversified away by adding more (uncorrelated) securities in the stock selection

universe. Moreover, we selected an equally weighted portfolio every time; this too can be adjusted

based on available choices of risk-return combination to the investor. Finally, the combination of

technical indicators used in here is, selected heuristically, non-exhaustive and neither are their

parameters optimized. All of the above discussed, could be addressed in subsequent research.

Disclaimer

This paper was created as part of a WorldQuant University degree program towards an MSc in

Financial Engineering. This paper is reproduced with the consent and permission of WorldQuant

University. All rights reserved

10

Working Paper May 19

Vol. x, No. x, (20xx), pp. xx-xx

References

1. Ahluwalia, R., 2011. How to combine multiple trading algorithms? Quantitative Finance Stack

Exchange. Available at: https://quant.stackexchange.com/questions/2332/how-to-combine-

multiple-trading-algorithms# [Accessed June 7, 2019].

2. Grinold, R., 2010. Signal weighting. Journal of Portfolio Management, 36(4), p.24.

3. Meucci, A., 2008. Fully flexible views: Theory and practice. Fully Flexible Views: Theory and

Practice, Risk, 21(10), pp.97-102.

4. Mabu, S., Obayashi, M. and Kuremoto, T., 2015. Ensemble learning of rule-based evolutionary

algorithm using multi-layer perceptron for supporting decisions in stock trading problems.

Applied soft computing, 36, pp.357-367.

5. Fama, E.F., 1960. Efficient market hypothesis (Doctoral dissertation, Ph.D. Thesis, Ph. D.

dissertation, University of Chicago Graduate School of Business).

6. Francis Nicholson. Price-Earnings Ratios in Relation to Investment Results. Financial Analysts

Journal. Jan/Feb 1968:105–109.

7. Basu, Sanjoy (1977). "Investment Performance of Common Stocks in Relation to Their Price-

Earnings Ratios: A test of the Efficient Markets Hypothesis". Journal of Finance. 32 (3): 663–

682. doi:10.1111/j.1540-6261.1977.tb01979.x.

8. Rosenberg B, Reid K, Lanstein R. (1985). Persuasive Evidence of Market Inefficiency. Journal

of Portfolio Management 13:9–17.

9. Graham, B., Dodd, D.L.F. and Cottle, S., 1934. Security analysis (pp. 44-45). New York:

McGraw-Hill.

10. Gray, W. R. (2015, May). Simple Methods to Improve the Piotroski F-Score. Retrieved from

https://www.aaii.com/journal/article/simple-methods-to-improve-the-piotroski-f-score.touch

AAII Journal.

11. Marwood, J. (2018). How To Build A Mean Reversion Trading Strategy • JB MARWOOD.

[online] JB MARWOOD. Available at: https://jbmarwood.com/mean-reversion-trading-

strategy/ [Published 20 Apr. 2018].

12. Dreman, D.N., 7. m. A Berry (1995). Overreaction Underreaction, and the Low-P/E Effect.

Financial Analysts Journal, July-August. P21-30

13. Piotroski, J.D., 2000. Value investing: The use of historical financial statement information to

separate winners from losers. Journal of Accounting Research, 38, pp.1-52

14. Mohanram, P.S., 2005. Separating winners from losers among low book-to-market stocks using

financial statement analysis. Review of accounting studies, 10(2-3), pp.133-170.

15. De Bondt, R. and Veugelers, R., 1991. Strategic investment with spillovers. European Journal

of Political Economy, 7(3), pp.345-366.

16. Krishnamurthy, R., 2018. Mean Reversion and Beta-Zero Targeting: A Long-Short Equity

Trading Strategy. Available at SSRN 3124271.

17. Quantopian Risk Model. Retrieved July 23, 2019, from https://www.quantopian.com/papers/risk

quantopian risk model

18. Weicki, T., & Kumar, R. Bayesian performance analysis example in pyfolio. Retrieved July 25,

2019, from https://quantopian.github.io/pyfolio/notebooks/bayesian/ pyfolio, Bayesian

tearsheet

11

Working Paper May 19

Vol. x, No. x, (20xx)

Code:

1. Define Python class Piotroski that generates F-Score for each stock in the universe

2. Define Python class Money Flow Index

3. Instantiate the algorithm in Quantopian. The initialize in-built function requires several parameters

that defines how the algorithm runs throughout the period. The parameters include but are not

limited to, passing the core algorithm, scheduling various functions such as rebalancing, recording

trades etc., defining benchmarks, trading costs, slippages etc.

4. Defining pipeline: another in-built function that returns double indexed pandas.DataFrame() object

containing each stock per each trading day and user defined columns. we want F-score (or FS-

Score) greater than 8 in our screener. In the code, We first select tradable universe, as defined by

Quantopian (refer documentation for details). From that tradable universe, we filter out stocks with

book-to-market ratio less than 1. We run our defined Piotroski algorithm to this universe to obtain

a list of stocks with F-Scores (or FS-Scores).

5. Defining another in-built function ‘before_trading_starts’. This function executes tasks before

each trading day. Here, we would like to obtain a fresh trading ‘pipeline’ (defined above), before

every trading start and record our position.

6. Next in-built function is rebalance, which is the meat of the algorithm, where trading rules are

defined. For our selected stocks, the algorithm takes position based on market timing indicators

and closes a position based on predefined rules. The rebalance function is scheduled to run daily,

in the initialize function defined above.

7. All the trading is recorded in record_vars function.

8. Lastly, we have also implemented stop-loss under another in-built function, handle_data. The

handle_data is an in-built function that runs every minute to check whether the current price is

below 90% of cost basis. If positive, it executes stop limit order at that current price.

For details pertaining to any of the above function, refer Quantopian documentation at:

https://www.quantopian.com/help

Source Code: https://github.com/NeelkanthMehta/WQU-MScFE_690_-_CapStone_Project.git

Standard assumptions across all strategies:

1. We have assumed no trading commissions, since there are a variety of brokerage options of lately;

some of the brokerage plans charge a fixed nominal monthly fee that caters to retail algorithmic

traders.

2. Standard Quantopian built-in slippage is assumed, details available here. As one can see it is a bit

simplistic assumption. In reality, the slippage could potentially weaken the strategy performance.

3. Stock rebalance occurs daily, wherein Piotroski screen is run daily, but effectively, the screener

should be updated one quarterly basis, when a company releases 10Q report.

4. The benchmark chosen is, as mentioned above, is S&P 500 value ETF or symbol SPYV. The

reason for selecting SPYV is that ours is based on selecting value stocks, which are neglected by

the market and are characterized by low returns and volatility profile. As a result SPY, could be

inappropriate. We note however, that given the availability, we would prefer Russell 2000 value

Index ETF. We believe this might mitigate size factor returns to some extent.

12

Working Paper May 19

Vol. x, No. x, (20xx), pp. xx-xx

1: Performance Summary

Piotroski Piotroski+ Mpiotroski+

Annual return 8.3% 4.1% 15.0%

Cumulative returns 121.9% 49.6% 302.3%

Annual volatility 27.9% 25.9% 23.5%

Sharpe ratio 0.43 0.28 0.71

Calmar ratio 0.13 0.09 0.42

Stability 0.69 0.34 0.95

Max drawdown -64.9% -48.0% -35.7%

Omega ratio 1.12 1.08 1.17

Sortino ratio 0.57 0.43 1.11

Skew -2.56 1.13 2.71

Kurtosis 43.73 40.50 66.17

Tail ratio 1.01 0.94 1.00

Daily value at risk -3.5% -3.2% -2.9%

Gross leverage 0.53 0.36 0.62

Daily turnover 9.9% 107.6% 197.8%

Alpha 0.08 0.05 0.12

Beta 0.54 0.33 0.58

Stress Events start end Piotroski Piotroski+ M.Piotroski+

Low Volatility Bull Market 01-Feb-06 31-Jul-07 -0.01% 0.01% -0.01%

Aug-07 01-Aug-07 31-Aug-07 0.32% 0.32% -0.32%

GFC Crash 01-Aug-07 31-Mar-09 -0.08% -0.05% 0.11%

Mar-08 04-Mar-08 31-Mar-08 -0.11% -0.11% 0.19%

Lehmann 03-Aug-08 23-Sep-08 -0.50% -0.30% 0.08%

Sep-08 03-Sep-08 30-Sep-08 -0.75% -0.47% -0.09%

2009Q1 02-Jan-09 27-Feb-09 -0.27% -0.03% -0.26%

2009Q2 11-Mar-09 20-May-09 0.61% 0.38% 0.17%

Recovery 01-Jul-09 31-Oct-12 0.13% 0.04% 0.09%

Flash Crash 05-May-10 10-May-10 0.00% 0.00% 0.73%

Fukushima 16-Mar-11 15-Apr-11 -0.28% -0.15% 0.22%

US downgrade/European Debt Crisis 11-Aug-11 31-Aug-11 0.00% 0.00% -0.33%

EZB IR Event 12-Sep-12 09-Oct-12 0.00% -0.04% 0.08%

New Normal 01-May-13 31-Aug-15 0.04% 0.07% 0.06%

Apr-14 03-Apr-14 30-Apr-14 0.00% 0.00% 0.30%

Oct-14 01-Oct-14 31-Oct-14 0.00% 0.00% 0.28%

Fall2015 22-Aug-15 26-Sep-15 0.04% 0.04% -0.24%

13

Working Paper May 19

Vol. x, No. x, (20xx)

2: Performance Summary

Piotroski Piotroski+ Mpiotroski+ Benchmark

Annual return 1.4% -10.8% 24.8% 11.1%

Cumulative returns 4.9% -32.7% 116.0% 44.1%

Annual volatility 15.3% 15.3% 18.2% 12.4%

Sharpe ratio 0.17 -0.67 1.31 0.91

Calmar ratio 0.06 -0.29 1.46 0.58

Stability 0.00 0.79 0.89 0.82

Max drawdown -22.4% -36.6% -17.0% -19.1%

Omega ratio 1.05 0.79 1.26 1.18

Sortino ratio 0.23 -0.85 2.03 1.27

Skew -0.99 -1.55 0.31 -0.48

Kurtosis 18.95 23.14 2.06 3.96

Tail ratio 1.02 0.74 1.02 0.90

Daily value at risk -1.9% -2.0% -2.2% -1.5%

Gross leverage 0.29 0.21 0.66 NAP

Daily turnover 8.8% 59.5% 198.6% NAP

Alpha -0.01 -0.11 0.16 -0.01

Beta 0.31 0.09 0.56 0.91

Piotroski Piotroski+ M.Piotroski+

Annualized Specific Return -1.5% -12.2% 18.6%

Annualized Common Return 2.8% 1.5% 4.1%

Annualized Total Return 1.4% -10.7% 24.0%

Specific Sharpe Ratio -0.04 -0.79 1.07

Exposures Summary

basic_materials 0.02 0.02 0.09

consumer_cyclical 0.20 0.13 0.08

financial_services 0.16 0.10 0.04

real_estate 0.18 0.11 0.04

consumer_defensive 0.00 0.00 0.01

health_care 0.04 0.03 0.04

utilities 0.00 0.00 0.01

communication_services 0.00 0.00 0.01

energy 0.18 0.11 0.17

industrials 0.00 0.00 0.07

technology 0.10 0.06 0.03

momentum -0.31 -0.19 -0.20

size -0.41 -0.26 -0.29

value 1.32 0.82 1.00

short_term_reversal 0.36 0.22 0.14

volatility 0.00 0.01 0.43

14

Working Paper May 19

Vol. x, No. x, (20xx), pp. xx-xx

3: Bayesian Analysis for Strategy 3

15

Working Paper May 19

Vol. x, No. x, (20xx)

For out sample tearsheets for all the strategies, refer appendix_05-capstone_project.ipynb in the

project repository shared in Appendix 1: explanation of the source code and standard

assumptions for details.

16

## Viel mehr als nur Dokumente.

Entdecken, was Scribd alles zu bieten hat, inklusive Bücher und Hörbücher von großen Verlagen.

Jederzeit kündbar.