# ML-Based Interconnected Affecting Factors with Supporting Matrices for Assessment of Risk in Stock Market

Authors: Bhupinder Singh; Santosh Kumar Henge; Amit Sharma; C. Menaka; Pawan Kumar; Sanjeev Kumar Mandal; Baru Debtera
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

In today’s world, people study and evaluate trading stocks to make informed decisions, based on available financial data and market information. Previous researchers relied on trend identification before making any decision to buy or sell stocks but fail to make accurate decisions due to complex systems. Some studies showed analysis to apply to stop loss on every stock transaction that got wrong levels due to limited features scaling that relied on single indicators without checking the performance metrics such as mean, standard deviation, and value at risk. Some existing models are based on theoretical implementation and they possess inaccurate success in real-time stock market transactions. Earlier risk management techniques were based on fundamental statistics of the company performance based on specific quarters that propose the future expects in the positive direction that is not every true which results in huge financial loss. Previous researchers failed to consider dynamic risk management parameters to ensure minimum loss for decision-making in fast-moving stock variations. Machine learning simply refers to learning about computers and making predictions from data. Identifying and analyzing the risk factors in the stock market are the major and crucial stage for predicting the company stock values at the national and international levels. In existing research, all risk management-related factors are analyzed based on fundamental statistics of the company performance which are measured as quarterly results, which will not give long-term true predictions and will not provide positive directions to invest in further stocks. This research majorly focused on risk management for national stock companies using the machine learning methodology and algorithms. The objective is to determine if stock market indicators are suitable decision-aid tools within the context of intraday risk management. The review of the literature revealed that while there are many studies looking to foresee changes in the stock market, there are few studies looking to improve stock market risk management methods using machine learning algorithms. The goal of this study was to fill this gap by utilizing the body of existing research on stock index forecasting combined with machine learning techniques for both short- and long-term risk managements. It has described the association between machine learning models and implicated the data with respect to discrete models based on supportive, dependable, nondependable parameters along with the name and type of the stock. This research has integrated a few crucial dependable parameters such as oil prices, on-hand projects, and future projects. It has integrated with the simple, multiple linear regression models to generate a signal for SPY growth. The proposed ML-based model has been evaluated by comparing two states of training and testing and achieved 96.3% of accuracy. The parameters used for evaluation are closing price, price differences, and daily return. The performance range of the proposed multiple regression model lies along the maximum drawn down which is 0.04411 for test cases and 1.2533 for training cases. Compare the performance of the proposed approach with that existing models with respect to the number of keys and methods associated with training and testing the data.


---

## Body

## 1. Introduction

The software developers are integrating the tools with machine learning (ML) abilities incorporated into them. Even inexperienced users can build ML models for their relevant research problems using ML tools. However, a popular model of the superior ML replicas behaves like a black box in the sense that their performance is not easily interpretable by humans; due to this, lack of human interpretability acts as a hurdle toward receipt and subsequent deployment of ML solutions [1]. The stock analysis is commonly conducted in two types: fundamental research and technical research. Fundamental research is aimed at understanding the financial statements of the company and is based on indicators such as ROE, DER, EPS, and PE, which provide a real value at which stock should ideally be traded in the market. Technical research concerns the study of past share prices to predict future price trends [2]. Initially, import the libraries. Furthermore, it is required to install y-finance and Yahoo-Financials (YF). Download up-to-date information on technology stocks using y-finance. The authors will develop the prototype involving numerous global market evidences and forecast price change in SPY. The author implements the first technique called “Price Difference” and “Daily Return” parameters. Then, the biggest challenge is to find a better signal for trading. Evaluate your shared strategy performance. The second technique is focused on the regression model using decline metrics and measures of risk. The method of risk calculation is based on a time restriction. Estimate the average return using a confidence interval [3]. The third technique used is the multiple regression model based on price variation affecting factors [4].The literature evaluation discovered that there is a large number of research seeking to forecast moves within side the stock market; however, there is a loss of literature seeking to enhance stock market risk management techniques with machine learning strategies. The contribution of this research fills this hole by making use of the existing frame of literature in stock index forecasting with machine learning strategies in the domain of intraday and long-term risk control. Compared to long-term investments or even short-term trades, intraday trading carries a greater risk. Stock prices fluctuate within price ranges, with a support at the lower end and a resistance at the top. In order to stop further losses, you sell your shares at a stop loss price. This ought to be set at a cost below the point at which further losses are anticipated to occur. Similar to this, one should decide on a price to sell at a profit or take profit as it is known in the market. This is typically placed next to a resistance. The formula for expected return isprobabilityoftakeprofit∗profitatthatprice−probabilityofstoploss∗lossatthatprice. Select the stocks with the highest expected return values by comparing the projected returns of various equities. Expert traders advise exposing a trader no more than 1-2 times their capital.The primary aim of this study is to evaluate whether or not stock market indicators are appropriate choice help tools within side the domain of intraday risk management. Two hypotheses had been said to be able to deal with the study’s problem. These hypotheses are restated in the following sections, and an answer to the subsequent studies query can be given. “Can dependable parameters be used to enhance the effectiveness of dynamic hedging techniques within side the Indian stock market with respect to international financial markets?”


## 2. Related Work

Previous researchers relied on trend identification before making any decision to buy or sell stocks but fail to make accurate decisions due to complex systems. Some studies showed analysis to apply to stop loss on every stock transaction that got wrong levels due to limited features scaling that relied on single indicators without checking the performance metrics such as mean, standard deviation, and value at risk. Moreover, many proposed models are based on theoretical implementation, and they possess inaccurate success in real-time stock market transactions. Earlier risk management techniques were based on fundamental statistics of the company performance based on specific quarters that propose the future expects in the positive direction that is not every true which results in huge financial loss.Evans [5] focused on performance that imparts an upward direction due to fund age and fundamental analysis of companies to invest in mutual funds. Cremers et al. [6] calibrated an operational mutual fund administration in the hands of portfolio managers based on technical aspects related to ratios. Berger et al. [7] provided evidence on the association between aggregate uncertainty and the worldwide macroeconomy in accordance with implied volatility. Kryzanowski et al. [8] declared an oligopoly model of simultaneous trading in LCDS real-time stock transactions and observed symmetry involving association for imperative agents to adapt contrasting placements in volatile multiple stock transactional scenarios. Saxena et al. [9] learned the contribution of emotional feelings of investors on digital print writing on different websites on economic downturn of the secondary worldwide stock speed transactions during COVID-19 scenario. Mazur et al. [10] examined carefully the US stock market evaluation during the downtrend in March 2020 and observe that open-air gas, eatable items, and medical and technology stocks gain maximum unexpected returns, whereas stock price values in petrol or diesel, infrastructure, and hotel chain stocks sectors declined eventually. Huang et al. [11] proposed an assumption of recognition to investigate how people are forced to react to insider activities of companies with respect to mutual fund market reputation and its accomplishment is committed by its knowledge supremacy, which can be taken into possession but drawdown specifically.This strategy looks promising, but there are many questions if you want to implement it in the real market. Can we find a better signal for trading? How do you correctly evaluate your shared strategy performance? This research has composed of three major objectives such as the following: to study the role of dependable and nondependable interrelated affecting factors on the stock market investing or trading, to analyze the impact of global market volatility on the national stock exchange price fluctuations, and to evaluate the performance of the desired experiments on the basis of metrics such as RMSE, R2-Score, Sharpe Ratio, and Maximum Drawdown.


## 3. Proposed Methodology

A method for developing and benchmarking hedging techniques for a bunch of stocks is evolved and distinct in the technique phase. In addition, its miles explained how the effectiveness of hedging techniques may be measured in order for its miles to be feasible to evaluate the blessings of the usage of machine learning strategies quantitatively. The technique phase affords a manual of way to study’s query. This study will analyze whether or not techniques used to predict moves inside the stock index also can be used to derive hedging techniques and enhance the overall risk-return trade-off an investor’s faces. Figure1 explains the proposed methodology for the risk management procedure. Data collection and preprocessing are the first steps in the procedure before the data is fed into a machine learning model. Market and textual data are typically the two forms of data that the prediction models use.Figure 1
Proposed methodology for the risk management procedure.Losses are reduced with the support of risk management. Additionally, it can prevent trader’s accounts from losing all of their funds. When traders lose money, there is risk. Traders have the potential to profit on the market if they can manage their risk. Risk management is the process of analyzing prospective losses from investments made by investors and taking any necessary steps to reduce the likelihood that such losses will occur. Risk management is becoming a crucial component of the trading techniques utilized by investors. Risk and return have a significant link in the stock market. In general, higher risk equals higher return! Risk management is the process of recognising and evaluating the risk, followed by the development of strategies to manage and minimize the same, according to financial language.


