IJTech - EECE 4445 - Generating A MultiTimeframe Trading Strategy Based
IJTech - EECE 4445 - Generating A MultiTimeframe Trading Strategy Based
http://ijtech.eng.ui.ac.id
Abstract. This study combines a fundamental analysis of the rationale for conservative investors’
transactions, as well as long-term, low-risk strategies, and a technical analysis of the search for entry
points into short-term, high-risk speculation. A hypothesis about the possible adaptation of high-
risk foreign-exchange-market strategies to a low-risk stock market, based on a multi-timeframe
analysis of the intersection of 3 EMA plus stochastic (a combination of three moving averages and a
stochastic oscillator), is proven. The study’s modeling is based on walk-forward, blind simulation,
cross procedure for realistically testing a hypothesis that can be performed in nine steps (Colby,
2003.) Colby’s algorithm Its subject is ordinary shares of Sberbank of Russia, and its analysis shows
an absence of uncharacteristic movements in the chosen period of maximum volatility, from 2007
to the present. This analysis was conducted for two timeframes (more than five years for the trend
direction and less than three years for the entry point). For the EMA, parameters were set at 20, 50,
and 200; for stochastic parameters were set at 14, 3, and 3, 80/20. The “failure swing” reversal
pattern and new support and resistance lines were detected. The study’s main conclusions are that
the simultaneous use of three EMAs makes determining a corridor or a trend fairly reliable, as well
as setting stop-losses. Moreover, the use of an oscillator is found not to always be reasonable; its
main task is to confirm a signal. A stochastic oscillator with an explicit trend should not be analyzed
for the whole period under consideration—only the last values should be considered. Moving
averages and oscillators give fewer false signals on medium-term timeframes than on short-term
timeframes. Due to a change in trend direction, identifying new (defined and correct) support and
resistance lines is found to be necessary.
1. Introduction
Digital technologies’ role in the modern circular economy is becoming more and more
important (Berawi, 2020). Studies have shown a link between basic human values and risk
perceptions, between risk perceptions and risk behavior, and between risk behavior and
accidents (Sutalaksana, 2019). Therefore, an important task is to minimize the emotional
component of production processes and, in particular, to algorithmize the search for the
right trading strategies.
The development of forecast price models is one of the most active application
Areas (Plotnikova, 2018) .Basic models have similar objectives, based on minimizing
overall costs and increasing the efficiency of available resources (Balashova and Gromova,
2017).
The aim of the current work is to create a new trading strategy for the stock market,
based on well-known technical indicators. The foreign exchange market is volatile; only
professional traders can accept high risks, and their strategies aim to clearly define entry
and exit points. To generate this study’s strategy, the authors took a simple forex strategy
as a basis and adapted it to the stock market for conservative investors. Our working
hypothesis is that the trading strategy for a low-risk stock market can be improved by
adapting high-risk forex strategies.
Multi-frame analysis is an assessment of a given situation from different timeframes—
a skill that many market participants lack. (Singh, 2000) And this lack is significantly
problematic because many investors do not consider emerging graphical patterns in global
trends or the impact these patterns can have on market participants’ trading decisions in
other timeframes. Thus, our explanatory hypothesis is that adapting strategies is possible on
the basis of multi-timeframe analysis, in which a longer timeframe determines a trend’s
direction and a shorter timeframe determines an optimal entry point.
2. Literature Review
The theory of forecasting price trends is based on publications by Dow, the author of
the oldest market index. Most of Dow’s theories were formulated by Hamilton (1922) and
practically developed by Rhea (1932). Wave patterns were suggested and mathematically
justified by Elliott (1938). This theory gained power in the 1980s, thanks to Prechter and
Frost (1991).
Gann (1941) offered a fundamentally different approach to financial market
forecasting, based on geometry, numerology, and ancient mathematics, astronomy, and
astrology (Mitaeva). Two more works—by Clement (1908) and McWhirter (1938)—are
considered important in this area, too, but the authors are probably aliases of Gann himself.
No unified version of Gann’s trading system exists, and modern researchers are trying to
systematize several of his works (Mikula, 1995).
Technical analysis, as a science of studying market dynamics via charts to predict price
movements’ future direction, was initiated by Murphy (1986). However, perhaps the first
textbook on technical analysis based on price candlesticks is a Japanese book of 1755 by
Honma, The Three Monkey Record of Money (Gusev, 2015), but Japanese candlesticks have
become very popular, thanks to the work of Nison (1994). Yet, the “tic-tac-toe” method of
keeping price charts and its corresponding forecasting principles were established by
Villiers (1933).
Our model is based on Williams’ trading paradigm of waiting for the beginning of a
strong stable trend and then, after a suitable trend is detected, searching for entry and exit
points (Williams, 1979). Our basic strategy—3 EMA plus stochastic (a combination of three
moving averages and a stochastic oscillator) is not very popular, but it is often used on the
forex market for short timeframes (Forex Strategies, 2014).
Moving averages are one of the oldest and most widely used tools for technical analysis
(Achelis, 1995). Stochastic optimization is a scientific methodology for maintaining a
system’s operation in security and safety. This calculation provides an important indicator
with which to analyze risks in a system under operational conditions (Bouayoune, 2017).
This trading analysis methodology was first described in 1957 (Schade, 2005). Lane
contributed significantly to the stochastic oscillator’s recognition and popularity as a
technical indicator (Lane, 1985).
Nickolaevich et al. 1235
Due to the “mathematization” of finance, more and more complex models are
developed to better approximate price movements, using historical data and including
economic indicators as factors (Skhvediani and Kudryavtseva, 2018). A direction of
robotizing trading, based on the blockchain, seeks to exclude the “human being” and human
factor from the decision-making system (Babkin et al., 2018). Different methods of
formalizing information flows have been proposed as optimal strategies (Kalmykova et al.,
2017). Innovative financial online platforms have also been developed (Bataev, 2018). A
separate area is analyzing the cryptocurrency market (Arutunyan et al., 2018).
A growing literature is examining and generating trading strategies. In the field of research,
authors creating strategies use rules from the popular technical indicators slope,
exponential moving average (MA), moving average convergence divergence, relative
strength index, stochastic oscillator, and directional index (Faijareon and Sornil, 2019).
Huang and Huang (2020) proposed a quasi-intraday version of the standard MA strategy,
QUIMA. Naik and Mohan (2019) considered 33 different combinations of technical
indicators to predict stock prices, finding a way to select the relevant technical indicators
accurately and creating a prediction model for stocks.
3. Methods
Future market behavior will largely repeat the patterns of the past (Kuporov et al.,
2018). Calculating a time series’ future values, based on these values’ functional
dependence on the already-specified time values, is necessary.
Our modeling is based on Colby’s algorithm: (1) hypothesis development; (2) data
collection; (3) data verification for uncharacteristic movements; (4) data segmentation into
time intervals; (5) indicator parameter search; (6) indicator testing; (7) expansion of a
reliable segment; (8) multiple repetitions of stages 5, 6, and 7 to completely remove invalid
data; and (9) evaluating results (Colby, 2003). We selected the TradingView platform for
this study (TradingView).
Indicators for creating our model. The key financial-market factors are the price of an
asset and the volume of its trading or open interest. Let us assume as a basis that the
proposed strategy should consider both of these factors.
The first factor is trend indicators that measure a trend’s direction and strength by
comparing prices with a set baseline. They will help determine support and resistance
levels, find patterns, and predict trend reversals. We chose exponential moving averages
(EMAs). Current price data affect a moving average exponentially more than SMAs, where
the same weight is assigned to all values. For more details about exponential smoothing in
economic forecasting, see the work of Lyukevich (2018)
The second factor is volume indicators that estimate oversold or overbought assets,
oscillators. The signal, in this case, is the change in a price growth rate under an existing
trend. The stochastic oscillator is the most important oscillator (Lebeau and Lucas, 1992).
4. Results
To succeed in the financial market, each participant—based on their risk appetite
and available time—determines a trading strategy appropriate for them. Personal
identity is taken into account; for one investor, a strategy can work very well, but for
another, the same strategy can be absolutely unacceptable (Lebedev et al., 2018).
Choice of strategy. We suggest a multi-timeframe strategy of crossing three EMAs
plus a stochastic oscillator. The simultaneous crossing of three EMAs can be used as a
separate strategy that allows for a filtering-out of considerable market noise, but—as
1236 Generating a Multi-Timeframe Trading Strategy based on
Three Exponential Moving Averages and a Stochastic Oscillator
with standard, slightly lagging trend indicators—it comes with the cost of having to
slightly miss the beginning of a trend. For this reason, the strategy of crossing three
exponentially moving averages in combination with an anticipatory instrument, which
is a stochastic oscillator in this case, provides good results (Figure 1).
We open long positions when two EMAs with shorter periods cross the EMA with the
largest period from bottom to top. We exit the position when a slow stochastic line crosses
the set overbought level from top to bottom. Additional signals for exiting are a candlestick
closing below or above the EMA with the largest period.
Data collection. To test a trading strategy, step-by-step modeling of the strategy is
necessary, based on historical data. We chose the ordinary shares of Sberbank of Russia as
the subject of our strategy modeling. The bank’s share price tends to grow globally. This
tendency leads to increased demand for these securities (Figure 2). The price changed by
1,000 times, while the number of shares among shareholders increased by 1,000 times,
correspondingly. This split took place just before the world financial crisis in 2008 (Figure
3).
Figure 2 Share price before the 2007 split Figure 3 Share price changes after the 2007
split
Figure 4 Dynamics of ordinary Sberbank share prices for the 2007–20 period
Nickolaevich et al. 1237
charts (period: 14; moving average: 3; and smoothing: 3 [14, 3, 3]). Overbought and
oversold levels are in the ratio of 80/20.
Indicator testing. The share price tended to grow in 2015–2020 period (Figure 4).
The historical maximum was reached in February 2018, and it is the absolute resistance
level at the moment (marked with an orange dotted line in Figure 5). From 2017 to 2020,
the “failure swing” reversal pattern (marked by a rectangular area), with peaks going
down (lines 1 and 2 in Figure 5), was clearly lined up. The fact that the trend’s strength
had weakened is also evidenced by an increase in the volume of transactions in the fall,
after reaching highs (marked by the orange circles in Figure 5). This fact should be
considered in order to analyze a shorter time interval.
Several factors became growth drivers for the share price: favorable market
conditions for the industry, a strong position for the issuer within the industry, a high oil
price that ensured an inflow of cash into the banking sector, the reliability of capital
investment due to the issuer’s high rating, and the new dividend policy (a strategy for
2017–20), which attracted long-term investors, growing profits.
Expansion of the reliable segment. Today, the shares tend to descend (Figure 5). The
price has broken through its support line (Line 1 in Figure 5), which had existed since
2015 and was very significant. In addition, as a result of breaking this line, a price gap
formed from 228 to 197 rubles (March 2020), which signaled new lows and was also
confirmed by an increase in the volume of transactions during this period—that is, most
market participants supported the new local downtrend. At the moment, the price has
formed a new support line (Line 2 in Figure 5) and a local resistance line (Line 3 in Figure
5).
Exponential moving averages with a short period (EMA 20, the orange line; EMA 50,
the blue line; Figure 5) crossed the moving average with the largest period (EMA 100,
the green line; Figure 5) from top to bottom, which was a “sell” signal. This crossing
happened before the local gap formed and prices fell. Here, the signal included all three
EMAs’ being under the price chart. The trend indicator confirms that the trend is weak.
The stochastic oscillator should not be analyzed for the entire period under
consideration if a clear trend is evident. In this context, considering only the last values
is necessary. In April 2020, the indicator was in the overbought zone (the red vertical
line in Figure 6) at 92, after which a fall in prices was observed. At the moment of this
analysis (May 2020), the stochastic oscillator is neutral at 52.
Multiple repetition. On the basis of our analysis, we can predict two options for the
outcome of events for this share.
Nickolaevich et al. 1239
First, given the high probability of a global trend reversal, the price will continue to
break through its support levels and strive for its most significant level, which formed in
2009. Thus, the worst projected asset price will be at the 80–90 ruble level. The
confirmation that this option is more likely is the stochastic oscillator’s not having
reached the overbought zone’s boundary. In this case, the indicator shows relative
equality between supply and demand for the shares under analysis. In addition, all three
EMAs are located in an inherent position for a downtrend (the long EMA [200] at the top;
the short EMA [20] at the bottom) and have a strong slope.
Second, due to the weakness of the global upward trend, the share price will go into
a trading range limited by lines 2 and 3 for a period. Breaking through this range of 170–
210 rubles is possible if fundamental macroeconomic news has a positive connotation
for investors. From a technical point of view, the price may break this range from bottom
to top in order to “close the gap”—that is, attempting to trade the range with the upper
price level of 228 rubles is locally probable. After fixing the price at this level, we expect
the share price will be in the range of 230–240 rubles. In the longer term, we expect
market stagnation at best, and in the short-to-medium term, local highs are very likely—
which both the technical and fundamental points of view explain. As a negative factor,
any new outbreak is likely to occur as the economy opens up, which would again lead to
restrictions and market decline.
Evaluating results. Having analyzed the application of the multi-timeframe strategy
of crossing 3 EMA plus stochastic for highly liquid “blue chips” in the financial market of
a country with country risk classifications of “3,” provided that the shares are more in
trend areas, we find the following:
1. The use of an oscillator is not always reasonable; its main task is to confirm a signal.
2. The use of three EMAs allows to determine of whether they are trading in a corridor
or a trend, and it also provides an opportunity to set stop-losses without additional
calculations (under the longest EMA).
3. Having lined up in a trend line, MAs form a kind of support (resistance) line, marking
the end of a correction clearly enough. Thus, a market participant during correction
moments can predict which point a price will reach during a correction. A long MA
breakthrough provides a strong trend reversal signal.
4. Moving averages and oscillators provide fewer false signals on medium-term charts
than on short-term charts.
5. Due to the change in a trend’s direction, identifying new (determined and correct)
support and resistance lines is necessary.
1240 Generating a Multi-Timeframe Trading Strategy based on
Three Exponential Moving Averages and a Stochastic Oscillator
5. Conclusions
The stochastic oscillator is a leading indicator, and EMAs are lagging indicators. The
search for the optimal parameters for these indicators will allow a balance of the market
signals, which will increase the trading strategy’s effectiveness. We have found the
parameters that allow for an adaptation of high-risk forex market trading strategies to the
stock market. First, these parameters include two timeframes: the higher timeframe is five
years—for the trend direction—while the lower timeframe is three years—for the entry
point. Second, a combination of three EMAs (20, 50, and 200 daily) plus stochastic provides
a main (fast) line averaging over 14 and smoothing over three periods, as well as a signal (a
slow-moving average after a fast-moving average) line with a period averaging 3, with 80%
overbought and 20% oversold shares. Third, combining EMAs as a trend indicator with a
stochastic oscillator as a market speed indicator allows for the identification of patterns and
the determination of the optimal points to open and close positions.
The specific quantitative results are two probable forecasts that indicate specific price
levels at which to enter the market: (1) 80–90 rubles per share, and (2) 230–240 rubles per
share. At the moment (November 2020), the share price is 238 rubles per share, which
confirms our strategy’s reliability and potential for practical application.
Discussion. A strategy’s effectiveness can be assessed by its ratio of true and false
signals, compared with other strategies for similar timeframes. The fewer false signals, the
more effective the strategy. The continuation of the study in testing the strategy with other
indicator parameters to find the best combination.
The resulting forecast model is designed for a wide range of people; it is
comprehensible and easy to use. This approach is how a trading algorithm can be generated
and programmed for automated trading systems (per MetaTrader, InteractiveBrokers, and
others) and developing a robo-advisor.
Acknowledgements
This research was supported by the Academic Excellence Project 5-100, proposed by
Peter the Great St. Petersburg Polytechnic University.
References
Achelis, S.B., 1995. Technical Analysis from A to Z: Every Trading Tool…from the Absolute
Breadth Index to the Zig Zag. New York: McGraw-Hill Book Company
Arutunyan, M., Skhvediani, A., Kudryavtseva, T., Novikov, S., 2018. ARIMA Model for
Describing Dynamics of Bitcoin Cryptocurrency. In: Proceedings of the 32nd
International Business Information Management Association Conference 2018
Babkin, A.V., Burkaltseva, D.D., Betskov, A.V., Kilyaskhanov, H.S., Tyulin, A.S., Kurianova, I.V.,
2018. Automation Digitalization Blockchain: Trends and Implementation Problems.
International Journal of Engineering and Technology, Volume 7(3), pp. 254–260
Balashova, E.S., Gromova, E.A., 2017. Russian Experience of Integrating Modern
Management Models. Espacios, Volume 38(53), pp. 31–39
Bataev, A.V., 2018. Innovative Forms of Interaction between Financial Institutions and
Clients: Automated Banking Offices. In: Proceedings of the 3rd International Conference
Ergo-2018: Human Factors in Complex Technical Systems and Environments, Ergo, pp.
9–13
Berawi, M.A., 2020. Managing Nature 5.0: The Role of Digital Technologies in the Circular
Economy. International Journal of Technology, Volume 11(4), pp. 652–655
Nickolaevich et al. 1241
Bouayoune, K.S., Boudi, E.M., Bachir, A., 2017. A Stochastic Method based on the Markov
Model of Unit Jump for Analyzing Crack Jump in a Material. International Journal of
Technology, Volume 8(4), pp. 622–633
Clement, L., 1908. The Ancient Science of Numbers. New York: Roger Brothers
Colby, R.W., 2003. The Encyclopedia of Technical Market Indicators. 2nd ed. McGraw-Hill
Publishing
Elliott, R.N., 1938. The Wave Principle. Alanpuri Trading, Los Angeles, CA, 2013 (originally
published by R.N. Elliot, New York, NY)
Faijareon, C., Sornil, O., 2019. Evolving and Combining Technical Indicators to Generate
Trading Strategies. Journal of Physics, Conference Series 1195, pp. 16–32
Forex Strategies, 2014. Stochastic Scalping with Three Moving Averages. Available Online at
https://www.forexstrategiesresources.com/scalping-forex-strategies-ii/281-
stochastic-scalping-with-three-moving-averages
Gann, W.D., 1941. How to Make Profits Trading in Commodities: AA Study of the Commodity
Market. Lambert-Gann, Pomeroy, WA
Gusev, V.P., 2015. Japanese Candles. Application Features. [s. l.] Moscow
Hamilton, W.P., 1922. The Stock Market Barometer: A Study of Its Forecast Value Based on
Charles H. Dow’s Theory of the Price Movement: With an Analysis of the Market and Its
History Since 1897. New York: Harper & Bros
Huang, J.-Z., Huang, Z., 2020. Testing Moving Average Trading Strategies on ETFs. Journal of
Empirical Finance, Volume 57, pp. 16–32
Kalmykova, S.V., Pustylnik, P.N., Razinkina, E.M., 2017. Role Scientometric Researches’
Results in Management of Forming the Educational Trajectories in the Electronic
Educational Environment. Advances in Intelligent Systems and Computing, Issue 545,
pp. 427–432
Kuporov, J.J., Kudryavtseva, T.J., Gorovoy, A.A., 2018. Algorithm for Formation of the
Investment Project Portfolio of a Public Utility Company. Proceedings of the 31st
International Business Information Management Association Conference, 2018
Lane, G.C., 1985. Lane’s Stochastics: The Ultimate Oscillator. CMT Association Journal
(Journal of Technical Analysis), Issue 21, pp. 37–42
Lebeau, C, Lucas, D.W., 1992. Technical Traders Guide to Computer Analysis of the Futures
Markets. McGraw-Hill Education
Lebedev, O.T., Mokeeva, T.V., Rodionov, D.G., 2018. Matrix Structures of Science and
Technology Innovations Development and Implementation Trajectory. In: Proceedings
of the 31st International Business Information Management Association Conference
Lyukevich, I., Agranov, A., Kulagina, N., 2018. Issues of Exponential Smoothing in
Economical Forecasting. In: Proceedings of the 32nd International Business Information
Management Association Conference, 2018
McWhirter, L., 1938. Astrology and Stock Market Forecasting. New York: ASI Publishers Inc
(Second ed., 1977)
Mikula, P., 1995. Gann’s Scientific Methods Unveiled. Volume 1 and Volume 2. P. Mikula Pub.
and Trading, Austin, USA.
Mitaeva, O., (n/d) Technical Analysis: The Mysterious Methods of William Delbert Gunn.
Available online at Educational Site for Investors and Traders. https://i-
trading.ru/poleznoe/izvestnye-trejdery/vilyam-delbert-gann
Murphy, J.J., 1986. Technical Analysis of the Futures Markets: A Comprehensive Guide to
Trading Methods and Applications. New York Institute of Finance
Naik, N., Mohan, B.R., 2019. Optimal Feature Selection of Technical Indicator and Stock
Prediction using Machine Learning Technique. In: Emerging Technologies in Computer
1242 Generating a Multi-Timeframe Trading Strategy based on
Three Exponential Moving Averages and a Stochastic Oscillator
Engineering: Microservices in Big Data Analytics. ICETCE 2019., Volume 985, pp. 261–
268, Singapore: Springer
Nison, S., 1994. Beyond Candlesticks: New Japanese Charting Techniques Revealed. John
Wiley & Sons
Plotnikova, E.V., 2018. Investigating the Influence of Gender and Age on the Choice of
Housing. In: Proceedings of the 31st International Business Information Management
Association Conference, 2018
Prechter, R.R. Jr., Frost, A.J., 1991. Elliott Wave Principle: Key to Stock Market. New York:
McGraw Hill Publishing Co.
Rhea, R., 1932. The Dow Theory: An Explanation of Its Development and an Attempt to Define
Its Usefulness as an Aid in Speculation. New York: Barron’s
Rudskaya, I.A., Rodionov, D.G., 2018. Comprehensive Evaluation of Russian Regional
Innovation System Performance using a Two-Stage Econometric Model. Espacios,
Volume 39(4), pp. 40–52
Russell, R., 1961. The Dow Theory Today. New York: Richard Russell Associates, New York
Schade, G., 2005. The Origins of the Stochastic Oscillator. The Chartered Market Technician
(CMT) Association. Available Online at https://cmtassociation.org/kb/origins-of-the-
stochastic-oscillator-article
Singh, S.P., 2000. Modelling in Time-Series Forecasting. Cybernetics and Systems—An
International Journal, Volume 31(1), pp. 49–65
Skhvediani, A.E., Kudryavtseva, T.Y., 2018. The Socioeconomic Development of Russia:
Some Historical Aspects. European Research Studies Journal, Volume 21(4), pp. 195–
207
Snezhko, Y.S., 2015. The Use of Technical Analysis Indicators in the Russian Stock Market.
Russian Journal of Entrepreneurship, Volume 16(16), pp. 2681–2696
Sutalaksana, I.Z., Zakiyah, S.Z.Z., Widyanti, A., 2019. Linking Basic Human Values, Risk
Perception, Risk Behavior and Accident Rates: The Road to Occupational
Safety. International Journal of Technology, Volume 10(5), pp. 918–929
TradingView. (n/d) Free Stock Charts, Stock Quotes and Trade Ideas. Available Online at
https://www.tradingview.com
Villiers, V.d., 1933. The Point and Figure Method of Anticipating Stock Prices: Complete
Theory & Practice, Windsor Books, Brightwaters, New York: reprinted in 1975
Williams, L.R., 1979. How I Made One Million Dollars Last Year Trading Commodities.
Windsor Books