American Journal of Business and Operations Research

Financial Sector-Ready Framework for USD–PKR Exchange Rate Forecasting Using Ninja Optimization

El-Sayed M. El-Kenawy
Volume 13, Issue 1, pp. 26–36 (2025)
DOI: https://doi.org/10.54216/AJBOR.130103
Online: https://americaspg.com/journal/1/article/4093

Abstract

Accurate exchange rate prediction is a critical challenge in financial forecasting, as fluctuations in exchange rates directly impact trade balances, investment strategies, and monetary policy decisions. Motivated by the need for robust and precise forecasting models, this study presents a novel framework that integrates deep learning (DL) methodologies with advanced metaheuristic optimization. At the core of this framework is the Continuous-Time Sequence Model (CTSM), complemented by the binary Ninja Optimization Algorithm (bNiOA) for feature selection and the Ninja Optimization Algorithm (NiOA) for hyperparameter tuning. Experimental results demonstrate substantial improvements in predictive performance. The baseline CTSM model achieved an accuracy of 0.8168 with a mean squared error (MSE) of 0.0718. After applying the bNiOA-driven feature selection, accuracy increased markedly to 0.9576, while the MSE was reduced to0.00067. Further optimization of hyperparameters through NiOA elevated the model’s accuracy to 0.9963, with an MSE of 0.00088. These results validate that the proposed optimization-enhanced deep learning pipeline effectively reduces feature redundancy and dimensionality, while finely tuning model parameters to achieve superior accuracy and generalization. The implications of this study are significant, providing policymakers, investors, and businesses with a powerful tool for risk management, strategic planning, and informed decision-making in volatile currency markets.

Keywords: Ninja Optimization Algorithm (NiOA); Feature Selection-Hyperparameter Tuning; USD–PKR Time Series Prediction; Hybrid Deep Learning–Metaheuristic Models; Financial Time Series Forecasting

1. INTRODUCTION

the prices of imports and exports, the cost of external debt servicing, and domestic inflation levels [3, 4, 5].

Exchange rates are among the most closely observed monetary variables worldwide, as they form the basis for determining international economic relations on a global scale [1, 2]. They influence trade competitiveness, capital flows, financial markets, and monetary policy decisions, while also serving as vital indicators of macroeconomic stability. The exchange rate between the Pakistani Rupee (PKR) and the US Dollar (USD) holds special importance for emerging economies such as Pakistan. Exchange rate fluctuations directly impact

This dual academic and practical significance makes forecasting exchange rate movements critical for governments, businesses, and investors. Accurate exchange rate prediction is essential for financial stability and economic planning. In markets like Pakistan, currency volatility can substantially affect investment returns, influence foreign direct investment inflows, and alter borrowing costs for both public and private sectors. Exchange rate changes affect corporate earnings, particularly for export-oriented and multinational enterprises operating across currencies. Furthermore, the foreign exchange market serves as a leading indicator of economic health; unexpected depreciation or appreciation of the PKR can prompt inflationary pressures or competitiveness shocks, compelling timely policy responses.

Reliable currency forecasts empower financial institutions, corporations, and policymakers to manage risks effectively, optimize hedging strategies, and adapt economic policy to evolving market dynamics. The imperative for accurate forecasting extends into operational and strategic corporate decision-making. Firms increasingly rely on exchange rate predictions to guide capital budgeting, pricing, and supply chain management, especially in the growing digital marketplace and cross-border e-commerce. Effective currency risk management helps firms reduce financial uncertainty and maintain competitiveness. Additionally, sovereign debt managers utilize forecasts to predict currency-driven shifts in repayment burdens, maintaining fiscal sustainability and investor confidence. Thus, precise exchange rate forecasting translates into enhanced economic resilience and sound financial governance.

Traditional econometric methods, including Autoregressive Integrated Moving Average (ARIMA), Generalized Autoregressive Conditional Heteroskedasticity (GARCH), and cointegration models, have a longstanding role in exchange rate forecasting [4, 2]. However, these methods often rely on restrictive assumptions such as linearity and stationarity that fail under the nonlinear, volatile conditions typical in foreign exchange markets impacted by global economic and political factors. This has spurred a shift toward machine learning and deep learning approaches, which can model complex nonlinear and nonstationary relationships inherently present in financial time series without strong parametric constraints.

Deep learning models excel by automatically discovering hierarchical features and handling large-scale, multidimensional data with limited manual feature engineering [6, 7]. Despite these strengths, challenges remain: high dimensionality, feature redundancy due to correlated financial indicators such as open, high, low, and close prices, hyperparameter sensitivity, and risks of overfitting complicate model development. Manual hyperparameter tuning is time-consuming and computationally intensive, increasing the demand for automated optimization.

To overcome these limitations, research combines deep learning models with metaheuristic optimization to enhance feature selection and hyperparameter tuning. Algorithms such as Particle Swarm Optimization (PSO), Whale Optimization Algorithm (WOA), and Grey Wolf Optimizer (GWO) efficiently navigate the search space to avoid local minima and improve model performance [8, 9]. In the context of exchange rate forecasting, these approaches reduce redundancy, optimize model settings, and balance the bias–variance tradeoff. This study proposes a novel predictive framework integrating a Continuous-Time Sequence Model (CTSM) with the Ninja Optimization Algorithm (NiOA). The binary variant of NiOA (bNiOA) is utilized for effective feature selection, while NiOA itself optimizes hyperparameters. This integrated approach delivers state-of-the-art accuracy and robustness in forecasting the USD–PKR exchange rate.

The main contributions are summarized as follows:

