Profitability Edge by Dynamic Back Testing Optimal Period Selection for Technical Parameters Optimization, in Trading Systems with Forecasting

The d-BackTest PS method

Abstract

Back testing process is widely used today in forecasting experiments tests. This method is to calculate the profitability of a trading system, applied to specific past period. The data which are used, correspond to that specific past period and are called “historical data” or “training data”. There is a plethora of trading systems, which include technical indicators, trend following indicators, oscillators, control indicators of price level, etc. It is common nowadays for calculations of technical indicator values to be used along with the prices of securities or shares, as training data in fuzzy, hybrid and support vector machine/regression (SVM/SVR) systems. Whether the data are used in fuzzy systems, or for SVM and SVR systems training, the historical data period selection on most occasions is devoid of validation (In this research we designate historical data as training data). We substantiate that such an expert trading system, has a profitability edge—with regard to future transactions—over currently applied trading strategies that merely implement parameters’ optimization. Thus not profitable trading systems can be turned into profitable. To that end, first and foremost, an optimal historical data period must be determined, secondarily a parameters optimization computation must be completed and finally the right conditions of parameters must be applied for optimal parameters’ selection. In this new approach, we develop an integrated dynamic computation algorithm, called the “d-BackTest PS Method”, for selection of optimal historical data period, periodically. In addition, we test conditions of parameters and values via back-testing, using multi agent technology, integrated in an automated trading expert system based on Moving Average Convergence Divergence (MACD) technical indicator. This dynamic computation algorithm can be used in Technical indicators, Fuzzy, SVR and SVM and hybrid forecasting systems. The outcome crystalizes in an autonomous intelligent trading system.

This is a preview of subscription content, log in to check access.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Fig. 19
Fig. 20

Notes

  1. 1.

    Symbol is the security asset which the system trades. All the tests and the long/short positions are made on this security asset. For example, EURUSD is a symbol. All the tests and retesting verifications are made by trading EURUSD exchange rate. The EURUSD, NZDUSD, GBPUSD, JPYUSD, USDCAD, AUDUSD, XAUUSD, XAGUSD are the symbols used in this paper.

  2. 2.

    This month is the reference of each testing. Back testings are calculated based on the recent past of the reference month. The forecasting method that uses the returning results of back testings is applied to this reference month.

  3. 3.

    A comprehensive list of results can be sent via email by the corresponding author to anyone who is interested.

  4. 4.

    A comprehensive list of results can be sent via email by the corresponding author to anyone who is interested.

