The prediction of fluctuations in foreign exchange prices is a well-researched and well-known field in finance. Using machine-learning techniques to evaluate and forecast changes in the foreign exchange market has been examined in numerous research projects. This study examined multiple machine learning techniques, including random forest, Adaboost, logistic regression, gradient boosting, bagging, Gaussian naïve Bayes, extreme gradient boosting, decision tree, and a proposed ensemble method combining three models: logistic regression, extreme gradient boosting, and Gaussian naïve Bayes. The proposed method aimed at forecasting when to buy and sell dollars relative to the Japanese yen to make more profits. Various technical markers were included in the training dataset to improve accuracy. Experimental results showed that the proposed ensemble method performed better than competing techniques, yielding better prediction accuracy. The proposed method achieved an accuracy of 98.4%, which shows that it can help investors decide when to purchase and sell in the USD/JPY market and make wise judgments.