{'fraction_non_alphanumeric': 0.025547445255474453, 'fraction_numerical': 0.013361375726834096, 'mean_word_length': 4.6746226746226744, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Moving Average Convergence-Divergence (MACD) Trading Rule: An Application in Nepalese Stock Market (NEPSE)

There are two types of analysis done for a stock market. One is fundamental analysis, where an investor looks at an intrinsic value of the stock, and another is technical analysis, where investors determine the future trend of the market looking at the current pattern or trend of the market. This paper is focused on one of the technical analysis tools, i.e., Moving Average ConvergenceDivergence. It is a tool based on the three exponential moving average (9-12-26 EMA Rule). The MACD analysis, with the help of a single line, was helpful to find out the exact bullish and the bearish trend of the NEPSE. A signal line is a benchmark to determine the stock market moving either to a bullish or bearish trend. It can help an investor, where the market is going in a direction. A market convergence, divergence, and crossover were better identified with the help of the MACD histogram. The paper found that the NEPSE return was stable for a very minimal period from 1998-99 to 2019-20. The shift from the bullish to bearish or vice-verse were seen easily identified with the help of a MACD histogram. Finally, a better-combined knowledge of moving average and candlestick chart analysis will help an investor, to put a clear picture of a market trend with the help of MACD analysis.


Introduction *
Investors and traders typically employ two classes of tools to decide what stocks to buy and sell; fundamental and technical analysis, both of which aim at analyzing and predicting shifts in supply and demand. While fundamental analysis involves the study of company fundamentals such as revenues and expenses, market position, annual growth rates, and so on, technical analysis is solely concerned with price and volume data, particularly price patterns and volume spikes. The underlying assumption in technical analysis is that stock prices evolve with a certain regularity, forming reliable and predictable price and volume patterns that reveal market psychology which can be used to determine shifts in supply and demand (Turner, 2007).
Technical analysis has been a major tool for investors in analyzing and forecasting the stock market. In contrast to the practitioners, many academicians are skeptical about technical analysis. Rather, they tend to believe that markets are informationally efficient, and hence all available information is impounded in current prices (Fama, 1970).
In rejecting Random Walk Hypothesis for weekly US stock indexes, Mackinlay (1988, 1999) had shown that past prices may be used to forecast future returns to some degree, a fact that all technical analysts take for granted. The study shows that moving average and Moving Average Convergence-Divergence (MACD) can be useful and rewarding in generating a better return from the stock market as well (Vasiliou, Eriotis, and Papathanasiou, 2004).
The concept of the MACD was developed by Gerald H. Appel (1979). It is a measure of price momentum, meaning the strength and direction of a trend in a stock price. The MACD used in this way acts just like a moving average crossover rule. This strategy has the disadvantage that it"s lagging the price, meaning that the trend reversals are detected after they happen. Anghel (2015) stated that by evaluating the profitability of the MACD, an investor could indirectly evaluate the level of information incorporation into trading prices. If stock markets are weak-form efficient then the past profitability information of the MACD should be incorporated into current trading prices, thus a technical analyst would find it impossible to use this indicator to make abnormal profits. Even more so, profitability should constantly decline over time.
The concept of MACD is linked with the concept of the exponential moving average (EMA), which was also developed by Appeel (1979). An EMA is used in the MACD, where it is composed of two lines. The first line is the difference between two exponential moving averages (usually the 26-12-period exponential moving averages). The second line of the MACD is generated by taking an exponential moving average (usually at 9 periods) of the difference between the two exponential moving averages used to make the first line. This second line is called the single line (Nison, 1991). This paper deals with the MACD analysis of the Nepalese stock market and helps investors to make a better interpretation of the buying and selling of stocks. Eric, Andjelic, and Redzepagic (2009) tried to find out the prediction of stock prices at Belgrade Stock Exchange Inc. for the period from 2004 to 2008. They found that the application of the MACD in upward trends provides better results with a faster combination of moving averages. They concluded that trading based on signals of the MACD indicators at downward trend yields with smaller losses in the case of use of longer moving averages of the MACD. At the lateral trend of stocks market price movement, trading based on the MACD indicators" signal largely depends on volatility in the period under observation. In the case of small price volatility, the MACD signals are not much useful, while in the reverse case significant profits may be achieved even if the price remains at the same level as at the beginning of the period under observation. Pandya (2013) selected the daily stock prices of the five information technology (IT) sectors for two years, listed at the Bombay Stock Exchange and National Stock Exchange. They tested the share prices in the seven technical analysis tools in the papers. In context to the MACD, they found that one out of four sample companies showing a bearish trend in the future. He suggested holding or sell as the MACD was almost parallel to the zero lines and for the remaining three companies he recommended holding or buy as the MACD crossed zero lines. Pradipbhai (2013) tried to find out whether a simple moving average (SMA) based MACD or an exponential moving average (EMA) based MACD generates better profit for an investor. He tried to find out which of the moving averages would bring out the better buy or sell signal to an investor. He concluded that the EMA based MACD brought a higher return and trustable signals to an investor. Rosillo, Fuente, and Brugos (2013) to examined the result of the application of the indicators Relative Strength Index (RSI), Moving Average Convergence Divergence (MACD), Momentum, and Stochastic in different companies of the Spanish continuous market. By using these indicators, it is intended to give purchase and sale recommendations to small investors. The generation of great capital gains depends on the type of stock exchange and the indicator which is being used. Besides, this research solves the problems in case of ambiguity, in the indicators, for the traders. Chong, Ng, and Liew (2014) found that MACD with other technical analysis tools could generate an excess return from the Milan Comit General and the S&P/TSX Composite Index. They tested the returns for the total five leading stock markets of the world, namely, DAX 30, DJIA, Nikkei 225 with above mentioned two indices. The buy and sell signals for the Milan Comit General and the S&P/TSX Composite Index from the MACD were seen as highly significant. Anghel (2015) applied the concept of MACD on daily share prices of 1336 companies of 75 countries from 2001 to 2012. He applied a bootstrap based analysis to validate his estimators. He concluded that the efficient market hypothesis (EMH) could not be rejected at a general level for the world stock markets using the MACD as a trading rule. Mahajan (2015) tested and applicability of MACD and Relative Sensitive Index (RSI) for profitable return from the National Stock Exchange of India. They concluded that optimized MACD and PSI indicators are more profitable than buy-hold strategy and standard MACD and RSI. Halilbegovic (2016) investigated the validity of MACD as the "magic wand" when solely used for investment trading decision making. The paper found that it is not possible to generate a consistent, considerable, and sustainable profit using MACD in an investment decision process. Ahmar (2017) tested the reliability of the MACD as a technical analysis tool. He also developed his technical analysis tool in his paper naming "Sutte Indicator" using the closing price, the lowest price, and the highest price of the stock for a day. He concluded from the Mean Absolute Percentage Error (MAPE) result that his "Sutte Indicator" performed better than MACD and Simple Moving Average (SMA). Inumula (2017) found that an application of standard MACD and RSI indicators contribute to earning an extra income then the buy and hold strategy is statistically rejected at a 5 percent level of significance means that the buy and hold strategy is more profitable than the standard MACD and standard RSI indicators. He tested the six sectors of stock prices in the Indian stock markets and concluded that better profit optimization by an investor could be brought out by using the MACD technique. Wang and Kim (2018) in their paper modified the way of using the exponential moving average (EMA) while calculating MACD. They used the changing weight based on the historical volatility in the stock price. They combined the historical volatility index with the MACD and developed a new measure, MACD-HVIX. They compared the accuracy between a MACD histogram and a MACD-HVIX histogram and found that the accuracy of using the MACD-HVIX histogram is 55.55 percent higher than that of the MACD histogram when used the buy-andsell strategy. When used the buy-and-hold strategy for 5 and 10 days, the prediction accuracy of MACD-HVIX was 33.33 percent and 12 percent higher than that of the traditional MACD strategy, respectively. They found that the new indicator was more stable.

Methodology
The main objective of the paper is to find out an application of Moving Average Convergence Divergence (MACD) in the Nepalese stock market. For this purpose, the paper has used the daily closing index (NEPSE Index) of Nepal Stock Exchange Limited, from the fiscal year 1998-99 to the fiscal year 2019-20, covering 4,875 trading days.
The paper has followed the formula developed by Gerald H. Appel (1979) to calculate the value of MACD. The formula is as follow: where, EMA= Exponential Moving Average for period "n" n= Number of days which is 12 days and 26 days MACD generates two kinds of signals. They are:  Signal Line Crossovers: a bullish crossover occurs when MACD turns up and crosses above the signal line. A bearish crossover occurs when MACD turns down and crosses below the signal line.  Center Line Crossovers: a bullish centerline crossover occurs when MACD moves above the zero lines to turn positive. At this time a BUY signal is generated. A bearish centerline crossover occurs when MACD moves below the zero lines to turn negative. At this time, a SELL signal is generated.
Similarly, the signal line = 9 days exponential average of MACD line (2) while the "signal" line is derived as a 9 day exponential average of the MACD line. This 12/26/9 is a standard and at the same time "original recipe" combination of periods, some technicians decide to modify this original combination and make their customized combinations.
A "signal-line crossover" occurs when the MACD and average lines cross; that is when the divergence (the bar graph) changes sign. The standard interpretation of such an event is a recommendation to buy if the MACD line crosses up through the average line (a "bullish" crossover), or to sell if it crosses down through the average line (a "bearish" crossover). The signal strength (from weakest to strongest, respectively) depends on the position where the crossover happens. The deeper below the zero lines the crossover happens, the stronger the buy signal it is. (Halilbegovic, 2016).
The MACD histogram was developed by Thomas Aspray in 1986. The histogram or, "bar chart" included in the background of the MACD displays the difference between the MACD and the signal line. The interpretation is based on the zero-line or the signal line. When the MACD is above the signal line, the bar is positive. When the MACD is below the signal line, the bar is negative. The actual height of the bar is the difference between the MACD and the signal line itself. Mathematically, it is defined as: MACD Histogram= MACD Line -Signal Line

Interpretation of the MACD and the Signal Line for NEPSE Index
The figure 1 shows the relation of the MACD and the Signal Line for the NEPSE daily index. Figure 1 clearly shows the bullish trend and the bearish trend for the NEPSE Daily Index. The figure above shows the majority of the time, the return from the daily trading at NEPSE shows the bearish trend (3279 days) with the indicator below the signal line.
This shows that only 34.74 percent of the trading days during the sample period saw the bullish trend at NEPSE, and the remaining days were seen following the bearish trend. Similarly, 265 days had shown the MACD is parallel to a signal line, and a crossover took place. During the crossover, the bullish trend of the market turned in to the bearish and vice-versa. This shows that only 5.44 percent of the trading days during the study period had shown the trend signal by the signal line as per MACD analysis.

Interpretation of the MACD Histogram for NEPSE Index
The figure 2 shows the MACD Histogram for the NEPSE daily index. MACD histogram appears in the chart. The MACD histogram is also designed to identify the convergence, divergence, and crossover. However, the MACD histogram is a difference between the MACD line and the signal line. When MACD is above the signal line, the MACD histogram also is also seen above the signal line. The indicator is negative when MACD is below its signal line. Negative values increase as MACD diverges further from its signal line (to the downside). Conversely, negative values decrease as MACD converges on its signal line. The slant divergence in the histogram shows the quick change is the trend of the NEPSE. The signal line is also a zero-line. The histogram above the signal line shows the uptrend of the market and vice-versa.

Conclusion and Implications
A moving average convergence-divergence (MACD) is a concept based on a combination of three exponentially smoothed moving averages. The concept of convergence and divergence is seen in technical analysis when a technical analysis tool could not estimate an accurate direction of the market movement. The help of MACD with a candlestick chart or the MACD histogram helps to clarify the trend of the market.
In a simple word, a concept of MACD is standing on the three smoothing EMA. The picture of the market is brought out using 12-EMA, 26-EMA, and 9-EMA. A 9-EMA works as a single line in an interpretation of MACD. Similarly, a MACD histogram better brings out the picture of the market movement. The height of the MACD histogram helps an investor to determine the convergence, divergence, and crossover points in the stock market. Similarly, the oversold or overbought signal could also be determined with the help of the MACD histogram.
In context to NEPSE also, the result from the MACD, MACD signal line, and MACD histogram could be helpful for an investor who has a basic knowledge of moving average. The MACD analysis of daily returns from the NEPSE for about two decades revealed that a high level of market fluctuations was seen in the year 2019-20. The volatility was seen to increase when the benchmark index crossed the mark of 1200.
At the same time, the MACD analysis reflected a more bearish trend than the bullish trends in the NEPSE during the last two decades. About five percent of the trading days were seen as a stable during the period. This shows that NEPSE is a highly unstable and volatile market for investment. Finally, a high level of devotion in a concept of different kinds of technical analysis tools mainly, moving average and candlestick charting would only help an investor to bring better results from a MACD analysis.