References

  1. Anbalagana, T., & Maheswarib, S. (2015). Classification and prediction of stock market index based on fuzzy metagraph. Procedia Computer Science, 47, 214–221.

    Article  Google Scholar 

  2. Appel, G. (1985). The moving average convergence-divergence trading method. Toronto: Traders Press.

    Google Scholar 

  3. Aspray, T. (1989). Individual stocks and MACD. Technical Analysis of Stocks & Commodities, 7(2), 56–61.

    Google Scholar 

  4. Cai, B., Cai, C., & Keasey, K. (2005). Market efficiency and returns to simple technical trading rules: Further evidence from U.S., U.K., Asian and Chinese stock markets. Asia-Pacific Financial Markets, 12, 45–60.

    Article  Google Scholar 

  5. Caporale, G., Gil-Alana, L., & Plastun, A. (2016). Searching for inefficiencies in exchange rate dynamics. Computational Economics, 1–28

  6. Cheng, J., Chen, H., & Lin, Y. (2009). A hybrid forecast marketing timing model based on probabilistic neural network, rough set and C4.5. Expert Systems with Applications, 37(2010), 1814–1820.

    Google Scholar 

  7. Chong, T. T. L., Ng, W. K., & Liew, V. K. S. (2014). Revisiting the performance of MACD and RSI oscillators. Journal of Financial Risk Management, 7, 1–12.

    Article  Google Scholar 

  8. Chourmouziadis, K., & Chatzoglou, P. (2015). An intelligent short term stock trading fuzzy system for assisting investors in portfolio management. Expert Systems with Applications, 43(2016), 298–311.

    Google Scholar 

  9. Deng, S., Yoshiyama, K., Mitsubuchi, T., & Sakurai, A. (2013). Hybrid method of multiple kernel learning and genetic algorithm for forecasting short-term foreign exchange rates. Computational Economics, 45, 49–89.

    Article  Google Scholar 

  10. Fama, E. F. (1970). Efficient capital market, a review of theory and empirical work. Journal of Finance, 25, 383–417.

    Article  Google Scholar 

  11. Fernandez, P., Bodas, D. J., Soltero, F. J., & Hidalgo, J. I. (2008). Technical market indicators optimization using evolutionary algorithms. In GECCO ’08 Proceedings of the 10th annual conference companion on Genetic and evolutionary computation (pp. 1851–1858).

  12. FOREX Market. (2016) Retrieved February 28, 2016 from https://en.wikipedia.org/wiki/Foreign_exchange_market.

  13. Gorgulho, A., Neves, R., & Horta, N. (2011). Applying a GA kernel on optimizing technical analysis rules for stock picking and portfolio composition. Expert Systems with Applications, 38(2011), 14072–14085.

    Google Scholar 

  14. Ibrahim, A. E. M. (2015). Developing profitable trading system, University of Sharjah, Sharjah, UAE. Journal of Stock & Forex Trading, 4(1), 1000145.

    Article  Google Scholar 

  15. Janowicz, M., Orłowski, A., & Warzyński, F. (2014). Optimization of investment management in Warsaw stock market. Przedsiebiorczosc i Zarzadzanie, 15(2), 143–156.

    Article  Google Scholar 

  16. Kaufman, P. (2013). Trading systems and methods (5th ed.). Hoboken, NJ: Wiley.

    Google Scholar 

  17. Kiani, K., & Kastens, T. (2008). Testing forecast accuracy of foreign exchange rates: Predictions from feed forward and various recurrent neural network architectures. Computational Economics, 32, 383–406.

    Article  Google Scholar 

  18. Kirkpatrick, Ch., & Dahlquist, J. (2016). Technical analysis: The complete resource for financial market technicians (3rd ed.). Upper Saddle River, NJ: Pearson Education.

    Google Scholar 

  19. Murphy, J. (1999). Technical analysis of the financial markets: A comprehensive guide to trading methods and applications (New York Institute of Finance). Englewood Cliffs: Prentice Hall Press.

    Google Scholar 

  20. Rosilloab, R., de la Fuentea, D., & Brugosb, J. (2012). Technical analysis and the Spanish stock exchange: Testing the RSI, MACD, momentum and stochastic rules using Spanish market companies. Applied Economics, 45(12), 1541–1550.

    Article  Google Scholar 

  21. Tucnik, P. (2010a). Automatic trading system design. In V. Godara (Ed.), Pervasive computing for business: Trends and applications. Sydney: IGI Global.

    Google Scholar 

  22. Tucnik, P. (2010b). Optimization of automated trading system’s interaction with market environment (Vol. 64, pp. 55–61)., Lecture Notes in Business Information Processing Springer: Berlin.

    Google Scholar 

  23. Vanstone, B., & Finnie, G. (2008). An empirical methodology for developing stockmarket trading systems using artificial neural networks. Expert Systems with Applications, 36(2009), 6668–6680.

    Google Scholar 

  24. Vasilakis, G., Theofilatos, K., Georgopoulos, E., Karathanasopoulos, A., & Likothanassis, S. (2012). A genetic programming approach for EUR/USD exchange rate forecasting and trading. Computational Economics, 42, 415–431.

    Article  Google Scholar 

  25. Vasiliou, D., Eriotis, N., & Papathanasiou, S. (2006). How rewarding is technical analysis? Evidence from Athens stock exchange. Operational Research, 6(2), 85–102.

    Article  Google Scholar 

  26. Wiles, P. S., & Enke, D. (2015). Optimizing MACD parameters via genetic algorithms for soybean futures. Procedia Computer Science, 61, 85–91.

    Article  Google Scholar 

Download references

Acknowledgements

We thank all partners for their unfailing support and assistance in completing the research and Alexandro Kesidi, Fotio Chartsioudi and Antonio Arvanitidi, in particular. We thank all reviewers for their valuable comments and advice. We thank Savvas Chatzichristofis for his valuable advises.

Author information

Affiliations

Authors

Corresponding author

Correspondence to D. Th. Vezeris.

Appendices

Appendix 1: Pseudo Code

(a) Initial Conditions and Limitations

figurec

We have replaced the symbol variable value, with USDJPY, GBPUSD, AUDUSD, NZDUSD, USDCAD, XAUUSD and XAGUSD alternatively.

(b) Computation of Safest Optimized Parameters in Back Testing Periods Pseudo Code

Backtesting Function (2011–2015)

// This function applies the MACD based trading system for all combinations of values that parameters can take in the domain of their definition. The target is for all transactions to be executed, and for each combination of parameters, the profit and the profit factor in backtesting period of each reporting month, to be recorded. As we have mentioned, we are back testing within a range of one to twelve months, before each of the 60 months of the 5-year (2011–2015 period.)//

figured

(c) Parameters Selection by Conditions Pseudo Code

Best f,s,g Parameters Function for Reference Months for all Backtesting periods

// This function ranks and selects firstly by profit factor and secondly by net profit, the best (the maximum) of each period of each reporting month. Thereby, we separate and record the parameters of MACD which brought the best result, as optimal. In addition, we apply the parameters selection conditions as an additional option filter.//

figuree

(d) Future Projections Pseudo Code on Reference Months

Reference Month Function of periods Parameters Testing

// This function applies the selected optimal parameters to all reference months per back testing period, using the same trading system based on MACD. The goal is to make transactions and record the profit factor and the net profit, for each configuration per period for every reference month.//

figuref

(e) Select Specialized Period and Conditions per Symbol Pseudo Code

Select Best Period(symbol) function for Parameters optimizing

//This function ranks and selects firstly by profit factor and secondly by net profit, the best backtesting period per reference month. After this classification, we can select the best backtesting period, which will optimise the future parameters for MACD expert trading system.//