The rest of this paper is organized as follows: Section 2 reviews literature on exchange rate forecasting methods; Section 3 details datasets, preprocessing, and models; Section 4 presents experimental results and comparisons; Section 5 discusses the findings; and Section 6 concludes the paper and identifies future research directions.

2. LITERATURE REVIEW

Forecasting foreign exchange rates has been extensively studied using a wide range of machine learning (ML) and deep learning (DL) methodologies. One line of research integrates sentiment analysis with financial data to enhance the accuracy of predictions. For instance, a study combined Twitter-based sentiment features with forex data for the USD/PKR pair, applying classifiers such as logistic regression, random forest, bagging, naïve Bayes, and SVM, and reported that the logistic classifier achieved the best accuracy at 82.14% [3]. Building on the importance of sentiment, another study proposed a deep-learning model that integrated investor sentiment extracted from approximately 5.9 million tweets with macroeconomic indicators, including gold and crude oil prices. The model, validated on PKR/USD, GBP/USD, and HKD/USD exchange rates, demonstrated superior predictive accuracy compared to statistical approaches, emphasizing the critical role of local and foreign macro-level events in currency forecasting [10].

Beyond sentiment-based models, technical indicators continue to play a central role in exchange rate prediction. A study employing artificial neural networks (ANNs) alongside indicators such as SMA, momentum, MACD, and RSI, over ten years of data from 24 emerging economies, showed that ANNs significantly outperformed technical indicators alone, highlighting the potential of hybrid methods [11]. Complementing such work, a systematic review catalogued machinelearning techniques, input data, validation practices, and research gaps in financial-market forecasting [9].

Other studies focus on advanced nonlinear and interval forecasting approaches. Pfahler evaluated advanced machinelearning methods for exchange-rate prediction and found that gains over conventional benchmarks depend on the currency pair, forecast horizon, and model specification [1]. Maté and Jiménez proposed an interval multilayer perceptron (iMLP) for exchange-rate forecasting, explicitly modeling daily low– high ranges to improve interval predictions [7].

Hybrid modeling has also been explored using an ANN in combination with evolutionary algorithms. One study compared a simple ANN with a hybrid ANN-GA (Genetic Algorithm) for INR/USD short-term prediction, reporting lower RMSE values for the hybrid model [12]. Behavioral finance has also been introduced into ML frameworks by integrating calendar effects into ensemble models, which improved predictive accuracy and reduced volatility when forecasting USD/BRL rates, demonstrating the value of accounting for investor behavior in time-series forecasting [13].

Architectural innovations in deep learning have yielded further gains. A CNN-TLSTM model was proposed for USD/CNY prediction, leveraging convolutional networks for feature extraction and a modified TLSTM for sequence learning. The model outperformed traditional approaches such as ARIMA, MLP, and standard LSTMs, achieving the best predictive performance across multiple error metrics [6]. Similarly, experiments comparing RNN and CNN-RNN hybrids for USD/INR prediction concluded that the simple RNN slightly outperformed the hybrid, though further testing was recommended [14].

The link between exchange rates and stock markets has also been investigated. One study analyzed the impact of USD fluctuations on stock price movement using ML models, emphasizing the broader economic implications of currency volatility [15]. Classical econometric models, such as ARIMA and GARCH, have also been applied to USD/PKR forecasting, where GARCH modeling effectively captured conditional heteroscedasticity effects. However, ARCH showed marginally better performance [4]. In related work, hybridizing univariate models (ARIMA, Naïve, Exponential Smoothing) with ANN and NARDL improved the prediction of the Turkish Lira/USD exchange rate, with the NARDL-Naïve combination outperforming alternatives [5].

Research has also examined safe-haven behavior and recurrent architectures in financial forecasting. A time-varying parameter VAR analysis found that gold can provide short-run protection against dynamic exchange-rate risk for the euro, U.S. dollar, and British pound, while the yen displays safehaven behavior during elevated international risk [16]. Comparative evaluation of ARIMA, GRU, LSTM, and BiLSTM models further demonstrated the value of recurrent neural networks for nonlinear financial time-series forecasting [17]. Financial stress is also closely linked with macroeconomic fragility; evidence from the UK and Germany indicates a significant negative causal relationship from financial stress to economic activity [18].

Table 1 provides a systematic summary of the essential studies reviewed in the literature on exchange rate forecasting. It highlights the primary purpose of each study, the methods used, and their key findings. The table illustrates the diverse methods employed in this field, including sentimentdriven machine learning architectures, hybrid evolutionary algorithms, deep learning architectures, conventional econometric models, and macro-financial stress indicators.

3. MATERIALS AND METHODS

This section details the datasets, preprocessing procedures, and methodological framework utilized in this study. We describe the sources of exchange rate and auxiliary data, as well as the measures taken to ensure data quality and consistency.

Figure 1. Moving-average crossover of the USD–PKR closing price alongside 50-day and 200-day moving averages.
Figure 1. Moving-average crossover of the USD–PKR closing price alongside 50-day and 200-day moving averages.

Furthermore, the modeling strategy—including feature selection, model architecture, training protocols, and evaluation metrics—is comprehensively outlined. This ensures transparency and provides a reproducible foundation for future research using the proposed framework.

3.1 Dataset Description

The dataset comprises daily records of the exchange rate between the United States dollar (USD) and the Pakistani rupee (PKR), spanning from January 2000 to May 2024. This extensive, two-decade-plus period captures a range of macroeconomic cycles, volatility episodes, and significant structural shifts in the USD–PKR exchange rate regime. Data were sourced from reliable and publicly available financial repositories, official gazettes, and authoritative publications, guaranteeing validity and consistency.