### 3.1. Technical Analysis

Volatility buying and selling include predicting the steadiness of a stock’s value. Instead of buying and selling at the rate of growing or falling, buyers take a role in whether or not it is going to pass in any direction.


#### 3.1.1. Technical Analysis Using Moving Average

It is a simple, customizable technical analysis tool used to identify the direction of a stock’s trend. The short-term moving average is most closely associated with the recent change in the stock price [10], which we call a “fast signal.” The long-term moving average reflects the change in price over the long-term history, which we call the “slow signal.” It is indicated as a customizable indicator, as there is no particular reference time frame, therefore considered here 20 and 60 days for the calculation of the moving averages “MA20” and “MA60.” MA20 and MA60 were created, which are fast signals [12] and slow signals, respectively.So, we have plotted the closing price, MA20, and MA60. If MA20 is greater than MA60, the share price is expected to rise in the next few days. Otherwise, the price will decrease. Our strategy is that if MA20 is greater than MA60, we will buy and hold a share. Alternatively, we will long launch a share of shares. It is required to calculate the daily profit. First, create the “Close1” variable, which is tomorrow’s closing price. We will then create the “Profit” variable, which is actually the daily profit [13]. The SMA equation is classified in
(1)SMAK=1k∑i=n−k+1nPi,where P1,P2,⋯,Pn are the data points and k entries of the dataset.Figure2 explains the wealth plot that shows the growth of profit over period. Before diving into the strategy, let us consider some assumptions. To estimate the profit, we must initially purchase a share of the shares. Hence, our investment is a first-day stock price. Stock analysis periodic time runs from “2020-01-01,” and yes we can download stock historical data from stock launch/market listing day. From all the data available on tech stocks, following the python zen “simple is better than complex”, he created this strategy only for the “HDFCBANK.NS” ticker, which is the largest banking company. This strategy applies to any stock market share. We create new “price difference” and “daily return” columns, which measure the price disputation linking the closing stock values of successive time intervals and also the daily returns of the stock. In the new “Direction” column using list comprehension, if the price difference is >0, then 1, else 0. The price difference on 2020-11-11 is -18.25, so directions are 0.Figure 2
Wealth plot showing the growth of profit over the period.


#### 3.1.2. Technical Analysis Using Bollinger Bands

A Bollinger Band is a volatility indicator primarily based totally on primarily based totally at the correlation between the regular distribution and price rate and may be used to attract assist and resistance curves. It is depicted using a rigid set of traces that are plotted widely apart from an easy transferring common (SMA) of the stock's rate, but may be altered to suit customer preferences.(2)BOLU=MATP,n+m∗σTP,n,(3)BOLD=MATP,n+m∗σTP,n,where BOLU is the upper Bollinger Band, BOLD is the lower Bollinger Band, MA is the moving average,
(4)TP=HIGH+LOW+CLOSE÷3,n is the number of days in a smoothing period, m is the number of standard deviations, and σTP.n is the standard deviations over last n periods of TP.By default, it calculates a 20-duration SMA (the center band), top band widespread deviations above the transferring common, and decreased band widespread deviations under it. If the rate actions above the top band this will imply a terrific time to sell, and if its actions under the band decrease, it may be a terrific time to buy. Despite 90% of the price rate movement occurring among the bands, however, a breakout is not always a buying and selling sign because it affords no clue as to the route and quantity of future destiny rate movement as described in Figure3.Figure 3
Analytical description of Bollinger band, close price, MA, and trading signals for HDFC Bank.


#### 3.1.3. Technical Analysis Using Mean and Standard Deviation

CDF is the function that maps the value to their percentile rank in a distribution. Here, CDF returns the probability and the underside of the area. Figures4 and 5 shows the analytical explanation of how the mean and standard deviation are calculated.Figure 4
Analytical description of computation of the mean and the standard deviation.Figure 5
Analytical description of HDFC Bank correlation in terms of OHCL parameters.The study needs sovereignty while calculating divergence. In the likelihood of the share price falling over a period of the year, typically, a stock market operates for 252 days and the equation of standard deviation is mentioned in the following equation:(5)s=1N−1∑I=1Nxi−x¯2,where N−1 is shown by the degree of freedom and x1−x¯⋯,xn−x¯ are considered deviations from the mean.Table1 shows the probability drop in stock price of HDFC Bank.Table 1
Probability of drop in stock price over a period of the year (typically a stock market operates for 252 days).
HDFC Bank drop value rangeProbabilityDrop of the stock price up to 10% over a day2.4910644826891264e−06Drop up to 20% over a period of year0.1788843480050356Drop up to 40% over a period of year0.0678399289198262


#### 3.1.4. Technical Analysis Using Value at Risk (VAR)

The value at risk is implemented by risk executives to evaluate the supremacy of the degree of risk that the company assumes. In the financial sphere, it is a paramount metric of risk “value of risk.” Estimating in what way to put down financing could bear financial drawdown with a given chance of better decision-making. Calculate the percentage of risk of loss on your investment over a period. 5% of the daily return bivariate is called 95% success chances. The study uses a trend following pattern to obtain a 5% bivariate which is a rejection of nearly 0.03. Therefore, 95% of the VAR is nearly 0.03, which anticipates a 5% probability that the intraday return is below a level than -3%.Table2 shows the calculation of the percentage of loss risks relative to an investment over time.Table 2
Calculation of the percentage of risks of losing over the investment over a period.
Percentage changeProbability of dropBivariate 25%-0.01436327574625389Bivariate 75%0.015325937193231672Var-value at risk-0.03571967127146412Is it secure to implement the favorable detail to forecast inventory returns? The distributions of intraday and bimonthly positive profits are quite symmetrical to averages as compared to larger tails. The queue comes back negative, as well as positive; it can happen more often than we expect [14]. The estimation of the average returns using the confidence interval. Intuitively, if a small quantity is a good representative of the group, the group dataset mean should be close to the sample mean. It is plausible to say that the population means is in an interval with the sample mean-centered. Hence, our task is to estimate the population means using the range with the lower and upper bounds. To begin with, we need to standardize the sample mean because a different sample has a different mean and standard deviation. It can standardize the sample mean by subtracting the mean, which is identical to the group mean, and then dividing it by its standard deviation, which is distinguished by the square root of the dataset size [9]. Tables 3 and 4 describes the confidence interval’s Log return column.Table 3
Describes the Log return column for the confidence interval.
Estimating the average return using a confidence intervalConfidence intervals for this distributionLog return column will be used here for a 90% confidence interval-0.0012083873470241408Confidence intervals for this distribution0.0021710487940019224Table 4
Description of performance evaluation of simple regression model.
RMSEMAEMSER2 scoreAdjustedR28.2821457783596.29114834754168.5939386939910.9985834885820.9985392226005


#### 3.1.5. Technical Analysis: A Novel Approach Based on the Price Fluctuate Method

This method is focusing on the evaluation on the basis of two performance metrics based on Sharpe Ratio and Maximum Drawdown. The first phase involved visualizing the profit of training data on the number of quantity of shares, and the second phase is associated with calculating the profit of testing data shown in Algorithm1.Algorithm 1: Price fluctuate method.
Input : company stocks , PredictedYfor i in company_stocks(0,1) doTrain data and Daily profit is computed in the column profit.Order = [1 if signal > 0 else -1 for signal in Train['PredictedY']]Place buy order for signal 1 else sell order for -1Profit = Train['company_stock']∗ Train['Order']Wealth = Train['Profit'].cumsum()Test data and Proft of price fluctation methodOrder = [1 if sig >0 else -1 for sig in Test['PredictedY']]Place buy order for sig 1 else sell order for -1Profit = Test['company_stock']∗ Test['Order']Wealth = Test['Profit'].cumsum()End forFunction performance()For i in index[0]doInclude The initial investment which is one price of company_stock.Compute Sharpe Ratio on Train data and Test dataOutput : Daily (dailyr.mean()/dailyr.std(ddof=1))Evaluate Maximum Drawdown in Train data and Maximum Drawdown in Test dataOutput : (['Drawdown'].max())End forReturn OutputEnd function


### 3.2. Regression Modeling

The authors have developed the prototype of the process of simulation regarding the return on stocks using conventional random features. It is important to know the distribution. Thus, it is certainly critical in risk or probability administration.


#### 3.2.1. Simple Regression Model

