1 Introduction

Academicians in general and finance professors in particular believe in the Efficient Market Hypothesis (EMH) that asserts stock prices already reflect all information such as the history of past prices or trading volume. Therefore, the weak-form market efficiency hypothesizes that investors may not drive profits above a buy-and-hold strategy using any technical trading rule that depends on price and/or volume; implying that technical trading rules are useless. Advocates of EMH argue that the best strategy would be to buy the market index and keep it for the long term, or the famous buy and hold strategy (BH). In this paper, we will advocate two strategies for Portuguese investors that are superior to the BH strategy recommended by the EMH. The first strategy is based on Technical Analysis (TA), and the second is based on Gold Momentum Strategy (GMS) which is based on switching between the index and gold.

Technical analysis is based on the idea that prices move in trends; according to Pring (1991, p. 3) TA is an art “to identify a trend reversal at a relatively early stage and ride on that trend until the weight of evidence shows or proves that the trend has reversed.” One of the most important indicators for trend identification is the moving average indicator. Our first strategy is based on some variations of moving average trend following techniques. Many technicians believe TA can help save an investor from extreme losses in the event of a severe bear market like the 2008 housing crisis or the 2020 Covid-19 crisis. For example, during the housing crisis of 2008, an investor would have lost 51.3% by following the BH strategy, however, this investor would have only lost 14.3% by following our recommended moving average rules.

Section 2 provides a brief review of the literature. Section 3 describes the data and methodology. Empirical results are presented in Section 4. Trading strategies are discussed in Section 5. Section 6 provides concluding remarks.

2 Brief literature review on technical analysis

A large portion of early literature supported the weak-form efficient market hypothesis implying the futility of using technical trading rule in many stock markets around the world. Examples of such research are: Larson (1960), Osborne (1962), Alexander (1964), Granger and Morgenstern (1963), Mandelbrot (1963), Fama (1965, 1970), Fama and Blume (1966), Van Horn and Parker (1967), Ball and Brown (1968), Jensen and Banington (1970), Waud (1970), Hagerman and Richmond (1973), Malkiel (2003, 2005).

However, since the mid-1980s there has been a renaissance of technical trading in academia that produced numerous articles regarding the usefulness of technical trading rules and skepticism about EMH. The most influential articles were: Sweeney (1986), Lukac et al. (1988), and Brock et al. (1992). Since the publication of these articles many other academicians have published various papers on technical trading rules. For a survey of literature on technical trading rules see Park and Irwin (2007) who review more than 100 papers based on technical trading from 1960s to August 2004. Park and Irwin conclude that most early studies support the weak-form market efficiency, however for the later studies, the evidence are mixed, 19 show mixed evidence, 56 support the usefulness of technical trading rules, and 20 do not support technical analysis. Since this survey many other studies have been conducted on both developed and emerging markets. Below is a summary of a limited number of papers regarding technical trading rules in the European stock markets.