The dataset includes both temporal and price-based variables to encapsulate the multifaceted dynamics of exchange rates across different time scales. Temporal variables such as Year, Month, Week, and Date facilitate analysis of long-term trends, seasonality, and short-term fluctuations. Price variables— namely Open, High, Low, and Closing Price—capture intraday market behaviors. Among these, the Closing Price serves as the target variable for prediction, while the others function as predictor variables. Table 2 summarizes the dataset features.

The combined use of temporal and price variables affords a comprehensive view of exchange-rate behavior, enabling robust modeling of both macroeconomic trends and intraday volatility. Technical analysis tools, such as moving averages, are frequently employed to identify trends and generate trading signals. The moving-average crossover technique, using short-term and long-term moving averages, importantly highlights momentum shifts within the market. Figure 1 displays the closing price along with its 50-day and 200-day moving averages, illustrating their utility in capturing significant market dynamics over time.

3.2 Data Preprocessing

Before model development, the dataset underwent a series of preprocessing steps to ensure quality, consistency, and suitability for deep learning applications. Since financial timeseries data are often prone to issues such as missing values, scale imbalances, and redundant information, careful prepro-

Table 1. Summary of related literature on exchange rate forecasting using machine learning and econometric approaches.
Table 1. Summary of related literature on exchange rate forecasting using machine learning and econometric approaches.

Logistic classifier achieved highest accuracy (82.14%). [10] Incorporate event sentiment and macroeconomic indicators for FX forecasting.

Model outperformed statistical techniques; U.S. events had strongest impact.

Deep-learning model with 5.9M tweets, gold and oil prices; applied across PKR/USD, GBP/USD, and HKD/USD.

[11] Assess technical indicators with ANN for emerging economies.

ANN significantly outperformed technical indicators alone. [9] Review ML methods and data for financial-market forecasting.

SMA, momentum, MACD, and RSI combined with ANN; cross-sectional and regression tests.

Identified dominant methods, common data sources, evaluation limitations, and research gaps. [1] Forecast exchange rates with advanced machine learning.

Systematic literature review of algorithms, input variables, and validation procedures.

Performance gains depended on the currency pair, horizon, and model specification. [7] Forecast exchange-rate intervals. Applied an interval multilayer perceptron to daily low–high exchange-rate data.

Compared nonlinear and ensemble ML specifications across currency forecasts.

Explicit interval modeling improved representation of daily exchange-rate ranges. [12] Forecast INR/USD short-term rates. Compared ANN and hybrid ANN-GA; GA optimized ANN weights.

Hybrid ANN-GA reduced RMSE compared with simple ANN. [13] Enhance ensemble ML models with behavioral finance.

Improved profit by 24% and reduced volatility by 16%. [6] Predict USD/CNY rates with a novel deep model.

Added calendar effects to ensemble predictions for USD/BRL.

CNN-TLSTM outperformed MLP, RNN, LSTM, and CNN-LSTM in all error metrics. [14] Evaluate RNN versus hybrid CNN-RNN for INR/USD forecasting.

Proposed CNN-TLSTM integrating feature extraction and modified LSTM.

Simple RNN slightly outperformed CNN-RNN; further research was recommended. [15] Study the impact of USD fluctuations on stock markets.

Daily USD/INR data tested with RNN and CNN-RNN.

ML applied to USD and stock datasets. USD volatility significantly influenced stock-price movements. [4] Forecast USD/PKR with classical time-series models.

ARCH outperformed GARCH in prediction accuracy. [5] Forecast Turkish Lira/USD using hybrid methods.

Applied ARIMA and GARCH with lagged variables.

NARDL-Naïve combination gave the best forecasting performance. [16] Assess safe-haven protection against exchange-rate risk.

Combined ARIMA, Naïve, Exponential Smoothing, ANN, and NARDL.

Gold hedged selected currencies in the short run; the yen showed safe-haven behavior. [17] Compare recurrent and statistical forecasting models.

Applied a TVP-VAR model to gold and five major currencies.

Recurrent architectures captured nonlinear temporal dependencies more effectively than the statistical baseline. [18] Examine financial stress and economic activity. Used Granger causality in quantiles for the UK and Germany.

Evaluated ARIMA, GRU, LSTM, and BiLSTM on financial time series.

Financial stress exerted a significant negative causal effect on economic activity.

Table 2. Summary of dataset features for USD–PKR exchange rate forecasting.
Table 2. Summary of dataset features for USD–PKR exchange rate forecasting.

Feature Type Description Year Temporal Calendar year (2000–2024), representing long-term economic trends. Month Temporal Month of the year (1–12), capturing seasonal patterns. Week Temporal Week number within the year (1–53), reflecting short-term cycles. Date Temporal Specific calendar date (DD–MM–YYYY), providing precise temporal context. Open Numerical Opening exchange rate at the start of each trading day. High Numerical Highest exchange rate recorded during the trading day. Low Numerical Lowest exchange rate recorded during the trading day. Closing Price Numerical Final exchange rate of the day, designated as the target for prediction.

tion was adopted, transforming values into the interval [0,1], thereby accelerating convergence during training and preventing dominance of high-magnitude variables over smallerscaled ones.

cessing was essential for enhancing model performance and reducing computational overhead. Although the dataset was compiled from reliable sources, gaps in the records may occur due to holidays, non-trading days, or inconsistencies in data reporting. Where missing entries were detected, imputation strategies such as linear interpolation or forward–backward filling were applied to preserve the temporal continuity of the series.

Lastly, the dataset was separated into training and testing subsets to enable model evaluation. The deep learning models were fitted using the training subset, and the testing subset was retained to evaluate performance on unknown data fairly. These preprocessing steps resulted in a well-structured, clean, and normalized dataset, which forms a solid foundation for the modeling, feature-selection, and optimization steps.