An inferential statistic depends on bivariate calculations and the cumulative distribution function, when constructing confidence levels or for implementing the hypothesis test. Evaluating the probability density function for a particular value is not useful; norm.pdf measures the probability for every possible value of an attainable random feature. Besides, the credible random feature can assume desirability from an optimistic trend to a negative trend. Two specifications 0 and 1 in normalization imparted the average and conventional deviation of a regular random feature, and the author can interchange these multiple principles to get a discrete normal feature. The solidity assignment of a standard variable is related exclusively to their average and their divergence [15, 16].We can clearly see that all the independent variables are linearly affecting our dependent variable. We model the daily return of stocks using the ordinary deposition. From the enormous cluster of irregular data returned by historical series of data, the authors will calculate the average and standard divergence [7]. A sufficiently extreme outlier is more likely to be an error than a genuine extreme result (how extreme will depend on the details—people often just choose a fairly arbitrary number of standard deviations, but you should take into consideration how likely errors are with your methodology including errors when running the regression will result in an incorrect trend line, so they will be excluded). Research needs to keep that in mind when using the trend line to make your predictions [14].Machine learning simply refers to learning about computers and making predictions from data. Linear regression does this, as more data improves its predictive ability [17–22]. Although other methods like SVM and neural networks are more generally thought of as machine learning, these algorithms actually boil down to minimizing a cost function from a model, as linear regression does. Progressive push is a supervised learning-based ML algorithm that can be instructed to forecast output existent numbers. Obtain the feature guess as a methodology that is based on some hidden parameters and input values [15, 16]. Table 5 explains how machine learning models are related to data implications for discrete models.Table 5
Description of the association between machine learning models and data implications with respect to discrete models.
ML model vs. data implicationsSimple regression modelMultiple regression modelStock nameHDFC BankSpy, Spy_Lag1, Sp500, Nasdaq, Dji, Cac40, Daxi, Hsi, Nikkei, AordType of dataContinuous series of dataContinuous series of dataMajor parametersR2 score, RMSESharpe Ratio, Maximum DrawdownDependable parametersNumber of Loans In hand (NLH), Invested Budget (IB), Number of Loans take over in the future (NLTF)Oil Prices (OP), War inside Country (WiC), Brand image Worldwide (BIW), Gold Reserves (GR)Nondependable parametersManpower (MP), Electronic Prices (EP)Company CEO instability (C-CEO-I), Political crises (PC)


#### 3.2.2. Multiple Regression Models

This research has applied multiple linear regression models to generate a signal for SPY growth. With the help of multiple regression analysis, researchers can evaluate the significance of each predictor to the relationship as well as the strength of the relationship between an outcome (the dependent variable) and the predictors, frequently with the effect of other predictors statistically eliminated. A method that is more precise than ordinary linear regression is multiple linear regression. Simple linear regression can effectively capture the relationship between the two variables in cases with straightforward relationships. Multiple linear regression is frequently preferable for more complicated relationships that call for greater consideration. The benefits of this strategy include the possibility that it will result in a more exact understanding of each person’s association. The most interesting part is that we will see the pattern using multiple global market indices and predict the price change of SPY. The reason for choosing SPY as a target to view the regression model is because it is very suitable for frequent trading. The volatility of SPY is very high. The double-digit gain and loss run often appears. Multiple linear regressions will have multiple predictors. Our response variable is SPY’s opening price tomorrow minus today’s opening. With this response, we expect to make a morning forecast on the US market. Based on the forecast of the price change, we decide whether to go long or short. Here, in total, we have eight predictors. We cannot use any information available after a US market opens on the current day to calculate forecast values. In other words, these variables cannot be predictive. We will have three groups of predictors.The first group is a one-day lag variable from the “US” market. Open minus the last day’s opening price for SPY, Sp500, Nasdaq, and Dji. The second group is a one-day lagging variable from the “European” markets. Open minus the last day opening price for Cac40 and Daxi. Ideally, for European markets, we want to use the midday price minus the opening price. If you have intraday data, you can improve this model. However, Yahoo Finance does not provide intraday data [23]. Next, we will collect the data to get all these predictors and the answer. First, we generate an empty data frame and let the index be the same as the SPY index. Then, let us add the content of the response and the predictors we defined. Note, in the last closing line, we keep a record of the SPY opening price. Table 6 shows the relation of the number of lags and correlation to the international markets.Table 6
Relation of international markets with respect to the number of lags and correlation.
International marketsNumber of lagsCorrelationSpy11.000000Spy_Lag11-0.074537Sp5001-0.019273Nasdaq1-0.066339Dji1-0.034198Cac404-0.038057Daxi8-0.033772Hsi21-0.030826Nikkei32-0.027551Aord7-0.009840Figure6 shows the analysis of a comparison chart showing the correlation and number of lags between several global markets. It has found missing values. This is due to two reasons. When we calculate the price change, we can generate a NaN value in the first row, one day late, and in the last row, one day in the future. In different markets, they may have different holidays when the markets are closed. It can be shown by calculating the numbers of NaN values in each column. We find that the Australian markets appear to have more holidays. We need to handle the NaN values before viewing the model [23]. First, we use the fill-forward method to fill gaps in the data frame by propagating the last valid observation forward to the next valid one. Second, let us delete the first line using dropna. We find that the predictors for the European and Asian markets have an association with SPY, which has a greater impact than the predictors for the US markets [24].
(6)R2Score=1−RSSTSS.Figure 6
Analytical description of comparative chart of the number of lags and correlation of different international markets.R2 is considered to be coefficient of determination, RSS is defined by sum of squares of residuals, and TSS is the total sum of squares.
(7)RMSE=∑i=1ny∧i−yi2n.


## 3.1. Technical Analysis

Volatility buying and selling include predicting the steadiness of a stock’s value. Instead of buying and selling at the rate of growing or falling, buyers take a role in whether or not it is going to pass in any direction.


### 3.1.1. Technical Analysis Using Moving Average

It is a simple, customizable technical analysis tool used to identify the direction of a stock’s trend. The short-term moving average is most closely associated with the recent change in the stock price [10], which we call a “fast signal.” The long-term moving average reflects the change in price over the long-term history, which we call the “slow signal.” It is indicated as a customizable indicator, as there is no particular reference time frame, therefore considered here 20 and 60 days for the calculation of the moving averages “MA20” and “MA60.” MA20 and MA60 were created, which are fast signals [12] and slow signals, respectively.So, we have plotted the closing price, MA20, and MA60. If MA20 is greater than MA60, the share price is expected to rise in the next few days. Otherwise, the price will decrease. Our strategy is that if MA20 is greater than MA60, we will buy and hold a share. Alternatively, we will long launch a share of shares. It is required to calculate the daily profit. First, create the “Close1” variable, which is tomorrow’s closing price. We will then create the “Profit” variable, which is actually the daily profit [13]. The SMA equation is classified in
(1)SMAK=1k∑i=n−k+1nPi,where P1,P2,⋯,Pn are the data points and k entries of the dataset.Figure2 explains the wealth plot that shows the growth of profit over period. Before diving into the strategy, let us consider some assumptions. To estimate the profit, we must initially purchase a share of the shares. Hence, our investment is a first-day stock price. Stock analysis periodic time runs from “2020-01-01,” and yes we can download stock historical data from stock launch/market listing day. From all the data available on tech stocks, following the python zen “simple is better than complex”, he created this strategy only for the “HDFCBANK.NS” ticker, which is the largest banking company. This strategy applies to any stock market share. We create new “price difference” and “daily return” columns, which measure the price disputation linking the closing stock values of successive time intervals and also the daily returns of the stock. In the new “Direction” column using list comprehension, if the price difference is >0, then 1, else 0. The price difference on 2020-11-11 is -18.25, so directions are 0.Figure 2
Wealth plot showing the growth of profit over the period.


### 3.1.2. Technical Analysis Using Bollinger Bands

A Bollinger Band is a volatility indicator primarily based totally on primarily based totally at the correlation between the regular distribution and price rate and may be used to attract assist and resistance curves. It is depicted using a rigid set of traces that are plotted widely apart from an easy transferring common (SMA) of the stock's rate, but may be altered to suit customer preferences.(2)BOLU=MATP,n+m∗σTP,n,(3)BOLD=MATP,n+m∗σTP,n,where BOLU is the upper Bollinger Band, BOLD is the lower Bollinger Band, MA is the moving average,
(4)TP=HIGH+LOW+CLOSE÷3,n is the number of days in a smoothing period, m is the number of standard deviations, and σTP.n is the standard deviations over last n periods of TP.By default, it calculates a 20-duration SMA (the center band), top band widespread deviations above the transferring common, and decreased band widespread deviations under it. If the rate actions above the top band this will imply a terrific time to sell, and if its actions under the band decrease, it may be a terrific time to buy. Despite 90% of the price rate movement occurring among the bands, however, a breakout is not always a buying and selling sign because it affords no clue as to the route and quantity of future destiny rate movement as described in Figure3.Figure 3
Analytical description of Bollinger band, close price, MA, and trading signals for HDFC Bank.