Ergul et al. (1997), analyze 63 stocks traded on the Istanbul Stock Exchange and conclude that technical analysis on volume can aid the prediction of returns. Metghalchi and Chang (2003) apply various moving average rules to the Italian stock market and conclude that the moving average rule could beat the buy and hold (BH) strategy. Mengoli (2004) documents profitable momentum trading in case of Italy. Fifield et al. (2005) apply some simple trading rules to 11 European stock markets including Portugal stock market and conclude that only the less developed markets are informationally inefficient. Matilla-Garcıa (2006), applies some simple trading rules to investigate the Spanish stock market index (IBEX-35), they conclude that the profitability of the simple trading rule is superior to the buy-and-hold strategy. Vasiliou et al. (2006) applied moving averages and moving average convergence divergence (MACD) trading rules for Athens Stock Market and conclude a strong support for technical trading rules. Metghalchi et al. (2008) applied a simple trading rule for the Swedish stock market to conclude that technical trading can beat the buy and hold strategy even accounting for data snooping and transaction costs. Chong and Ng (2008) apply MACD and RSI trading indicators to London Stock Exchange (FT30 Index) and find support for these trading rules. Milionis and Papanagiotou (2011) analyzed alternative testing procedure for the significance of the predictive power of the Moving Average trading rule of technical for the New York Stock Exchange (NYSE), the Athens Stock Exchange (ASE) and the Vienna Stock Exchange (VSE). They conclude that for the period 1993 to 2005 the weak-form market efficiency is clearly accepted for the NYSE, is rejected for the ASE except for the last sub-period (2001 to 2005), while for the VSE, it is rejected for the first sub-period (1993 to 1997) and accepted for the other two sub-periods. Metghalchi et al. (2012) use moving average rules for 16 European countries including Portugal and find that technical trading rules works better for smaller exchanges. Urquhart and Hudson (2013) find that the UK stock market is not weak-form efficient. Pätäri and Vilska (2014) apply moving average rules to the OMX Helsinki 25 index and individual stocks included in this index and conclude that the majority of moving average strategies applied to the index and individual stocks in that index outperform the buy-and-hold strategy. Metghalchi et al. (2014) apply moving average and relative Strength indicators to Polish Stock index over the period of 9/4/1998 to 4/18/2013 and conclude that trading rules beat the profitability of the buy-and-hold strategy considering both transaction costs and risk. Sabbaghi and Sabbaghi (2018) test market efficiency of developed market during the financial crisis of 2008–2011 and conclude that most developed European markets are weak-form efficient. They also present an excellent survey of market efficiency during the global crisis of 2008–2011 for developed countries. Finally, Metghalchi et al. (2019) apply four trading rules to the daily data for the Bulgarian Stock Index from 11/21/2003 to 3/1/2018. They support the predictive power of technical trading rules in the case of Bulgaria’s stock index. They show that the famous 200 days moving average trading rule beats the profitability of the buy and hold strategy considering both risk and transaction costs. Nazario et al. (2017) provide an excellent literature review of technical analysis on stock markets.

In this paper we investigate whether the Portuguese investors would have been better served had they not believed in the efficiency of the Portuguese stock market during the last two decades. More specifically, the question to be examined is what if they had followed the two strategies advocated in this paper. As indicated earlier, the strategies advocated here are very simple, the first strategy is based on moving averages and the second strategy is a gold switching momentum strategy.

3 Data and methodology

For moving average strategy, we use Datastream’s daily data for the Portugal Stock Index (PSI-20) from 1/1/1999 to 1/31/2020. Since the use of 200 days moving average requires up to 200 days of past data, all estimations are made from 11/30/1999 to 1/31/2020 or 20 years and 2 months. We also use the Datasream’s quarterly data for PSI-20 and London Gold Bullion price for switching gold strategy. For the interest rate, we use the Datastream’s Euro overnight deposit middle rate from European Central Bank (ECB).

We estimate the daily PSI-20 return, Rt, in percentage terms using the continuously compounded formula:

$$ {\mathrm{R}}_{\mathrm{t}}=\ln\ \left({\mathrm{P}}_{\mathrm{t}/}\ {\mathrm{P}}_{\mathrm{t}-1}\right)\times 100. $$
(1)

A research by Mills and Coutts (1995), shows that the omission of dividends in daily return estimations does not affect the results, Draper and Paudyal (1997) also supported this conclusion. For the money market proxy, we use the ECB’s Euro overnight deposit rate. To estimate the daily proxy money market return, we follow Lucke’s (2002) method of dividing the annual rates by 260. Both the index price and interest rates are expressed in Euro. The first strategy followed here is a simple Moving Average (MA) trading rules that many practitioners use in equity and commodity trading companies. The MA method used in this paper is the same as Variable Moving Average (Variable Length MA) applied by many researchers, meaning that the time period between buy and sell could vary. We estimate the MA of N days as follow:

$$ \mathrm{MA}\ \left(\mathrm{N}\right)=\left({\mathrm{P}}_{\mathrm{N}}+{\mathrm{P}}_{\mathrm{N}-1}+\dots \dots \dots .{\mathrm{P}}_1\right)/\mathrm{N} $$
(2)