The dataset predominantly consists of numerical variables; however, temporal attributes such as month and week were encoded as numeric values to allow the models to capture cyclical and seasonal effects. This encoding ensured that all features were compatible with deep learning frameworks without introducing categorical inconsistencies. Since deep learning models are sensitive to variations in feature scales, all numerical features (Open, High, Low, and Closing Price) were normalized to a uniform range. Min–Max normaliza-

3.3 Deep Learning Models

To assess the predictive ability of deep learning methods in forecasting the USD–PKR exchange rate, several models were tested and analyzed. The models were selected for their suitability for time-series forecasting and their ability to model complex time-related dependencies. This section presents the Continuous-Time Sequence Model (CTSM) as the primary architecture, along with three benchmark deep learning models: NSDE, SGM, and VAE.

3.3.1 Continuous-Time Sequence Model (CTSM)

The Continuous-Time Sequence Model (CTSM) was used as the fundamental forecasting architecture. CTSMs are designed to work with sequential data in a continuous-time setting; thus, they are suitable for exchange-rate forecasting, where irregularities and dynamic variability are present. The CTSM architecture consists of multiple layers, including an input layer, recurrent hidden layers that utilize nonlinear activation functions, and a fully connected output layer. The hidden layers were fitted with ReLU and tanh activation functions to learn nonlinear dynamics, and dropout regularization was employed to prevent overfitting. The output layer generates the estimated closing price of the USD–PKR exchange rate.

Although CTSM showed good baseline performance, it was sensitive to hyperparameter settings, including learning rate, hidden-layer size, and dropout ratio, which reduced its predictive accuracy. Thus, metaheuristic optimization methods were implemented, with a special focus on the Ninja Optimization Algorithm (NiOA), which significantly contributed to improving the model’s stability, performance, and prediction precision.

3.3.2 Benchmark Deep Learning Models

To provide a fair comparative framework, three widely used deep learning architectures were selected as benchmarks. The motivation for their inclusion lies in their frequent application to predictive maintenance and time-series forecasting tasks.

These models were selected to benchmark the performance of CTSM against alternative deep learning paradigms, thereby ensuring that the proposed optimization framework is evaluated within a comprehensive and competitive context.

3.4 Metaheuristic Algorithms

Metaheuristic algorithms are powerful tools for solving optimization problems that are otherwise intractable by deterministic methods. They are widely adopted in machine learning and deep learning applications for tasks such as feature selection and hyperparameter optimization, especially in high-dimensional and nonlinear problem spaces. The success of metaheuristics lies in their ability to balance exploration (searching new areas of the solution space) and exploitation (refining promising solutions). In this study, several state-of-the-art algorithms were tested; however, the Ninja Optimization Algorithm consistently demonstrated superior performance.

3.4.1 Role of Metaheuristics in Feature Selection

Feature selection is critical in financial time-series forecasting, where variables such as open, high, low, and close prices are often highly correlated. Redundant or irrelevant features not only increase computational costs but also degrade predictive performance. Metaheuristic algorithms address this problem by formulating feature selection as an optimization task, where the objective is to maximize predictive accuracy while minimizing the number of selected features. Compared with traditional filter, wrapper, and embedded methods, metaheuristics are particularly advantageous because they strike a balance between exploration and exploitation, thereby yielding stable feature subsets that enhance both model efficiency and interpretability.

3.4.2 Role of Metaheuristics in Hyperparameter Optimization

Deep learning models contain numerous hyperparameters, such as learning rate, batch size, number of layers, and dropout rates, which significantly influence performance. Manual tuning is often impractical and computationally expensive, while grid search and random search provide limited scalability. Metaheuristic algorithms overcome these limitations by intelligently searching the hyperparameter space and adaptively refining candidate solutions based on fitness evaluations. In this study, metaheuristics were employed to optimize CTSM and the benchmark models, yielding substantial improvements in predictive accuracy and convergence stability.

3.4.3 Ninja Optimization Algorithm (NiOA)

The Ninja Optimization Algorithm (NiOA) used in this study is a nature-inspired optimizer modeled on the stealth, precision, and adaptability of Japanese ninjas. Its search mechanism follows the broader metaheuristic principle of balancing global exploration with local exploitation, an approach widely used to optimize deep neural-network structures and hyperparameters [8].

Exploration Phase: In this phase, NiOA mimics the stealthy movement of ninjas across uncharted territories, scanning vast regions of the search space to avoid local optima. The exploration update is defined as

Ls(t +1) = Ls(t)+r1 (Ls(t1)−Ls(t2)), (1) or, under stagnation,

Ls(t +1) = L′

s ∈FS, (2)

where r1 is a random factor, Ls(t1) and Ls(t2) represent previous positions, and FS denotes the feasible solution space. Additionally, a diversity-preserving update ensures oscillatory movement:

Ds(t +1) = Ds(t)+|Ds(t)+r2Ds(t)|cos(2πt), (3) where r2 is a scaling parameter introducing periodicity and global search variability.

Exploitation Phase: Once promising regions are identified, NiOA transitions into a targeted exploitation phase, refining solutions with precision and accuracy. The exploitation update is given by

Ms(t +1) = J1Ms(t)+2J2

Ms(t)

(1−Ms(t))2 ,

+(Ms(t)+J1) where J1 and J2 control intensification. A secondary refinement dynamically adapts the search trajectory:

Rs(t +1) = Rs(t)+(1+Rs(t)+J2)ecos(2π), (5) ensuring stability and preventing over-exploitation of local regions. Algorithm 1 summarizes the complete procedure.

Algorithm 1. Ninja Optimization Algorithm (NiOA)