### 3.1.3. Technical Analysis Using Mean and Standard Deviation

CDF is the function that maps the value to their percentile rank in a distribution. Here, CDF returns the probability and the underside of the area. Figures4 and 5 shows the analytical explanation of how the mean and standard deviation are calculated.Figure 4
Analytical description of computation of the mean and the standard deviation.Figure 5
Analytical description of HDFC Bank correlation in terms of OHCL parameters.The study needs sovereignty while calculating divergence. In the likelihood of the share price falling over a period of the year, typically, a stock market operates for 252 days and the equation of standard deviation is mentioned in the following equation:(5)s=1N−1∑I=1Nxi−x¯2,where N−1 is shown by the degree of freedom and x1−x¯⋯,xn−x¯ are considered deviations from the mean.Table1 shows the probability drop in stock price of HDFC Bank.Table 1
Probability of drop in stock price over a period of the year (typically a stock market operates for 252 days).
HDFC Bank drop value rangeProbabilityDrop of the stock price up to 10% over a day2.4910644826891264e−06Drop up to 20% over a period of year0.1788843480050356Drop up to 40% over a period of year0.0678399289198262


### 3.1.4. Technical Analysis Using Value at Risk (VAR)

The value at risk is implemented by risk executives to evaluate the supremacy of the degree of risk that the company assumes. In the financial sphere, it is a paramount metric of risk “value of risk.” Estimating in what way to put down financing could bear financial drawdown with a given chance of better decision-making. Calculate the percentage of risk of loss on your investment over a period. 5% of the daily return bivariate is called 95% success chances. The study uses a trend following pattern to obtain a 5% bivariate which is a rejection of nearly 0.03. Therefore, 95% of the VAR is nearly 0.03, which anticipates a 5% probability that the intraday return is below a level than -3%.Table2 shows the calculation of the percentage of loss risks relative to an investment over time.Table 2
Calculation of the percentage of risks of losing over the investment over a period.
Percentage changeProbability of dropBivariate 25%-0.01436327574625389Bivariate 75%0.015325937193231672Var-value at risk-0.03571967127146412Is it secure to implement the favorable detail to forecast inventory returns? The distributions of intraday and bimonthly positive profits are quite symmetrical to averages as compared to larger tails. The queue comes back negative, as well as positive; it can happen more often than we expect [14]. The estimation of the average returns using the confidence interval. Intuitively, if a small quantity is a good representative of the group, the group dataset mean should be close to the sample mean. It is plausible to say that the population means is in an interval with the sample mean-centered. Hence, our task is to estimate the population means using the range with the lower and upper bounds. To begin with, we need to standardize the sample mean because a different sample has a different mean and standard deviation. It can standardize the sample mean by subtracting the mean, which is identical to the group mean, and then dividing it by its standard deviation, which is distinguished by the square root of the dataset size [9]. Tables 3 and 4 describes the confidence interval’s Log return column.Table 3
Describes the Log return column for the confidence interval.
Estimating the average return using a confidence intervalConfidence intervals for this distributionLog return column will be used here for a 90% confidence interval-0.0012083873470241408Confidence intervals for this distribution0.0021710487940019224Table 4
Description of performance evaluation of simple regression model.
RMSEMAEMSER2 scoreAdjustedR28.2821457783596.29114834754168.5939386939910.9985834885820.9985392226005


### 3.1.5. Technical Analysis: A Novel Approach Based on the Price Fluctuate Method

This method is focusing on the evaluation on the basis of two performance metrics based on Sharpe Ratio and Maximum Drawdown. The first phase involved visualizing the profit of training data on the number of quantity of shares, and the second phase is associated with calculating the profit of testing data shown in Algorithm1.Algorithm 1: Price fluctuate method.
Input : company stocks , PredictedYfor i in company_stocks(0,1) doTrain data and Daily profit is computed in the column profit.Order = [1 if signal > 0 else -1 for signal in Train['PredictedY']]Place buy order for signal 1 else sell order for -1Profit = Train['company_stock']∗ Train['Order']Wealth = Train['Profit'].cumsum()Test data and Proft of price fluctation methodOrder = [1 if sig >0 else -1 for sig in Test['PredictedY']]Place buy order for sig 1 else sell order for -1Profit = Test['company_stock']∗ Test['Order']Wealth = Test['Profit'].cumsum()End forFunction performance()For i in index[0]doInclude The initial investment which is one price of company_stock.Compute Sharpe Ratio on Train data and Test dataOutput : Daily (dailyr.mean()/dailyr.std(ddof=1))Evaluate Maximum Drawdown in Train data and Maximum Drawdown in Test dataOutput : (['Drawdown'].max())End forReturn OutputEnd function


## 3.1.1. Technical Analysis Using Moving Average

It is a simple, customizable technical analysis tool used to identify the direction of a stock’s trend. The short-term moving average is most closely associated with the recent change in the stock price [10], which we call a “fast signal.” The long-term moving average reflects the change in price over the long-term history, which we call the “slow signal.” It is indicated as a customizable indicator, as there is no particular reference time frame, therefore considered here 20 and 60 days for the calculation of the moving averages “MA20” and “MA60.” MA20 and MA60 were created, which are fast signals [12] and slow signals, respectively.So, we have plotted the closing price, MA20, and MA60. If MA20 is greater than MA60, the share price is expected to rise in the next few days. Otherwise, the price will decrease. Our strategy is that if MA20 is greater than MA60, we will buy and hold a share. Alternatively, we will long launch a share of shares. It is required to calculate the daily profit. First, create the “Close1” variable, which is tomorrow’s closing price. We will then create the “Profit” variable, which is actually the daily profit [13]. The SMA equation is classified in
(1)SMAK=1k∑i=n−k+1nPi,where P1,P2,⋯,Pn are the data points and k entries of the dataset.Figure2 explains the wealth plot that shows the growth of profit over period. Before diving into the strategy, let us consider some assumptions. To estimate the profit, we must initially purchase a share of the shares. Hence, our investment is a first-day stock price. Stock analysis periodic time runs from “2020-01-01,” and yes we can download stock historical data from stock launch/market listing day. From all the data available on tech stocks, following the python zen “simple is better than complex”, he created this strategy only for the “HDFCBANK.NS” ticker, which is the largest banking company. This strategy applies to any stock market share. We create new “price difference” and “daily return” columns, which measure the price disputation linking the closing stock values of successive time intervals and also the daily returns of the stock. In the new “Direction” column using list comprehension, if the price difference is >0, then 1, else 0. The price difference on 2020-11-11 is -18.25, so directions are 0.Figure 2
Wealth plot showing the growth of profit over the period.


## 3.1.2. Technical Analysis Using Bollinger Bands

A Bollinger Band is a volatility indicator primarily based totally on primarily based totally at the correlation between the regular distribution and price rate and may be used to attract assist and resistance curves. It is depicted using a rigid set of traces that are plotted widely apart from an easy transferring common (SMA) of the stock's rate, but may be altered to suit customer preferences.(2)BOLU=MATP,n+m∗σTP,n,(3)BOLD=MATP,n+m∗σTP,n,where BOLU is the upper Bollinger Band, BOLD is the lower Bollinger Band, MA is the moving average,
(4)TP=HIGH+LOW+CLOSE÷3,n is the number of days in a smoothing period, m is the number of standard deviations, and σTP.n is the standard deviations over last n periods of TP.By default, it calculates a 20-duration SMA (the center band), top band widespread deviations above the transferring common, and decreased band widespread deviations under it. If the rate actions above the top band this will imply a terrific time to sell, and if its actions under the band decrease, it may be a terrific time to buy. Despite 90% of the price rate movement occurring among the bands, however, a breakout is not always a buying and selling sign because it affords no clue as to the route and quantity of future destiny rate movement as described in Figure3.Figure 3
Analytical description of Bollinger band, close price, MA, and trading signals for HDFC Bank.


## 3.1.3. Technical Analysis Using Mean and Standard Deviation