We estimate wo variants of MA trading rules as follow:

  1. 1.

    Price > MA(N) (N = 20, 50, 100, 150, and 200)

  2. 2.

    MA(Short) > MA(Long) (Short = MA20, MA50, Long = MA100, MA150, MA200)

In the case of the first variant, buy (sell) signals are emitted when the price index exceeds (is less than) the MA(N). Thus, a day is designed a “buy” when Pt > MA(N) and “sell” when Pt < MA(N). It should be noted that when the rule emits sell signals, a trader is out of the market, and he/she is not shorting the market. In the second variant of MA trading rule, buy (sell) signals are emitted when the short moving average exceeds (is less than) the long moving average. In order to perform various trading rules, following Metghalchi et al. (2015), we assume a trader can estimate the price that will trigger a buy or sell signal and initiate a conditional limit order just a few minutes before market close. For example assume a trader has adopted MA150 rule and the MA 150 of PSI-20 closed at 5000 level yesterday. The trader will have a conditional order to buy PSI-20 index at market close if the index closes above 5000 level. If at the close PSI-20 is greater than 5000, the trader’s order is filled and the next day is a buy day; if the trader’s order is not filled (PSI-20 closes below 5000), then the conditional order is not filled and the next day will be a sell day, meaning that the trader is out of the market. The same can also be applied for MA (short) > MA (long) variant. When estimating the index price that triggers buy/sell signal a few minutes before close of the market and initiate a conditional buy order eliminates the non-synchronicity bias. Initiating buy/sell order the next day at the open would not change our results and would also eliminate the non-synchronicity bias.

4 Empirical results

This study tests 5 trading rules of the first variant and 7 trading rules of the second variant. For each trading rule we define the mean buy and mean sell returns as follows:

$$ X(b)=\frac{1}{N_{\left(\mathrm{b}\right)}}\sum {R}_b $$
(3)
$$ X(s)=\frac{1}{N_{\left(\mathrm{s}\right)}}\sum {R}_s $$
(4)

Where, N(b) and N(s) are total number of buy and sell days and Rb and Rs are daily returns of buy and sell days for each model. We then test whether the mean return of buy days or sell days are different than the mean return of buy and hold (BH) strategy and whether the mean buy is different from the mean sell. The three null and alternative hypotheses are expressed as (Table 1):

Table 1 Test Hypotheses

Where μh, μb, and μs are the population mean of the BH, the mean of buy days and the mean sell days. Following Kwon and Kish (2002), the test statistics for the above three tests are:

$$ t=\frac{X_B-{X}_H}{\sqrt{VAR_B/{N}_B+{VAR}_H/N}} $$
(5)

Where XB and XH are the sample mean buy days and sell days, VARH is the sample variance of the B and H returns, and VARB is the variance of buy day returns. We also use Eq. 5 for hypothesis two and three by replacing the appropriate variables in the t-statistic formula. The summary statistics for the BH strategy for the entire period is as follow: for the entire period, the mean daily return of the BH strategy is −0.00014 or negative 0.014% per day for an annual arithmetic average of −3.62% (Sum of daily returns divided by 20.1667 years). The geometric average for the BH strategy is −3.55%. The geometric return is estimated from the index level of 10,887.99 on 12/1/1999 and the index level of 5252.03 on 1/31/2020. The daily standard deviation of return for the BH strategy is 0.0149 and the number of observations is 5263 days. The EMH advocates buying the index for the long run, therefore, Portuguese investors who followed EMH would have lost approximately 3.55% per year. Let’s now compare the EMH return with the returns of MA trading and Momentum Gold strategy.

4.1 Returns from MA strategy

Table 2 reports the results of 12 models trading rules based on MA. The results presented in Table 2 are very strong in favor of MA trading. Let’s interpret the first row of Table 2 corresponding to trading rule based on moving average 20; we will be in the market (buy days) if PSI-20 is greater than MA20 and out of the market (sell days) if PSI-20 is less than or equal to MA20. The mean return on buy days for this rule is .00051 (Or 0.051% per day). To test whether this mean is different than the mean of the buy and hold strategy, we use Eq. 5 and report the estimated t-statistic of 2.77. We compare all t-statistics with 1.96, the critical t-value at 5% level for large number of observations for a two-tailed test.