1: Initialize population size N, maximum iterations T, random positions, and parameters. 2: while t < T do 3: for each agent s do 4: Update position using exploration equations. 5: Ls(t +1) = Ls(t)+r1(Ls(t1)−Ls(t2)). 6: Or choose random L′ s ∈FS if stagnation occurs. 7: Ds(t +1) = Ds(t)+|Ds(t)+r2Ds(t)|cos(2πt). 8: end for 9: Apply mutation to increase diversity. 10: for each agent s do 11: Refine solutions through exploitation. 12: Update Ms(t +1) using Eq. (4). 13: Update the solution trajectory. 14: Update Rs(t +1) using Eq. (5). 15: end for 16: If stagnation is detected, apply an aggressive update rule. 17: Update the best solution Bs. 18: end while 19: return best solution Bs.

3.4.4 State-of-the-Art Metaheuristic Algorithms

Several nature-inspired metaheuristic algorithms were considered in this work, each motivated by its proven efficiency in global optimization tasks. The following optimizers were applied for feature selection and hyperparameter tuning in the deep learning framework:

Their complementary advantages determined the choice of these algorithms: swarm-based (PSO, GGO, WOA, SAO), evolutionary (FEP, JAYA), physics-inspired (MVO, GSA), and bio-inspired (TSH, SBO). Their differences provide a solid basis for comparative analysis, enabling the study to assess the most effective strategies for feature selection and hyperparameter optimization in predicting exchange rates.

3.5 Evaluation Metrics

To ensure a rigorous and comprehensive evaluation, two sets of evaluation metrics were employed in the current study. Regression-based metrics were used to measure predictive accuracy and the ability to generalize model performance. During the feature-selection process, the efficiency, stability, and effectiveness of the selected feature subsets were evaluated in terms of optimization measures.

Regression Metrics for Model Performance

The predictive accuracy of the deep learning models was evaluated using the regression metrics listed in Table 3.

Feature Selection Metrics

The effectiveness of feature-selection methods was measured using the optimization-based metrics listed in Table 4.

Here, yi and ˆyi denote the actual and predicted values, ¯y is the mean of observed values, f(S j) is the fitness function of the selected feature subset Sj, N is the number of samples, and M is the number of independent runs of the optimization algorithm. These evaluation criteria provide a sound measure of both predictive accuracy and the effectiveness of feature selection.

4. RESULTS

This section presents the experimental findings of the developed methodology, emphasizing its implications and performance within the financial sector, especially for currency exchange markets. A comprehensive evaluation is conducted comparing the proposed models with established benchmarks, focusing on predictive accuracy, robustness, and generalization ability relevant to financial risk management and decision-making.

Table 3. Regression metrics for model performance evaluation.
Table 3. Regression metrics for model performance evaluation.

n ∑ i=1

(yi −ˆyi)2

Root Mean Squared Error (RMSE) RMSE = n ∑ i=1

Mean Absolute Error (MAE) MAE = 1

|yi −ˆyi| n

n ∑ i=1

Mean Bias Error (MBE) MBE = 1

(yi −ˆyi) i=1(yi −¯y)(ˆyi −¯ˆy) q

Correlation Coefficient (r) r = ∑n i=1(yi −¯y)2 ∑n i=1(ˆyi −¯ˆy)2

Coefficient of Determination (R2) R2 = 1−∑n i=1(yi −ˆyi)2 i=1(yi −¯y)2

Relative RMSE (RRMSE) RRMSE = RMSE

¯y ×100%

Nash–Sutcliffe Efficiency (NSE) NSE = 1−∑n i=1(yi −ˆyi)2 i=1(yi −¯y)2

Willmott’s Index (WI) WI = 1− ∑n i=1(yi −ˆyi)2 i=1(|ˆyi −¯y|+|yi −¯y|)2

Table 4. Feature selection metrics for evaluation of optimization algorithms.
Table 4. Feature selection metrics for evaluation of optimization algorithms.

M ∑ j=1

Average Selected Size AS = 1

|S j| M

M ∑ j=1

Average Fitness AF = 1 f(Sj)

M min

Best Fitness BF = j=1 f(S j)

M max v u u t 1 M −1 2 �

Worst Fitness WF = j=1 f(Sj)

M ∑ j=1 f(Sj)−¯f

Standard Deviation of Fitness Std(F) =

4.1 Baseline Model Comparison

To establish a financial-sector-relevant benchmark, the initial performance of the deep learning models was assessed on raw exchange-rate data without employing optimization techniques. The results are summarized in Table 5, showing key error and correlation metrics directly linked to forecasting reliability in volatile markets such as USD–PKR.

In the context of financial forecasting, the CTSM model notably outperforms competing architectures, presenting the lowest prediction errors (MSE, RMSE, and MAE) and the highest explanatory power (R2 = 0.8168). The strong correlation coefficient (r = 0.8042) and efficiency indices such as Nash–Sutcliffe Efficiency and Willmott’s Index attest to its robustness and capacity to model the intricate, nonlinear dynamics typical of currency exchanges.

Models such as NSDE, SGM, and particularly VAE show diminished performance, which reflects their lesser suitability to capture the critical volatility and regime changes in financial markets. This baseline comparison underscores the need for advanced feature selection and hyperparameter optimization to further enhance model reliability and predictive power—essential for informed financial decision-making, hedging strategies, and policy formulation in currency risk management.

To facilitate a multidimensional comparison reflecting finan-

Figure 2. Normalized evaluation metrics comparison of deep learning models for USD–PKR exchange-rate forecasting, highlighting performance crucial for financial risk assessment and strategy.
Figure 2. Normalized evaluation metrics comparison of deep learning models for USD–PKR exchange-rate forecasting, highlighting performance crucial for financial risk assessment and strategy.