CDF is the function that maps the value to their percentile rank in a distribution. Here, CDF returns the probability and the underside of the area. Figures4 and 5 shows the analytical explanation of how the mean and standard deviation are calculated.Figure 4
Analytical description of computation of the mean and the standard deviation.Figure 5
Analytical description of HDFC Bank correlation in terms of OHCL parameters.The study needs sovereignty while calculating divergence. In the likelihood of the share price falling over a period of the year, typically, a stock market operates for 252 days and the equation of standard deviation is mentioned in the following equation:(5)s=1N−1∑I=1Nxi−x¯2,where N−1 is shown by the degree of freedom and x1−x¯⋯,xn−x¯ are considered deviations from the mean.Table1 shows the probability drop in stock price of HDFC Bank.Table 1
Probability of drop in stock price over a period of the year (typically a stock market operates for 252 days).
HDFC Bank drop value rangeProbabilityDrop of the stock price up to 10% over a day2.4910644826891264e−06Drop up to 20% over a period of year0.1788843480050356Drop up to 40% over a period of year0.0678399289198262


## 3.1.4. Technical Analysis Using Value at Risk (VAR)

The value at risk is implemented by risk executives to evaluate the supremacy of the degree of risk that the company assumes. In the financial sphere, it is a paramount metric of risk “value of risk.” Estimating in what way to put down financing could bear financial drawdown with a given chance of better decision-making. Calculate the percentage of risk of loss on your investment over a period. 5% of the daily return bivariate is called 95% success chances. The study uses a trend following pattern to obtain a 5% bivariate which is a rejection of nearly 0.03. Therefore, 95% of the VAR is nearly 0.03, which anticipates a 5% probability that the intraday return is below a level than -3%.Table2 shows the calculation of the percentage of loss risks relative to an investment over time.Table 2
Calculation of the percentage of risks of losing over the investment over a period.
Percentage changeProbability of dropBivariate 25%-0.01436327574625389Bivariate 75%0.015325937193231672Var-value at risk-0.03571967127146412Is it secure to implement the favorable detail to forecast inventory returns? The distributions of intraday and bimonthly positive profits are quite symmetrical to averages as compared to larger tails. The queue comes back negative, as well as positive; it can happen more often than we expect [14]. The estimation of the average returns using the confidence interval. Intuitively, if a small quantity is a good representative of the group, the group dataset mean should be close to the sample mean. It is plausible to say that the population means is in an interval with the sample mean-centered. Hence, our task is to estimate the population means using the range with the lower and upper bounds. To begin with, we need to standardize the sample mean because a different sample has a different mean and standard deviation. It can standardize the sample mean by subtracting the mean, which is identical to the group mean, and then dividing it by its standard deviation, which is distinguished by the square root of the dataset size [9]. Tables 3 and 4 describes the confidence interval’s Log return column.Table 3
Describes the Log return column for the confidence interval.
Estimating the average return using a confidence intervalConfidence intervals for this distributionLog return column will be used here for a 90% confidence interval-0.0012083873470241408Confidence intervals for this distribution0.0021710487940019224Table 4
Description of performance evaluation of simple regression model.
RMSEMAEMSER2 scoreAdjustedR28.2821457783596.29114834754168.5939386939910.9985834885820.9985392226005


## 3.1.5. Technical Analysis: A Novel Approach Based on the Price Fluctuate Method

This method is focusing on the evaluation on the basis of two performance metrics based on Sharpe Ratio and Maximum Drawdown. The first phase involved visualizing the profit of training data on the number of quantity of shares, and the second phase is associated with calculating the profit of testing data shown in Algorithm1.Algorithm 1: Price fluctuate method.
Input : company stocks , PredictedYfor i in company_stocks(0,1) doTrain data and Daily profit is computed in the column profit.Order = [1 if signal > 0 else -1 for signal in Train['PredictedY']]Place buy order for signal 1 else sell order for -1Profit = Train['company_stock']∗ Train['Order']Wealth = Train['Profit'].cumsum()Test data and Proft of price fluctation methodOrder = [1 if sig >0 else -1 for sig in Test['PredictedY']]Place buy order for sig 1 else sell order for -1Profit = Test['company_stock']∗ Test['Order']Wealth = Test['Profit'].cumsum()End forFunction performance()For i in index[0]doInclude The initial investment which is one price of company_stock.Compute Sharpe Ratio on Train data and Test dataOutput : Daily (dailyr.mean()/dailyr.std(ddof=1))Evaluate Maximum Drawdown in Train data and Maximum Drawdown in Test dataOutput : (['Drawdown'].max())End forReturn OutputEnd function


## 3.2. Regression Modeling

The authors have developed the prototype of the process of simulation regarding the return on stocks using conventional random features. It is important to know the distribution. Thus, it is certainly critical in risk or probability administration.


### 3.2.1. Simple Regression Model

An inferential statistic depends on bivariate calculations and the cumulative distribution function, when constructing confidence levels or for implementing the hypothesis test. Evaluating the probability density function for a particular value is not useful; norm.pdf measures the probability for every possible value of an attainable random feature. Besides, the credible random feature can assume desirability from an optimistic trend to a negative trend. Two specifications 0 and 1 in normalization imparted the average and conventional deviation of a regular random feature, and the author can interchange these multiple principles to get a discrete normal feature. The solidity assignment of a standard variable is related exclusively to their average and their divergence [15, 16].We can clearly see that all the independent variables are linearly affecting our dependent variable. We model the daily return of stocks using the ordinary deposition. From the enormous cluster of irregular data returned by historical series of data, the authors will calculate the average and standard divergence [7]. A sufficiently extreme outlier is more likely to be an error than a genuine extreme result (how extreme will depend on the details—people often just choose a fairly arbitrary number of standard deviations, but you should take into consideration how likely errors are with your methodology including errors when running the regression will result in an incorrect trend line, so they will be excluded). Research needs to keep that in mind when using the trend line to make your predictions [14].Machine learning simply refers to learning about computers and making predictions from data. Linear regression does this, as more data improves its predictive ability [17–22]. Although other methods like SVM and neural networks are more generally thought of as machine learning, these algorithms actually boil down to minimizing a cost function from a model, as linear regression does. Progressive push is a supervised learning-based ML algorithm that can be instructed to forecast output existent numbers. Obtain the feature guess as a methodology that is based on some hidden parameters and input values [15, 16]. Table 5 explains how machine learning models are related to data implications for discrete models.Table 5
Description of the association between machine learning models and data implications with respect to discrete models.
ML model vs. data implicationsSimple regression modelMultiple regression modelStock nameHDFC BankSpy, Spy_Lag1, Sp500, Nasdaq, Dji, Cac40, Daxi, Hsi, Nikkei, AordType of dataContinuous series of dataContinuous series of dataMajor parametersR2 score, RMSESharpe Ratio, Maximum DrawdownDependable parametersNumber of Loans In hand (NLH), Invested Budget (IB), Number of Loans take over in the future (NLTF)Oil Prices (OP), War inside Country (WiC), Brand image Worldwide (BIW), Gold Reserves (GR)Nondependable parametersManpower (MP), Electronic Prices (EP)Company CEO instability (C-CEO-I), Political crises (PC)


### 3.2.2. Multiple Regression Models

This research has applied multiple linear regression models to generate a signal for SPY growth. With the help of multiple regression analysis, researchers can evaluate the significance of each predictor to the relationship as well as the strength of the relationship between an outcome (the dependent variable) and the predictors, frequently with the effect of other predictors statistically eliminated. A method that is more precise than ordinary linear regression is multiple linear regression. Simple linear regression can effectively capture the relationship between the two variables in cases with straightforward relationships. Multiple linear regression is frequently preferable for more complicated relationships that call for greater consideration. The benefits of this strategy include the possibility that it will result in a more exact understanding of each person’s association. The most interesting part is that we will see the pattern using multiple global market indices and predict the price change of SPY. The reason for choosing SPY as a target to view the regression model is because it is very suitable for frequent trading. The volatility of SPY is very high. The double-digit gain and loss run often appears. Multiple linear regressions will have multiple predictors. Our response variable is SPY’s opening price tomorrow minus today’s opening. With this response, we expect to make a morning forecast on the US market. Based on the forecast of the price change, we decide whether to go long or short. Here, in total, we have eight predictors. We cannot use any information available after a US market opens on the current day to calculate forecast values. In other words, these variables cannot be predictive. We will have three groups of predictors.The first group is a one-day lag variable from the “US” market. Open minus the last day’s opening price for SPY, Sp500, Nasdaq, and Dji. The second group is a one-day lagging variable from the “European” markets. Open minus the last day opening price for Cac40 and Daxi. Ideally, for European markets, we want to use the midday price minus the opening price. If you have intraday data, you can improve this model. However, Yahoo Finance does not provide intraday data [23]. Next, we will collect the data to get all these predictors and the answer. First, we generate an empty data frame and let the index be the same as the SPY index. Then, let us add the content of the response and the predictors we defined. Note, in the last closing line, we keep a record of the SPY opening price. Table 6 shows the relation of the number of lags and correlation to the international markets.Table 6
Relation of international markets with respect to the number of lags and correlation.
International marketsNumber of lagsCorrelationSpy11.000000Spy_Lag11-0.074537Sp5001-0.019273Nasdaq1-0.066339Dji1-0.034198Cac404-0.038057Daxi8-0.033772Hsi21-0.030826Nikkei32-0.027551Aord7-0.009840Figure6 shows the analysis of a comparison chart showing the correlation and number of lags between several global markets. It has found missing values. This is due to two reasons. When we calculate the price change, we can generate a NaN value in the first row, one day late, and in the last row, one day in the future. In different markets, they may have different holidays when the markets are closed. It can be shown by calculating the numbers of NaN values in each column. We find that the Australian markets appear to have more holidays. We need to handle the NaN values before viewing the model [23]. First, we use the fill-forward method to fill gaps in the data frame by propagating the last valid observation forward to the next valid one. Second, let us delete the first line using dropna. We find that the predictors for the European and Asian markets have an association with SPY, which has a greater impact than the predictors for the US markets [24].
(6)R2Score=1−RSSTSS.Figure 6
Analytical description of comparative chart of the number of lags and correlation of different international markets.R2 is considered to be coefficient of determination, RSS is defined by sum of squares of residuals, and TSS is the total sum of squares.
(7)RMSE=∑i=1ny∧i−yi2n.