Since 2.77 is greater than the critical value of 1.96, the null hypothesis that the mean buy returns is equal to the mean of the buy and hold strategy is rejected. This implies that the mean buy is greater than the mean of the BH. The same conclusion of rejecting the null hypothesis can be reached for the mean of sell days since 2.29 is greater than 1.96. Looking at the t-statistic for the mean buy minus mean sell (4.25) we also conclude that the null hypothesis of the equality of the mean buy days and mean sell days is rejected. The results for all 12 trading rules are provided the same way in Table 2. The results presented in Table 2 are very strong in favor of technical trading rules; all buy-sell differences have significant t-statistics rejecting the null hypothesis of equality of buy days returns with sell days returns.

Table 2 Trading rules results

The standard deviation of buy and sell days are reported in columns 5 and 6. Comparing the standard deviation of buy days and sell days, indicates that the market is more volatile on the sell days than on the buy days. The number of buy days and sell days are presented in the last two columns. On average, for all 12 models we will be 51% of the time in the market and 49% of the time out of the market.

At this time, it cannot be said which trading rule is the best since we need to look at the numbers of in and out of the market and the resulting transaction costs; in addition we should look at the riskiness of each trading rule and compare it with the risk of the BH strategy. Another consideration is when a rule emits a sell signal, what would a trader do?

5 Trading strategies

The profitability of each trading rule depends on what can be done with available funds when the rule emits sell signals. Following Metghalchi et al. (2015) we use the following two strategies: (1) the trader will be in the stock market when trading rules emit buy signals and be in the money market when trading rules emit sell signals (long/money), (2) the trader will be in the stock market when trading rules emit buy signals and short the market when the rules emit sell signals (long/short). We estimate the daily return for each strategy and then subtract from it the daily return of the BH strategy to obtain the daily difference return (ddif).We test whether the mean difference return is less than zero; the null and alternative hypotheses are expressed as:

H0: ddif ≤0

HA: ddif >0

The t-statistic for the above test is:

$$ \mathrm{t}=\frac{X(ddif)}{\sqrt{Var(ddif)/N}} $$
(6)

Where X(ddif) is the average daily difference of returns of each strategy over the B&H strategy, Var(ddif) is the variance of daily difference returns, and N is the total number of days. Equation 6 is used to test whether the average daily difference is greater than zero, one-tail test, with critical t = 1.645 at 5% confidence level.

Table 3 reports the results of Long/Money strategy and Table 4 provides the results for Long/Short strategy for 12 trading rules. Let’s take the trading rule of P > MA20 in Table 3. The second column shows the average daily difference return of trading rule of P > 20 and the long/money strategy, a strategy when the rule emits buy signal, a trader is in the market and when the rule emits sell signal, the trader will be in the money market.

Table 3 Long and money market strategy
Table 4 Long and short market strategy

As shown in Table 3, the ddif of P > MA20 is positive with a significant t-statistic rejecting the null hypothesis that the mean ddif return is less than zero. Therefore, it could be concluded that this trading rule and strategy has higher average return than the BH strategy. The next column reports the risk of various trading rules for long/money strategy; this is estimated by the standard deviation of daily return of each trading rule and strategy. The risk of each rule must be compared with the risk of the BH strategy which is 0.1149 or 1.149%. We conclude that the risk of P > MA20 trading rule and long/money strategy (0.661) is less than the risk of BH strategy. Column 4 shows the average annual return of various trading rules and long/Money strategy. This is estimated by adding each daily excess return over the entire period and divide this sum by 20.1667 years. For P > MA20, the average annual return of 7.52% beats the average return of the BH strategy which is – 3.62%. Column 5 in Table 3 shows the Breakeven Cost (BEC), we follow Bessembinder and Chan’s (1998) methodology; for each trading rule and strategy, we add up excess returns over the BH strategy for the entire period and then divide this number by the total numbers of trades for long/money strategy. For P > MA20, the sum of all excess return over 5263 days were 224.49% and this rule and strategy implied 500 times in and out of the market, or 500 trades resulting to a BEC of 224.49/500 = 0.45%.This means if the actual one-way equity trading cost in Portugal is less than 0.45%, this rule and strategy will beat BH strategy even considering transaction costs. Domowitz et al.(2001) has estimated the total one-way cost (including both explicit and implicit) of equity trading in Portugal to be 0.62.7%. Thapa and Poshakwale (2010) have also estimated the equity transaction costs for Portugal, they also include both explicit and implicit costs such as commissions, fees, market impact, and bid-ask spread and find that the Portugal one-way equity trading cost is 0.34%. Finally, the last column of Table 3 reports the number of in and out of the market for each trading rule. For P > MA20, a trader will make 500 trades over the entire period of 21.1667 years.

