MATHEMATICAL MODELLING OF TECHNOLOGICAL PROCESSES AND SYSTEMS
Heuristic optimization of moving-average trading rules on stock data
- 1 Ss. Cyril and Methodius University - Faculty of Computer Science & Engineering - Skopje, North Macedonia
Abstract
This paper investigates the optimization of a Moving-Average (MA) crossover trading strategy using derivative-free methods. The strategy, defined on daily prices of the S&P 500, Apple (AAPL), and Alphabet (GOOGL) (1995–2024), is characterized by two integer parameters: short-term and long-term window lengths. We treat the in-sample annualized Sharpe ratio as a black-box objective function. We propose a multi-start coordinate pattern search algorithm that iteratively probes neighboring parameters and adaptively shrinks step sizes. Results from 1000 Monte Carlo runs per asset demonstrate that the method reliably converges to near-optimal solutions comparable to expensive brute-force grid searches. The optimizer identifies distinct optimal regimes: medium-term windows for GOOGL, a fixed long-term trend (approx. 220 days) for the S&P 500, and a specific fast-slow combination (2 and 240 days) for AAPL.
Keywords
References
- William F. Sharpe, Mutual Fund Performance, The Journal of Business 39 (1): pp. 119–138, (1966)
- Monte Carlo methods in finance - Wikipedia (accessed on 05.12.2025)
- Moving Average Crossover Strategies: Types, Calculations, Pros & Cons for Trading (accessed on 05.12.2025)
- Sharpe ratio - Wikipedia (accessed on 05.12.2025)
- Heuristic (computer science) - Wikipedia (accessed 05.12.2025)