## 3.2.1. Simple Regression Model

An inferential statistic depends on bivariate calculations and the cumulative distribution function, when constructing confidence levels or for implementing the hypothesis test. Evaluating the probability density function for a particular value is not useful; norm.pdf measures the probability for every possible value of an attainable random feature. Besides, the credible random feature can assume desirability from an optimistic trend to a negative trend. Two specifications 0 and 1 in normalization imparted the average and conventional deviation of a regular random feature, and the author can interchange these multiple principles to get a discrete normal feature. The solidity assignment of a standard variable is related exclusively to their average and their divergence [15, 16].We can clearly see that all the independent variables are linearly affecting our dependent variable. We model the daily return of stocks using the ordinary deposition. From the enormous cluster of irregular data returned by historical series of data, the authors will calculate the average and standard divergence [7]. A sufficiently extreme outlier is more likely to be an error than a genuine extreme result (how extreme will depend on the details—people often just choose a fairly arbitrary number of standard deviations, but you should take into consideration how likely errors are with your methodology including errors when running the regression will result in an incorrect trend line, so they will be excluded). Research needs to keep that in mind when using the trend line to make your predictions [14].Machine learning simply refers to learning about computers and making predictions from data. Linear regression does this, as more data improves its predictive ability [17–22]. Although other methods like SVM and neural networks are more generally thought of as machine learning, these algorithms actually boil down to minimizing a cost function from a model, as linear regression does. Progressive push is a supervised learning-based ML algorithm that can be instructed to forecast output existent numbers. Obtain the feature guess as a methodology that is based on some hidden parameters and input values [15, 16]. Table 5 explains how machine learning models are related to data implications for discrete models.Table 5
Description of the association between machine learning models and data implications with respect to discrete models.
ML model vs. data implicationsSimple regression modelMultiple regression modelStock nameHDFC BankSpy, Spy_Lag1, Sp500, Nasdaq, Dji, Cac40, Daxi, Hsi, Nikkei, AordType of dataContinuous series of dataContinuous series of dataMajor parametersR2 score, RMSESharpe Ratio, Maximum DrawdownDependable parametersNumber of Loans In hand (NLH), Invested Budget (IB), Number of Loans take over in the future (NLTF)Oil Prices (OP), War inside Country (WiC), Brand image Worldwide (BIW), Gold Reserves (GR)Nondependable parametersManpower (MP), Electronic Prices (EP)Company CEO instability (C-CEO-I), Political crises (PC)


## 3.2.2. Multiple Regression Models

This research has applied multiple linear regression models to generate a signal for SPY growth. With the help of multiple regression analysis, researchers can evaluate the significance of each predictor to the relationship as well as the strength of the relationship between an outcome (the dependent variable) and the predictors, frequently with the effect of other predictors statistically eliminated. A method that is more precise than ordinary linear regression is multiple linear regression. Simple linear regression can effectively capture the relationship between the two variables in cases with straightforward relationships. Multiple linear regression is frequently preferable for more complicated relationships that call for greater consideration. The benefits of this strategy include the possibility that it will result in a more exact understanding of each person’s association. The most interesting part is that we will see the pattern using multiple global market indices and predict the price change of SPY. The reason for choosing SPY as a target to view the regression model is because it is very suitable for frequent trading. The volatility of SPY is very high. The double-digit gain and loss run often appears. Multiple linear regressions will have multiple predictors. Our response variable is SPY’s opening price tomorrow minus today’s opening. With this response, we expect to make a morning forecast on the US market. Based on the forecast of the price change, we decide whether to go long or short. Here, in total, we have eight predictors. We cannot use any information available after a US market opens on the current day to calculate forecast values. In other words, these variables cannot be predictive. We will have three groups of predictors.The first group is a one-day lag variable from the “US” market. Open minus the last day’s opening price for SPY, Sp500, Nasdaq, and Dji. The second group is a one-day lagging variable from the “European” markets. Open minus the last day opening price for Cac40 and Daxi. Ideally, for European markets, we want to use the midday price minus the opening price. If you have intraday data, you can improve this model. However, Yahoo Finance does not provide intraday data [23]. Next, we will collect the data to get all these predictors and the answer. First, we generate an empty data frame and let the index be the same as the SPY index. Then, let us add the content of the response and the predictors we defined. Note, in the last closing line, we keep a record of the SPY opening price. Table 6 shows the relation of the number of lags and correlation to the international markets.Table 6
Relation of international markets with respect to the number of lags and correlation.
International marketsNumber of lagsCorrelationSpy11.000000Spy_Lag11-0.074537Sp5001-0.019273Nasdaq1-0.066339Dji1-0.034198Cac404-0.038057Daxi8-0.033772Hsi21-0.030826Nikkei32-0.027551Aord7-0.009840Figure6 shows the analysis of a comparison chart showing the correlation and number of lags between several global markets. It has found missing values. This is due to two reasons. When we calculate the price change, we can generate a NaN value in the first row, one day late, and in the last row, one day in the future. In different markets, they may have different holidays when the markets are closed. It can be shown by calculating the numbers of NaN values in each column. We find that the Australian markets appear to have more holidays. We need to handle the NaN values before viewing the model [23]. First, we use the fill-forward method to fill gaps in the data frame by propagating the last valid observation forward to the next valid one. Second, let us delete the first line using dropna. We find that the predictors for the European and Asian markets have an association with SPY, which has a greater impact than the predictors for the US markets [24].
(6)R2Score=1−RSSTSS.Figure 6
Analytical description of comparative chart of the number of lags and correlation of different international markets.R2 is considered to be coefficient of determination, RSS is defined by sum of squares of residuals, and TSS is the total sum of squares.
(7)RMSE=∑i=1ny∧i−yi2n.


## 4. Results and Discussions

Evaluate our models by comparing two stats in train and test. The first statistic is RMSE, which is the square root of the sum of the square errors averaged by degrees of stock transaction delivery, andk is the associated number of predictors. This central tendency is used to measure the forecast error. The reason for using degrees of freedom is that the RMSE square is a predominant predictor of the noise variance. The second is adjusted R-square. In simple linear regression, we use R2 to get the percentage of change that can be explained by a model. We found that by adding more predictors, the R2 square always increases, but the accuracy is even worse. Table 7 explains how two statistics from the train and test sets were compared to evaluate our models.Table 7
Description of the evaluation of our models by comparing two stats in train and test.
TrainTestR2 Score0.0096300.017726RMSE1.4933223.247854Figure7 shows the analytical explanation of test and train variation with respect to RMSE and R2. To compensate for the effects of the numerical predictors, we adjusted the R-squared, which evaluates the percentage of change in a response elaborated by the model. We calculate RMSE and adjust R-squared both in train and in test to see if they are noticeably different. If so, it is called overfitting. Usually, for the overfitting model, RMSE and adjusted R-square are much better in the train than in the test dataset. This implies that we cannot apply this model to the real market in the future [25]. From the output of our model, RMSE increases in the test, which is a little worse than in the train, where the test is better. Overall, our model is not overfitted. Our R-square is quite low, but on the stock market, it is not too bad.Figure 7
Analytical description of the variation of test and train with respect to RMSE andR2.


### 4.1. Impact of Sharpe Ratio and Maximum Drawdown on Novel Approach (Price Fluctuate Method)