Table 4 shows the results for 12 trading rules for the strategy long/short. If a rule emits buy signal, a trader will buy the index and when the rule emits sell signal, a trader will short the market. All estimations in Table 4 are similar to Table 3 except for BEC. The BEC cost for each rule and strategy in Table 4 is estimated as follow: we add up excess returns over the BH strategy for the entire period and then divide this number by twice the total numbers of trades. For long/money strategy we divided total excess return by total number of trade since parking money at money market rate does not require any transaction cost whereas shorting the index for long/short strategy requires transaction costs.

Looking at Tables 3 and 4 it is concluded that strategy long/money has lower risk than the BH strategy and strategy long/short has the same risk as to the BH strategy. This conclusion is intuitive since, for strategy 1, parking funds in the money market have less risk than being in the market and for strategy 2, its return distribution is like the return distribution of the BH strategy. The best trading rules are those with the highest BECs, resulting in the highest returns after considering transaction costs. Observations from Tables 3 and 4 indicate that the second variant of MA trading rules, or MA(Short) > MA (Long) are better than the first variant of MA rules. For strategy long/money, the best trading rules are: MA50 > MA200, MA20 > MA150, MA50 > MA150, and MA20 > MA200 with BECs of 5.66%, 4.82%, 4.64%, and 4.42% respectively. These BECs are very high implying excess net profits over the BH with lower risk than BH strategy. The best trading rules for strategy long/short are: MA50 > MA200, MA20 > MA150, MA50 > MA150, and MA20 > MA200 with BECs of 5.22%, 4.50%, 4.29%, and 4.07% respectively. These 4 trading rules beat the BH strategy even considering transaction costs and risk.

5.1 Robustness results

In order to analyze the robustness of our results, we divide the entire period into two sub-periods in equal length. Sub-period 1 is from 11/30/1999 to 1/1/2010 and sub-period 2 is from 1/2/2010 to 1/31/2020, thus, each sub-period is 10 years and 1 month. Tables 5 and 6 show the annual return, the BEC, risk, and the number of the trades of our four trading rules for long/money and long/short strategies for each sub-period. The risk (Standard Deviation) of the BH strategy in sub periods 1 and 2 are 1.106% and 1.189% respectively. The risk of each trading rule and strategy in each sub-period should be compared with the risk of the BH in that sub-period. The BECs are estimated by dividing total excess return over the BH strategy in each sub-period into the total number of trades in that sub-period. The average annual return of each trading rule should be compared with the average annual return of the BH strategy which are −2.50% in sub-period 1 and −4.73% in sub-period 2.

Table 5 Long and money market strategy for two sub-periods
Table 6 Long and short market strategy for two sub-periods

As shown in Tables 5 and 6, the results of sub-periods are also favorable to trading rules. For example, let’s take MA50 > MA200 rule; a trader following this rule and long/money strategy would have made an average annual return of 8.17% in sub-period 1 and − 1.36 in sub-period 2, whereas the average annual return of the BH hold strategy is −2.5% and − 4.73 in these two sub-periods. The same trading rule and Long/Short strategy that has the same risk as BH would have produced an annual average return of 16.57% in sub-period 1 and 2.09% in sub-period 2, much better than the BH strategy.