cial forecast quality, Figure 2 visualizes normalized performance metrics for all models, including error magnitudes, correlation, and efficiency measures. This figure aids financial analysts and decision-makers in quickly discerning the best-performing models under diverse evaluation criteria relevant to practical deployment.

4.2 Before Feature Selection

The relative performance of several binary metaheuristic optimizers was evaluated on financial time-series data before

Table 5. Baseline performance metrics of deep learning models before feature selection and optimization on financial time series.
Table 5. Baseline performance metrics of deep learning models before feature selection and optimization on financial time series.

Model MSE RMSE MAE MBE r R2 RRMSE NSE WI CTSM 0.0718 0.2827 0.2415 0.0007 0.8042 0.8168 20.48 0.9327 0.8900 NSDE 0.0901 0.3432 0.2938 0.0038 0.6611 0.6737 23.82 0.9177 0.7297 SGM 0.1084 0.4037 0.3460 0.0077 0.5179 0.5305 23.84 0.8602 0.5694 VAE 0.1266 0.4641 0.3982 0.0117 0.3748 0.3874 25.40 0.8360 0.4092 the deep learning prediction models were subjected to feature selection. These optimizers were compared based on key financial modeling criteria including average error, subset size to reduce data dimensionality, and fitness indicators reflecting model stability and predictive capacity. Table 6 summarizes results across the binary algorithms.

The results reveal that the bNiOA algorithm consistently outperforms its peers in financial feature reduction, achieving the lowest average error (0.3387) and the smallest selected feature subset (0.2915). This indicates its superior capability to eliminate redundancy in financial variables effectively, which is crucial for robust and computationally efficient currency exchange-rate forecasting. In contrast, algorithms such as bSBO and bMVO produce larger subsets and higher error rates, underscoring their lower suitability for financial timeseries dimensionality reduction. These findings demonstrate the potential of the bNiOA approach as a pivotal preprocessing step for enhancing the precision and efficiency of deep learning models in the financial sector.

4.3 Deep Learning Performance After Feature Selection

Applying metaheuristic-based feature selection yielded significant improvements in the predictive performance of deep learning models on financial datasets. Table 7 shows refined performance metrics for CTSM, NSDE, SGM, and VAE after feature reduction.

The strongest financial time-series model remains CTSM, exhibiting the lowest MSE (0.00067), RMSE (0.00339), and MAE (0.00286). Its high R2 (0.9576) and r (0.9568) values affirm its ability to capture the complex dynamics of exchange rates effectively after feature selection. While NSDE and SGM also show improved accuracy, they lag behind CTSM but still indicate considerable gains. VAE, although the least performant, benefits substantially from feature optimization. These improvements highlight the critical importance of compact and informative feature sets in financial forecasting, improving generalization and computational feasibility. Figure 3 visually contrasts these models by key error metrics, supporting practitioners in selecting optimal forecasting tools for financial applications.

4.4 Optimized Models

The final phase involved hyperparameter optimization of the CTSM model using metaheuristic algorithms tailored for financial time-series data. Four optimizers—NiOA, PSO, GGO, and WOA—were compared, as shown in Table 8, demonstrating their impact on model accuracy and stability.

The NiOA-optimized CTSM model clearly leads in performance, achieving the lowest errors (MSE, RMSE, and MAE) and highest efficiency indices (R2 = 0.9963, NSE= 0.9951), essential for reliable financial forecasting amidst market volatility. PSO offers a strong alternative with moderate trade-

Figure 3. Comparison of deep learning models by MSE, RMSE, and MAE after feature selection on financial exchange-rate data.
Figure 3. Comparison of deep learning models by MSE, RMSE, and MAE after feature selection on financial exchange-rate data.

offs, while GGO and WOA provide comparatively lower accuracies but still improve upon unoptimized baselines. These results illustrate that metaheuristic hyperparameter tuning, particularly via NiOA, crucially enhances model adaptability and precision in the financial sector.

Advanced visualization via density and KDE plots (Figure 4) and box plots (Figure 5) further confirms the reliability and consistency of NiOA-optimized CTSM performance, informing financial analysts about the stability of forecast errors and reinforcing confidence in model predictions for risk-sensitive applications.

5. DISCUSSION

The experimental results clearly demonstrate that integrating deep learning models with advanced metaheuristic optimization significantly enhances the accuracy and robustness of USD–PKR exchange-rate forecasting. The Continuous-Time Sequence Model (CTSM) outperformed other deep learning architectures by effectively capturing intricate temporal and nonlinear dependencies in financial time series.

From a financial perspective, the improved precision achieved through the proposed model has meaningful implications. Accurate exchange-rate forecasts are critical for policymakers, central banks, investors, and multinational corporations to manage currency risk, optimize portfolios, and devise informed monetary policies. The application of the binary Ninja Optimization Algorithm (bNiOA) for feature selection successfully reduced input redundancy without sacrificing predictive power, which streamlines the model and improves interpretability—an important factor for real-world financial decision-making.

Moreover, the Ninja Optimization Algorithm (NiOA) for hyperparameter tuning fine-tuned CTSM, yielding state-ofthe-art forecasting performance compared with other metaheuristic optimizers. This level of accuracy and stability

Table 6. Performance of binary metaheuristic algorithms before feature selection on financial forecasting data.
Table 6. Performance of binary metaheuristic algorithms before feature selection on financial forecasting data.

