Trend-following trading is a popular strategy in automated forex trading. This approach achieves high profitability and success rates in trending markets. However, this strategy per-forms poorly in non-trending markets, such as choppy, range-bound, or sideways markets. In this study, we focus on lever-aging artificial intelligence - specifically, LSTM networks—to filter out suboptimal trades by predicting market trends. The experimental results were quite surprising: applying artificial intelligence to the automated trading system enabled us to eliminate more than 70% of the ineffective trades generated by the existing trend-following system.