Table 7 summarizes the results of the previous tables for our 4 trading rules. This table compares the average annual return, risk, the number of trades and the average BEC for our 4 trading rules for strategy 1 and 2 for the entire period and each sub-period with the BH strategy. Strategy Long/Money has a much lower risk than the BH strategy and strategy long/short has a similar risk as to the BH strategy. Table 7 also shows that a trader has a risk-return trade-off, if a trader prefers lower risk than the BH, this trader can apply one of the four trading rules and long/money strategy and beat the BH for the entire period and each sub-period. If however, this trader prefers higher return, she can apply one of these 4 trading rules and long/short strategy with the same risk as BH and much higher return than the BH.

Table 7 Comparison of trading rules and buy and hold strategies

Let’s take the famous rule of MA50 > MA200 with long/short strategy and estimate net annual returns if the one-way transaction cost is 0.34% as estimated by Thapa et al. For the entire period a trader will have an average annual return of 9.33% and 25 trades (See Table 4). The average trade per year is 1.24 (25/20.1667), thus the commission will reduce the annual return by .42% resulting to a net annual return of 8.91%. For the sub-period 1, this rule will generate a net annual return of 18.42% (18.86 – (13/10.08) *0.34) in sub-period 1, and a net annual return of −1.70% in sub-period 2. In summary, the moving average trading rules work well for Portugal and these trading rules with long/short strategy beat the BH strategy by more than 10% per annum.

5.2 Gold switching momentum strategy

We follow Robert Tang’s (2019) gold momentum strategy for Portugal. Tang has proposed a yearly based Gold Momentum Strategy (GMS) for S&P500 as follow: If the S&P500 performs better than gold in each year, the next year invest in S&P500, if gold performs better, the next year invest in gold. Tang’s result was an impressive 19.68% annual return for his GMS over 1971 to 2018 period. Metghalchi (2020) modified Tang’s annual GMS to semi-annual GMS which is based on swithcing between the stock index and gold bullion every six month based on best performance of these two assest class. In the next section we apply Tang’s and Metghalchi’s GMS to PSI-20 and London Gold bullion price in Euro currency.

Table 8 reports the annual GMS for PSI-20 and Gold Bullion while Table 9 reports the result of semi-annual GMS. As shown in Table 8, the annual GMS does not perform well, it beats the return of the BH only by 1.5% per year. However, Table 9 indicates much better results than the BH strategy.

Table 8 Comparison of PSI-20 and Annual Gold Momentum Strategy
Table 9 Comparison of PSI-20 and Semi-annual Gold Momentum Strategy

The semi-annual strategy is as follow: If the PSI-20 index performs better than gold in each 6 months, the next six-month invest in PSI-20, if gold performs better, the next 6 months invest in gold. We estimate annual average and annual standard deviation from semi-annual numbers as follow:

$$ \mathrm{Annual}\ \mathrm{average}={\left(1+\mathrm{Semi}-\mathrm{Annual}\ \mathrm{Average}\right)}^2\hbox{--} 1 $$
$$ \mathrm{Annual}\ \mathrm{Standard}\ \mathrm{Deviation}=\mathrm{Semi}-\mathrm{annual}\ \mathrm{standard}\ \mathrm{Deviation}\ast \mathrm{SQRT}\ (2) $$

6 Conclusion

Advocates of EMH recommend a strategy of buying the PSI-20 index for the long run. In this paper, we compare two other strategies based on moving average and gold switching methods. In moving average strategy, we recommend using MA (Short) > MA (Long) trading rules. Specifically, the famous MA50 > MA200 trading rule suggests being in the market if MA50 is greater than MA200, and short the market if MA50 is less than MA200. The average annual return of this rule beats the BH return on average 10% per year with the same risk as the BH strategy. Our second strategy, semi-annual gold momentum strategy has also produced an annual average return of 9.74% per year compared to the BH return of −1.84 (based on semi-annual average) with less risk than the BH strategy. EMH implication was ruinous for the Portuguese investors over the past two decades.