Many studies have been proposed to prove that technical analysis can help investors make trading decisions. The moving average (MA) is a widely used technical indicator that plays an important role in this field since it directly reflects stock fluctuations. However, most studies ignore the parameter settings of the MA, which leads to underestimation of the potential of the MA. Therefore, this paper is the first attempt to remove all restrictions and extend the limits of the MA to take advantage of the MA's capability well. It also uses different kinds of MA, such as the weighted moving average (WMA) and the exponential moving average (EMA), to compose trading strategies. Our system proposes the global best-guided quantum-inspired tabu search algorithm (GQTS), which is better at searching than traditional algorithms, to optimize trading strategies based on the MA. Furthermore, an innovative 2-phase sliding window is invented to consider more investment situations in changeable stock markets. In summary, this paper intended to investigate the ability of MA and proposed dynamic and intelligent trading strategies based on MA, GQTS, and 2-phase sliding window to assist investors to make trading decisions. The experiments show that the proposed system flexibly discovers better trading points. Our system outperforms traditional methods and beats the buy-and-hold strategy to yield significant profits both in developed and emerging stock markets.