Metric bNiOA bTSH bSAO bJAYA bMVO bFEP bGSA bMVO bSBO Average Error 0.3387 0.4439 0.4535 0.4437 0.4121 0.4206 0.4522 0.5178 0.5494 Average Selected Size 0.2915 0.5457 0.6851 0.7091 0.7095 0.6422 0.7160 0.7394 0.8132 Average Fitness 0.4019 0.4707 0.4936 0.4785 0.4764 0.5004 0.5104 0.5976 0.6076 Best Fitness 0.3037 0.4510 0.3833 0.4426 0.4661 0.4256 0.4535 0.5228 0.5507 Worst Fitness 0.4022 0.5187 0.4849 0.5187 0.5526 0.5436 0.5332 0.6408 0.6304 Std. Dev. Fitness 0.2242 0.2825 0.2924 0.2847 0.3274 0.3332 0.3434 0.4304 0.4406

Table 7. Deep learning model performance on financial exchange-rate forecasting after feature selection.
Table 7. Deep learning model performance on financial exchange-rate forecasting after feature selection.

Model MSE RMSE MAE MBE r R2 RRMSE NSE WI CTSM 0.00067 0.00339 0.00286 0.01229 0.9568 0.9576 9.54 0.9552 0.9251 NSDE 0.00091 0.00418 0.00354 0.01269 0.9479 0.9487 11.55 0.9122 0.8852 SGM 0.00114 0.00496 0.00421 0.01310 0.9389 0.9397 12.50 0.8757 0.8565 VAE 0.00138 0.00574 0.00489 0.01350 0.9300 0.9308 13.41 0.8561 0.8355

Table 8. Performance of the CTSM model optimized with metaheuristic algorithms for financial exchange-rate forecasting.
Table 8. Performance of the CTSM model optimized with metaheuristic algorithms for financial exchange-rate forecasting.

Model MSE RMSE MAE MBE r R2 RRMSE NSE WI NiOA + CTSM 0.00088 0.00361 0.00308 0.01250 0.9955 0.9963 6.30 0.9951 0.9792 PSO + CTSM 0.00112 0.00439 0.00375 0.01291 0.9865 0.9873 8.31 0.9663 0.9393 GGO + CTSM 0.00136 0.00517 0.00442 0.01331 0.9776 0.9784 9.26 0.9298 0.9106 WOA + CTSM 0.00159 0.00595 0.00510 0.01371 0.9686 0.9694 10.17 0.9102 0.8896 enables financial professionals to better anticipate market fluctuations, hedge effectively, and capitalize on arbitrage opportunities arising from FX-rate movements. The study provides substantive evidence that such hybrid deep learning and metaheuristic frameworks surpass traditional econometric models such as ARIMA and GARCH, which are often limited by assumptions of linearity and stationarity that fail under highly volatile market conditions.

In particular, the ability of the proposed method to adapt to nonstationary and nonlinear behaviors is highly valuable in modern financial markets characterized by rapid structural changes and global shocks. In practical terms, the enhanced forecasting capacity supports policymakers in stabilizing economies through proactive exchange-rate interventions and supports investors and businesses in mitigating exposure to currency risk. Extending this approach to other currency pairs, equities, commodities, and cryptocurrencies represents a promising avenue to broaden its applicability in finance.

Nonetheless, this study acknowledges limitations including the exclusion of exogenous macroeconomic and sentiment indicators, which can further enrich model inputs and context. Future research could integrate such multidimensional data sources to capture a fuller picture of market drivers. Furthermore, real-time deployment and scalability of the model remain challenges meriting investigation, as high-frequency trading environments demand rapid computation without loss of precision. In conclusion, the combination of deep learning with innovative metaheuristic optimization, especially the Ninja Optimization Algorithm, provides a powerful and practical tool for financial forecasting. Its applicability to volatile currency markets underlines its potential as an essential resource for policymakers, financial institutions, and investors navigating today’s complex economic landscape.

6. CONCLUSION

This paper presents a robust and comprehensive approach for forecasting the USD–PKR exchange rate by leveraging deep learning models enhanced with metaheuristic optimization techniques. Among the models tested, the Continuous-Time Sequence Model (CTSM) demonstrated superior baseline performance, establishing a strong foundation for further enhancements. The application of the binary Ninja Optimization Algorithm (bNiOA) for feature selection effectively reduced input dimensionality and eliminated redundant variables, resulting in significant improvements in model efficiency and predictive accuracy across all considered architectures.

Further, the integration of the Ninja Optimization Algorithm (NiOA) for hyperparameter tuning led to remarkable gains in forecasting precision, robustness, and stability. The NiOA-optimized CTSM consistently outperformed other metaheuristic-based configurations, confirming NiOA’s effectiveness in balancing exploration and exploitation within complex parameter spaces. These advances address critical challenges in financial time-series modeling, including high dimensionality, feature redundancy, and sensitivity to hyperparameter choices.

From a financial perspective, the enhanced predictive performance has substantial practical implications. Accurate and reliable exchange-rate forecasts enable policymakers to design timely and effective monetary interventions and exchange-rate management strategies, essential for economic stability. Financial institutions, investors, and multinational corporations can benefit through improved risk management, better hedging strategies, and optimized asset and portfolio allocation decisions. Moreover, the methodology’s adaptability suggests promising extensions to other areas within the financial domain, such as stock-price prediction, commodityprice forecasting, and the increasingly important cryptocurrency market. The capability to capture nonlinear, nonstationary, and volatile behaviors makes this framework particularly suited for modern financial markets characterized by rapid shifts and global interconnectivity.

Despite these achievements, the study identifies several avenues for future exploration, including incorporating additional macroeconomic and sentiment indicators to enrich the modeling context. Investigating more advanced hybrid deep learning architectures, such as LSTMs, GRUs, and Transformers, and developing hybrid or multi-objective metaheuristic optimizers could further refine forecasting accuracy and computational efficiency. Expanding the framework’s application

