Implementing Bisection Method on Forex Trading Database for Early Diagnosis of Inflection Point

—Many people are trading in the forex market during the COVID-19 pandemic with the hope of earning money, but they are experiencing shortages due to the lack of information and technology-based tools for existing daily data. Sometimes traders only use moving averages in trading data, even though this information needs to be processed again to get the right inflection point. The objective of this research is to find inflection points based on Forex trading database. Another algorithm can also be used to determine the inflection point between two points on a moving average. This can be supported by the Bisection method used because it can guarantee that convergence will occur. The results show that the points resulting from the bisection calculation on the moving average provide a fairly accurate decision support for the location where the inflection point is located. From 10,000 data there is a standard deviation of 0.71 points which is very small compared to an average of 20 pips (points used as the difference in price values in forex). The use of the bisection method provides an accuracy of the results in seeing the inflection point of 87%.


I. INTRODUCTION
Since the COVID-19 pandemic, the value of trade transactions has decreased, this is due to unstable economic conditions and tends to decline and so many speculators do wait and see [1][2][3][4]. Based on these problems, this research is focused on finding a solution by processing a database containing transaction data and forex value movements obtained from the meta trader application connected to the broker server [5][6][7]. From this problem arises the question, how to know the inflection point on a curve that can be seen by the user in real time [8].
Many researchers use the moving average method to assist in making buy or sell decisions based on a certain time frame, but often moving averages are less accurate because errors often occur, especially when there is a change in trend. For this reason, an additional method is needed that can overcome the problems that occur in moving averages, especially in determining inflection points.
The bisection method is a way to determine the value of a curve by dividing the interval in half; this method is used to find the equation of a straight line [9][10][11]. Because the downward movement of the curve tends to be linear, the researcher uses this method to determine the inflection point [12][13]. The bisection method could help estimate the value of past data so that the results are expected to determine the inflection point properly.
In this research, it will be proved that by looking for inflection points, it can speed up the decision-making process accurately, because the method to be used in this study uses the Bisection Method, which can speed up the search for the midpoint of a line. So, it is expected that between these inflection points an up or down curve can be found which has an important role in decision making.

A. Forex Database
To be able to observe price movements in forex trading, a connection is needed to the account of one of the brokers that serves forex trading. To be able to get a database related to forex prices, you can choose a currency pair such as USD and JPY. After selecting a currency pair, price movements can be observed directly depending on the desired timeline. Starting from every 1 minute, 15 minutes, 30 minutes, 1 hour, 4 hours, daily, weekly, and even monthly [14].
To be able to accurately perform formula calculations accurately, of course you cannot use all time frames. For this reason, this study uses a 1-hour and 4-hour and daily time frame to check currency price movements [15][16].
The data obtained from previous researchers is the dataset that will be used in this study. The dataset is not directly used in research but it is necessary to clean the data using SPSS to find out that the data is free from outliers. SPSS helps find statistics from a data set, i.e., statistics that include median, mean, mode, variance, and standard deviation.
The resulting statistical data will be processed by Python to remove invalid data, usually invalid data due to redundancy, political factors that affect foreign exchange rates, certain major factors such as explosions, wars, and others. Many researchers do data cleaning with various parameters that are felt to interfere with research, but with a statistical approach it is expected that the dataset will be of better quality.
Data on currency price movements can be downloaded using the .csv format [17][18][19] so that later it can be used for further calculation processes. Forex price movement data in the form of candlesticks can be seen in Fig. 1. www.ijacsa.thesai.org  Open price data indicates the price at the beginning of the new time frame. High data indicates the highest value the price reached during that time frame. Low data indicates the lowest value the price reached during that time frame. Close data indicates the price at the end of the time frame [20][21].

B. Inflection Point
The inflection point is the point where a curve will change sign, for example from a curve that tends to decrease in value to change with a value that tends to increase [20]. This change is usually marked with an acceleration that is zero. The acceleration itself is obtained from the second derivative of a function equation; in this study the function is the movement of exchange rate data over time.
In this study, the inflection points where f''(x)=0 has a relationship with the bisection method because both will stop at a point with a zero value, zero for the acceleration at the inflection point and for the middle value of the Bolzano method [22][23]. The value of f(x) in this study is the lowest or highest value of the exchange rate as shown in Fig. 3.

C. Bisection Method
The Bisection method is a root search algorithm at an interval [24][25][26]. The interval divides into two parts, then chooses from these two parts which part contains roots and which part does not contain roots is discarded. This is done repeatedly until the roots of the equation are obtained or close to the roots of the equation [27] This method is applicable when you want to solve the equation f(x)=0 where f(x) is a continuous function. Bisection Method can be seen in Fig. 4.

III. METHODOLOGY
This research uses a simple research method that can be seen in the picture. Before the research was carried out, the researcher collected datasets obtained from meta traders. This dataset is then processed using python to look for data patterns, outliers and dataset variances that are beyond reasonable limits. www.ijacsa.thesai.org After the dataset has been successfully cleaned, the dataset is sorted by time, this aims to make it easier to take points that will be used as points f(a) and f(b). This point is then entered into the bisection formula by determining the new point c=(a+b) / 2, where point c is the midpoint or inflection point. Of course, there are many midpoints, so it is necessary to look for several possibilities from several existing datasets. From this point, it can be predicted that the forex price will go up or down so that better decisions can be made. The flowchart of the various stages as explained can be seen in Fig. 5.
To calculate this inflection point, researchers use the Python programming language which makes it easy to calculate quickly. This algorithm is validated by experts in mathematics and when the validation is appropriate then it is tested on a server, the researcher uses a 10-core server with 16GB RAM. The data entered in the algorithm consists of a one-month timeframe. In Table I, the validator fills in the maximum value or approves it for the next stage.

IV. RESULT AND DISCUSSION
The dataset in this study was taken from secondary data on export results in the form of .csv from the Metatrader software. This dataset consists of four data types, namely: High, Low, Open, Close. The next process is to clean the data by not entering datasets that exceed the upper and lower limits based on statistical analysis which includes median, mean, standard deviation and variance.
After the dataset is already cleaned, the next step is to run the dataset in an application made using Python. Python program code can be seen in Algorithm 1.  After the application is run, the results will look like in Table II.
From the table it appears that the predicted value using bisection has a small error range when compared between the 'c' column and the 'predicted' column. With accuracy of an inflection point is 87% by SPSS and standard deviation about 0.71 and 20 pips moving. This will help users when they get information that after inflection there has been an increase in forex prices.

V. CONCLUSION
The research resulted in several conclusions, namely: a combination of bisection formulas on moving averages that work well. This is because both have the same scalar properties. In addition, the error rate of both algorithms is less than 3%. Furthermore, including optimization in determining future prediction values has been carried out by the bisection method even though it still has an error, but the error is still below 5%; this gives a sense of optimism for users to make decisions on buying or selling forex trading. This study was conducted in several experiments and ran well in the Python language environment with the objective achieved.
ACKNOWLEDGMENT Special thanks to validator Zainal Arifin from State University of Malang, thanks to Petra Christian University, and Universiti Teknikal Malaysia Melaka.