This research has implicated the SPY charge alternate forecast as a buying and selling sign after which we execute an easy method. If the sign is advantageous, we had been long. Otherwise, they shot us. First, we are able to calculate a function of our buying and selling primarily based totally on our predicted price of response. Order the same to at least one of the predicted prices is advantageous or our forecast for the charge alternate is advantageous for beginning nowadays for beginning tomorrow [23]. Otherwise, order equals negative; this means that we are able to promote an inventory if we have an inventory of it, after which we are able to brief an inventory. Then, we will evaluate the overall performance of this method, which we name a sign-primarily based total method, with a passive method, which we name purchase and preserve method, which includes starting with shopping for greater SPY stocks and protecting them for positive days. The total income made in train is 140.06002807617188. We can see from the plot that the sign-based total method outperforms the purchase-and-preserve method. The total income made in Test is 112.60006713867188. Similarly, we will view the buying and selling in the check dataset, and the whole income is 252, less than that during the train. The consistency of overall performance could be very important [26, 27]. Otherwise, its miles is too volatile to use in the future. The common each day go back is a reflection that we will make an evaluation with inside the economic zone after they use a Sharpe Ratio and the most drawdown [28]. The Sharpe Ratio measures the extra go back consistent with the unit of deviation in a funding or buying and selling method named after William Sharpe. Figures 8 and 9 show the performance strategy in train and test.Figure 8
The performance of strategy in train.Figure 9
The performance of strategy in test.Each day’s Sharpe Ratio is identical to the common of the extra yield divided with the aid of using the usual deviation of the extra yield. Since there are about 252 buying and selling days in line with years inside the US inventory market, the yearly Sharpe Ratio is identical to each day Sharpe Ratio extended with the aid of using the square root of 252. The most drawdown is a most percent drop of the method from the ancient most earnings at any given time.Table8 It is explained that the financial markets differentiate when they use a Sharpe Ratio and a Maximum Drawdown.Table 8
Differentiation in financial markets when they implement a Sharpe Ratio and Maximum Drawdown.
TrainTestDaily0.078954528514562010.024421253270360144Yearly1.25336428399133460.3876753771473746Maximum Drawdown0.13594932564777350.44111852839093285First, we calculate the drawdown and then most [29] of all drawdowns inside the buying and selling period. To calculate a drawdown, we want to calculate the height of the wealth process. At any time, we are able to without difficulty try this usage of the facts of body method, cummax. The most reliable hedge fund return series are typically bimonthly profits. Bimonthly profits are calculated by the fund administrator. Investors can also achieve weekly or daily returns, but these series are internally generated and may be subject to change. This depends on the period in which the Sharpe index is calculated. If calculated monthly, the standard deviation should also be taken monthly. However, the standard deviation must be annualized to obtain the correct Sharpe Ratio. Figure 10 shows the Sharpe Ratio and Maximum Drawdown variations in relation to training and testing. Table 9 displays the evaluation of several parameters in both single and multiple-regression analyses. Table 10 shows the analysis of the suggested methodology in comparison to the existing modelsFigure 10
Variation of Sharpe Ratio and Maximum Drawdown with respect to train and test.Table 9
Shows evaluation of different parameters in simple regression and multiple regressions.
ML modelStock nameType of dataMajor parametersDependable parametersNondependable parametersSimple regression modelHDFCBANKContinuous series of dataValue at risk, log return, volume, mean, price difference, daily returnClose priceOpen price, high price, low priceMultiple regression modelSpy, Spy_Lag1, Sp500, Nasdaq, Dji, Cac40, Daxi, Hsi, Nikkei, AordContinuous series of dataNumber of lags, correlation, standard deviationClose priceOpen price, high price, low priceTable 10
Comparative analysis of proposed methodology with existing models.
Author nameAccuracyMadge and Bhatt [30]80%Qiu and Song [31]81.27%Tsai and Chen [32]77%Senol and Ozturan [33]78.47%Nti et al. [34]93.7%Hao and Gao [35]74.55%Budiharto [36]94.59%Bhupinder and Santosh96.3%Thus, the authors have concluded that the implementation of multiple regression models is quite a complex process and requires more execution time. According to our research implementation, this research had achieved the accuracy of 96.3% as mentioned in Table7 and it has been corporately analyzed with previous research implementation for prediction as shown in Table 11 and Figure 11.Table 11
Performance comparison with existing models with respect to the number of keys/methods.
Author nameDependable parametersModelsDatasetMethodConclusionMadge and Bhatt [30]Index momentum, stock price volatility, stock momentumSVM model was computed to check if the efficient markets hypothesis is subjected to prove true as they move on uncertain randomlyNASDAQ-100 technology stocks. It constitutes 34 to 39 companies. The time interval is 2007 to 201470% data for training and the remaining 30% for testing. Radial kernel was used for the computationThe results proved EMH true.Some stocks proved accuracy up to 80%, but some show only 30% reachQiu and Song [31]Hit ratio, two types of input variables were involvedANN algorithmNikkei 225 value index of the Japanese stock companiesThe model was tweaked with the help of G.A. to make it less convergent and more preciseThe model showed an 81.27% accuracy rateTsai and Chen [32]Average of cluster parameter, probability, standard deviationANN and decision treesThe stock prices of the electron industry in Taiwan. All the stock values were collected from TEJOne hidden layer was considered 1 and 0 could be the ideal choice for the decision model (1 for prices rise, 0 for prices fall)Prediction accuracy of 77%. Only DT gave 65% accuracy, and only ANN gave 59% accuracyDT+DT gave an average accuracy of 67%Senol and Ozturan [33]Coefficient of determination, average mean squared errors, close priceEight ANN models were prepared for seven discrete prediction systems to calculate indicators of P.S. algorithmsIstanbul stock exchange (ISE-30)Stock prices decrease when output is greater than or equal to 0 and less than 0.5 which stays the same when output is equal to 0.5 which increases when output is greater than 0.5 and equal to or less than 078.47% was the maximum success rate, and 50% was the minimum success rate for a specific stockNti et al. [34]Probability of crossover, probability of mutation, genome length, population size, number of generationsThe homogeneous ensemble classifier known as GASVM, which is focused on the G.A. This helps choose and optimizing SVM10-day price movements were predicted by the Ghana Stock Exchange (GSE). Time duration from Jun 25, 2007 to Aug 27, 2019Models such as preferable RMSE, MAE, AUC, accuracy, or recall were conditionally used to evaluate the dataset efficiencyGASVM showed the best results, and the proposed model provided an accuracy of 93.7%Hao and Gao [35]Loss function, learning rate, price trendLSTM, SVM, CNN, NFNN, and multiple pipeline modelsS&P 500 stock prices. Time duration from Jan 30, 1999, to Jan 30, 2019Multiple LSTMs to learn the time dependency of features of different time scalesThe LSTM model was proven to be better, and the model had an accuracy of 74.55% over one monthBudiharto [36]Open, High, Low, and Closing (OHLC)LSTM modelP.T. Bank Central Asia Tbk and P.T. Bank Mandiri. 80% for training and 20% for testingThe performance of the model was computed based on different time intervals and varying numbers of epochsThe optimum results were utilized in a period of 1 year and a total of 100 epochs. The accuracy of 94.59% is achievedBhupinder and SantoshClosing price, price differences, daily returnHybrid multiple regression modelsDataset used in Indian Stock Exchange and S&P 500 (largest exchange fund)The price fluctuate method is implemented using the relationship of independent variables and dependent variables on the basis ofR2 score and RMSEOur approach achieved the overall accuracy of 96.3% which is the best of all the above techniquesFigure 11
Comparative analysis of proposed methodology with existing models for analyzing the accuracy.


## 4.1. Impact of Sharpe Ratio and Maximum Drawdown on Novel Approach (Price Fluctuate Method)