Figure 4. Density and KDE plots of key model performance metrics demonstrating distribution and reliability for financial forecasting.
Figure 4. Density and KDE plots of key model performance metrics demonstrating distribution and reliability for financial forecasting.
Figure 5. Box plots illustrating the central tendency and variability of performance metrics, providing insights into model robustness in financial contexts.
Figure 5. Box plots illustrating the central tendency and variability of performance metrics, providing insights into model robustness in financial contexts.

to real-time and streaming data scenarios and validating its performance across different geopolitical and economic environments would enhance its practical utility and generalizability.

In conclusion, this work establishes that the fusion of deep learning with innovative metaheuristic optimization, particularly the Ninja Optimization Algorithm, offers a powerful and scalable approach for financial time-series forecasting. It provides both theoretical insights and practical tools to support informed decision-making in volatile and complex currency markets, thereby contributing significantly to the advancement of financial forecasting methodologies.

References

[1] J. F. Pfahler, “Exchange rate forecasting with advanced machine learning methods,” Journal of Risk and Financial Management, vol. 15, no. 1, p. 2, 2022.

[2] P. Escudero, W. Alcocer, and J. Paredes, “Recurrent neural networks and ARIMA models for euro/dollar exchange rate forecasting,” Applied Sciences, vol. 11, no. 12, p. 5658, 2021.

[3] S. Naeem, W. K. Mashwani, A. Ali, M. I. Uddin, M. Mahmoud, F. Jamal, and C. Chesneau, “Machine learning-based USD/PKR exchange rate forecasting using sentiment analysis of twitter data,” Computers, Materials & Continua, vol. 67, no. 3, pp. 3451–3461, 2021.

[4] S. Akhtar, M. Ramzan, S. Shah, I. Ahmad, M. I. Khan, S. Ahmad, M. A. El-Affendi, and H. Qureshi, “Forecasting exchange rate of pakistan using time series analysis,” Mathematical Problems in Engineering, vol. 2022, no. 1, p. 9108580, 2022.

[5] R. Sabri, A. A. Abdul Rahman, A. Meero, L. A. Abro, and M. AsadUllah, “Forecasting turkish lira against the US dollars via forecasting approaches,” Cogent Economics & Finance, vol. 10, no. 1, p. 2049478, 2022.

[6] J. Wang, X. Wang, J. Li, and H. Wang, “A prediction model of CNN-TLSTM for USD/CNY exchange rate prediction,” IEEE Access, vol. 9, pp. 73 346–73 354, 2021.

[7] C. Maté and L. Jiménez, “Forecasting exchange rates with the iMLP: New empirical insight on one multilayer perceptron for interval time series,” Engineering Applications of Artificial Intelligence, vol. 104, p. 104358, 2021.

[8] M. Abd Elaziz, A. Dahou, L. Abualigah, L. Yu, M. Alshinwan, A. M. Khasawneh, and S. Lu, “Advanced metaheuristic optimization techniques in applications of deep neural networks: A review,” Neural Computing and Applications, vol. 33, no. 21, pp. 14 079–14 099, 2021.

[9] M. M. Kumbure, C. Lohrmann, P. Luukka, and J. Porras, “Machine learning techniques and data for stock market forecasting: A literature review,” Expert Systems with Applications, vol. 197, p. 116659, 2022.

[10] M. Yasir, M. Y. Durrani, S. Afzal, M. Maqsood, F. Aadil, I. Mehmood, and S. Rho, “An intelligent eventsentiment- based daily foreign exchange rate forecasting system,” Applied Sciences, vol. 9, no. 15, 2019.

[11] O. Wagdi, E. Salman, and H. Albanna, “Integration between technical indicators and artificial neural networks for the prediction of the exchange rate: Evidence from emerging economies,” Cogent Economics & Finance, vol. 11, no. 2, p. 2255049, 2023.

[12] P. K. Sarangi, M. Chawla, P. Ghosh, S. Singh, and P. K. Singh, “Forex trend analysis using machine learning techniques: INR vs USD currency exchange rate using ANN-GA hybrid approach,” Materials Today: Proceedings, vol. 49, pp. 3170–3176, 2022.

[13] E. Y. Matsumoto, E. Del-Moral-Hernandez, C. E. Yoshinaga, and A. d. C. Pinto, “Forecasting US dollar exchange rate movement with computational models and human behavior,” Expert Systems with Applications, vol. 194, p. 116521, 2022.

[14] G. Singh, P. K. Sarangi, L. Rani, K. Sharma, S. Sinha, A. K. Sahoo, and B. P. Rath, “CNN-RNN based hybrid machine learning model to predict the currency exchange rate: USD to INR,” in 2022 2nd International Conference on Advance Computing and Innovative Technologies in Engineering, 2022, pp. 1668–1672.

[15] M. A. Saeed and A. Jamil, “Stock price prediction in response to US dollar exchange rate using machine learning techniques,” in International Conference on Computing, Intelligence and Data Analytics. Springer, 2022, pp. 281–290.

[16] K.-M. Wang and Y.-M. Lee, “Is gold a safe haven for exchange rate risks? an empirical study of major currency countries,” Journal of Multinational Financial Management, vol. 63, p. 100705, 2022.

[17] M. Pirani, P. Thakkar, P. Jivrani, M. H. Bohara, and D. Garg, “A comparative analysis of ARIMA, GRU, LSTM and BiLSTM on financial time series forecasting,” in 2022 IEEE International Conference on Distributed Computing and Electrical Circuits and Electronics, 2022, pp. 1–6.

[18] A. Saliminezhad and P. Bahramian, “The role of financial stress in economic activity: Fresh evidence from a granger-causality-in-quantiles analysis for the UK and germany,” International Journal of Finance & Economics, vol. 26, no. 2, pp. 1670–1680, 2021.