figureg

(f) Select Period Per Symbol and Generalized Conditions Pseudo Code

Select the most profitable Condition including all assets

figureh

Appendix 2: More Results Using Dynamic Data Period Selection Algorithm

(a) EURUSD

Fig. 21
figure21

3D Presentation graph of BT periods’ dynamic change, for EURUSD

The 3D monthly on X axis BT period representation (January 2011 to April 2016), illustrates optimal BT period variability on Z axis for EURUSD. The Y axis represent the BT periods from 1 to 12 months. The Z axis of the diagram depicts the Profit Factor values in bar charts. The highest value bars are presented in blue if Profit_Factor \(\ge \) or red if Profit_Factor \(<1\). All the other smaller Profit Factors per BT period are illustrated in grey (Fig. 21).

In Table 9, monthly sequential display of BT periods and their respective calculated optimal MACD parameters, Profit factors and profit in USD are presented. At this point, we observe that the dynamic change of BT periods (column 2-BT period) instigates the corresponding change of optimal MACD parameters (columns 3-fast,4-slow and 5-signal), for every month with profitability edge in $ (column 7-Profit$) .

Table 9 Comprehensive test results of EURUSD per month (BT periods, parameters, profit factors and profits)

(b) GBPUSD

In the first results diagram (Fig. 22), profit factors are illustrated, by testing the dynamic MACD parameters optimization method for GBPUSD. The procedure is initiated by gauging optimal BT periods, whose variability is displayed per month in Fig. 23. The monthly BT period representation(January 2014 to April 2016 on X axis), illustrates optimal BT periods variability in Fig. 23 and their profit factors in Fig. 22 on Y axes respectively (Fig. 24).

Fig. 22
figure22

Trading system’s profit factors by dynamic computation of BT periods for GBPUSD

Fig. 23
figure23

Presentation graph of BT periods’ dynamic change, for GBPUSD

Fig. 24
figure24

3D Presentation graph of BT periods’ dynamic change, for GBPUSD

The 3D monthly on X axis BT period representation (January 2014 to April 2016), illustrates optimal BT period variability on Z axis for GBPUSD. The Y axis represent the BT periods from 1 to 12 months. The Z axis of the diagram depicts the Profit Factor values in bar charts. The highest value bars are presented in blue if Profit_Factor \(\ge 1\) or red if Profit_Factor <1. All the other smaller Profit Factors per BT period are illustrated in grey.

In Table 10, monthly sequential display of BT periods and their respective calculated optimal MACD parameters, Profit factors and profit in USD are presented. At this point, we observe that the dynamic change of BT periods (column 2-BT period) instigates the corresponding change of optimal MACD parameters (columns 3-fast,4-slow and 5-signal), for every month with profitability edge in $ (column 7-Profit $).

(c) XAUUSD

In the first results diagram (Fig. 25), profit factors are illustrated, by testing the dynamic MACD parameters optimization method for XAUUSD. The procedure is initiated by gauging optimal BT periods, whose variability is displayed per month in Fig. 26. The monthly BT period representation(January 2014 to April 2016 on X axis), illustrates optimal BT periods’ variability in Fig. 26 and their profit factors in Fig. 25 on Y axes respectively.

Table 10 Comprehensive test results of GBPUSD per month (BT periods, parameters, profit factors and profits)
Fig. 25
figure25

Trading system’s profit factors by dynamic computation of BT periods for XAUUSD

The 3D monthly on X axis BT period representation (January 2014 to April 2016), illustrates optimal BT period variability on Z axis for XAUUSD. The Y axis represent the BT periods from 1 to 12 months. The Z axis of the diagram depicts the Profit Factor values in bar charts. The highest value bars are presented in blue if Profit_Factor\(\,>\,\)=1 or red if Profit_Factor\(\,<\,\)1. All the other smaller Profit Factors per BT period are illustrated in grey.

In Table 11, monthly sequential display of BT periods and their respective calculated optimal MACD parameters, Profit factors and profit in USD are presented. At this point, we observe that the dynamic change of BT periods (column 2-BT period) instigates the corresponding change of optimal MACD parameters (columns 3-fast,4-slow and 5-signal), for every month with profitability edge in $ (column 7-Profit $) (Fig. 27).

Fig. 26
figure26

Presentation graph of BT periods’ dynamic change, for XAUUSD

Table 11 Comprehensive test results of XAUUSD per month (BT periods, parameters, profit factors and profits)
Fig. 27
figure27

3D Presentation graph of BT periods’ dynamic change, for XAUUSD

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Vezeris, D.T., Schinas, C.J. & Papaschinopoulos, G. Profitability Edge by Dynamic Back Testing Optimal Period Selection for Technical Parameters Optimization, in Trading Systems with Forecasting. Comput Econ 51, 761–807 (2018). https://doi.org/10.1007/s10614-016-9640-x

Download citation

Keywords

  • d-BackTest PS method
  • Optimal historical data period selection
  • Back testing optimization algorithms
  • Expert back testing systems
  • MACD optimization
  • Forex