This research has implicated the SPY charge alternate forecast as a buying and selling sign after which we execute an easy method. If the sign is advantageous, we had been long. Otherwise, they shot us. First, we are able to calculate a function of our buying and selling primarily based totally on our predicted price of response. Order the same to at least one of the predicted prices is advantageous or our forecast for the charge alternate is advantageous for beginning nowadays for beginning tomorrow [23]. Otherwise, order equals negative; this means that we are able to promote an inventory if we have an inventory of it, after which we are able to brief an inventory. Then, we will evaluate the overall performance of this method, which we name a sign-primarily based total method, with a passive method, which we name purchase and preserve method, which includes starting with shopping for greater SPY stocks and protecting them for positive days. The total income made in train is 140.06002807617188. We can see from the plot that the sign-based total method outperforms the purchase-and-preserve method. The total income made in Test is 112.60006713867188. Similarly, we will view the buying and selling in the check dataset, and the whole income is 252, less than that during the train. The consistency of overall performance could be very important [26, 27]. Otherwise, its miles is too volatile to use in the future. The common each day go back is a reflection that we will make an evaluation with inside the economic zone after they use a Sharpe Ratio and the most drawdown [28]. The Sharpe Ratio measures the extra go back consistent with the unit of deviation in a funding or buying and selling method named after William Sharpe. Figures 8 and 9 show the performance strategy in train and test.Figure 8
The performance of strategy in train.Figure 9
The performance of strategy in test.Each day’s Sharpe Ratio is identical to the common of the extra yield divided with the aid of using the usual deviation of the extra yield. Since there are about 252 buying and selling days in line with years inside the US inventory market, the yearly Sharpe Ratio is identical to each day Sharpe Ratio extended with the aid of using the square root of 252. The most drawdown is a most percent drop of the method from the ancient most earnings at any given time.Table8 It is explained that the financial markets differentiate when they use a Sharpe Ratio and a Maximum Drawdown.Table 8
Differentiation in financial markets when they implement a Sharpe Ratio and Maximum Drawdown.
TrainTestDaily0.078954528514562010.024421253270360144Yearly1.25336428399133460.3876753771473746Maximum Drawdown0.13594932564777350.44111852839093285First, we calculate the drawdown and then most [29] of all drawdowns inside the buying and selling period. To calculate a drawdown, we want to calculate the height of the wealth process. At any time, we are able to without difficulty try this usage of the facts of body method, cummax. The most reliable hedge fund return series are typically bimonthly profits. Bimonthly profits are calculated by the fund administrator. Investors can also achieve weekly or daily returns, but these series are internally generated and may be subject to change. This depends on the period in which the Sharpe index is calculated. If calculated monthly, the standard deviation should also be taken monthly. However, the standard deviation must be annualized to obtain the correct Sharpe Ratio. Figure 10 shows the Sharpe Ratio and Maximum Drawdown variations in relation to training and testing. Table 9 displays the evaluation of several parameters in both single and multiple-regression analyses. Table 10 shows the analysis of the suggested methodology in comparison to the existing modelsFigure 10
Variation of Sharpe Ratio and Maximum Drawdown with respect to train and test.Table 9
Shows evaluation of different parameters in simple regression and multiple regressions.
ML modelStock nameType of dataMajor parametersDependable parametersNondependable parametersSimple regression modelHDFCBANKContinuous series of dataValue at risk, log return, volume, mean, price difference, daily returnClose priceOpen price, high price, low priceMultiple regression modelSpy, Spy_Lag1, Sp500, Nasdaq, Dji, Cac40, Daxi, Hsi, Nikkei, AordContinuous series of dataNumber of lags, correlation, standard deviationClose priceOpen price, high price, low priceTable 10
Comparative analysis of proposed methodology with existing models.
Author nameAccuracyMadge and Bhatt [30]80%Qiu and Song [31]81.27%Tsai and Chen [32]77%Senol and Ozturan [33]78.47%Nti et al. [34]93.7%Hao and Gao [35]74.55%Budiharto [36]94.59%Bhupinder and Santosh96.3%Thus, the authors have concluded that the implementation of multiple regression models is quite a complex process and requires more execution time. According to our research implementation, this research had achieved the accuracy of 96.3% as mentioned in Table7 and it has been corporately analyzed with previous research implementation for prediction as shown in Table 11 and Figure 11.Table 11
Performance comparison with existing models with respect to the number of keys/methods.
Author nameDependable parametersModelsDatasetMethodConclusionMadge and Bhatt [30]Index momentum, stock price volatility, stock momentumSVM model was computed to check if the efficient markets hypothesis is subjected to prove true as they move on uncertain randomlyNASDAQ-100 technology stocks. It constitutes 34 to 39 companies. The time interval is 2007 to 201470% data for training and the remaining 30% for testing. Radial kernel was used for the computationThe results proved EMH true.Some stocks proved accuracy up to 80%, but some show only 30% reachQiu and Song [31]Hit ratio, two types of input variables were involvedANN algorithmNikkei 225 value index of the Japanese stock companiesThe model was tweaked with the help of G.A. to make it less convergent and more preciseThe model showed an 81.27% accuracy rateTsai and Chen [32]Average of cluster parameter, probability, standard deviationANN and decision treesThe stock prices of the electron industry in Taiwan. All the stock values were collected from TEJOne hidden layer was considered 1 and 0 could be the ideal choice for the decision model (1 for prices rise, 0 for prices fall)Prediction accuracy of 77%. Only DT gave 65% accuracy, and only ANN gave 59% accuracyDT+DT gave an average accuracy of 67%Senol and Ozturan [33]Coefficient of determination, average mean squared errors, close priceEight ANN models were prepared for seven discrete prediction systems to calculate indicators of P.S. algorithmsIstanbul stock exchange (ISE-30)Stock prices decrease when output is greater than or equal to 0 and less than 0.5 which stays the same when output is equal to 0.5 which increases when output is greater than 0.5 and equal to or less than 078.47% was the maximum success rate, and 50% was the minimum success rate for a specific stockNti et al. [34]Probability of crossover, probability of mutation, genome length, population size, number of generationsThe homogeneous ensemble classifier known as GASVM, which is focused on the G.A. This helps choose and optimizing SVM10-day price movements were predicted by the Ghana Stock Exchange (GSE). Time duration from Jun 25, 2007 to Aug 27, 2019Models such as preferable RMSE, MAE, AUC, accuracy, or recall were conditionally used to evaluate the dataset efficiencyGASVM showed the best results, and the proposed model provided an accuracy of 93.7%Hao and Gao [35]Loss function, learning rate, price trendLSTM, SVM, CNN, NFNN, and multiple pipeline modelsS&P 500 stock prices. Time duration from Jan 30, 1999, to Jan 30, 2019Multiple LSTMs to learn the time dependency of features of different time scalesThe LSTM model was proven to be better, and the model had an accuracy of 74.55% over one monthBudiharto [36]Open, High, Low, and Closing (OHLC)LSTM modelP.T. Bank Central Asia Tbk and P.T. Bank Mandiri. 80% for training and 20% for testingThe performance of the model was computed based on different time intervals and varying numbers of epochsThe optimum results were utilized in a period of 1 year and a total of 100 epochs. The accuracy of 94.59% is achievedBhupinder and SantoshClosing price, price differences, daily returnHybrid multiple regression modelsDataset used in Indian Stock Exchange and S&P 500 (largest exchange fund)The price fluctuate method is implemented using the relationship of independent variables and dependent variables on the basis ofR2 score and RMSEOur approach achieved the overall accuracy of 96.3% which is the best of all the above techniquesFigure 11
Comparative analysis of proposed methodology with existing models for analyzing the accuracy.


## 5. Conclusion

Machine learning simply refers to learning about computers and making predictions from data. Identifying and analyzing the risk factors in the stock market are the major and crucial stage for predicting the company stock values at the national and international levels. In existing research, all risk management-related factors are analyzed based on fundamental statistics of the company performance which are measured as quarterly results, which will not give long-term true predictions and will not provide positive directions to invest in further stocks. This research majorly focused on risk management for national stock companies using the machine learning methodology and algorithms. It has described the association between machine learning models and implicated the data with respect to discrete models based on supportive, dependable, nondependable parameters along with the name and type of the stock. This research has integrated a few crucial dependable parameters such as oil prices, on-hand projects, and future projects. This research has concluded that the by-product version is not outsized. Regarding the likelihood of significant losses, the signal-based strategy performs as expected. It is promising to broaden it. Similarly right into a worthwhile approach, however, it is able to feel a variety of effort. This study has proposed an enhanced decision support system that allowed traders and long-term investors to maximize their expected return while practicing the day trading activities against unfavorable movements in the stock market. It has integrated with the simple, multiple linear regression models to generate a signal for SPY growth. The proposed ML-based model has been evaluated by comparing two states of training and testing and achieved 96.3% of accuracy. The performance range of the proposed multiple regression model lies along the maximum drawn down which is 0.04411 for test cases and 1.2533 for training cases. Compare the performance of the proposed approach with existing models with respect to the number of keys and methods associated with training and testing the data. The process of discovering, evaluating, and controlling risks to an organization’s resources and profits is known as risk management. These dangers can be caused by a number of things, such as monetary unpredictability, legal responsibilities, technological problems, strategic management blunders, accidents, and natural calamities. The reduction of stock market risks can be advantageous to a broker, advisor, portfolio manager, research analyst, investment banker, relationship manager, professional investor, and trader. The future work can be the extended to deep learning models and statistical analysis of risk management in trend for further improvement in results.



---

*Source: 2432839-2022-08-09.xml*