You are on page 1of 93

Machine Translated by Google

STOCK PRICE MOVEMENT TREND PREDICTION


USING TEMPORAL ALGORITHM

CONVOLUTIONAL NETWORK (TCN)


TITLE PAGE

Arranged by:

Name : Harry Akbar Al Hakim

NIM : 17523229

INFORMATICS STUDY PROGRAM – GRADUATE PROGRAM

INDUSTRIAL TECHNOLOGY FACULTY

INDONESIAN ISLAMIC UNIVERSITY

2021
Machine Translated by Google

ii

SUPERVISOR'S APPROVAL PAGE

STOCK PRICE MOVEMENT TREND PREDICTION


USING TEMPORAL ALGORITHM

CONVOLUTIONAL NETWORK (TCN)

THESIS

Arranged by:

Name : Harry Akbar Al Hakim

NIM : 17523229

Yogyakarta, 14 July 2021


advisor,

(Dhomas Hatta Fudholi, ST, M.Eng., Ph.D.)


Machine Translated by Google
Machine Translated by Google

iv
Machine Translated by Google

PRIVATE PAGE

Praise be to Allah SWT, with the opportunity and sustenance given to me


studied at the Department of Informatics at the Islamic University of Indonesia and was able to reach the final stage

compiling this final project research. With all the processes and struggles faced, I
would like to thank several parties, namely my beloved mother, brother
my brothers who always give advice, my friends who faithfully support
in times of joy and sorrow, comrades in arms, Mr. Dhomas Hatta Fudholi, ST,
M.Eng., Ph.D. as supervising lecturer, and the Department of Informatics at the Islamic University of Indonesia

where do i study
Machine Translated by Google

vi

MOTO PAGE

“When will someone die? When he got shot? No! When he was poisoned

turn off? No! When he ate poisoned food? No! Someone will die

when he has been forgotten

-Dr. Hiluluk (One Piece)

“History repeats itself”

- Wicky Zeroski (Professional Trader)

“Dreams are not something you see while sleeping, but something you make
you can't sleep”

-Cristiano Ronaldo

"Whoever goes out seeking knowledge, then he is in the way of Allah until he returns"
- HR Tirmidhi
Machine Translated by Google

vii

FOREWORD

Assalamualaikum Warahmatullai Wabarakatuh

Alhamdulillah, all praise and gratitude I say to the presence of Allah SWT, who has
give her pleasure and mercy. So that the author can complete the final report
is entitled "Predicting the Trend of Stock Price Movements Using the Temporal Algorithm
Convolutional Network (TCN)” which is part of my worship to Allah SWT.
This report is prepared to fulfill the final task as a condition for completion
education at the level of Strata 1 (S1) in the Department of Informatics at the Indonesian Islamic University.

The author realizes that this report will not be completed quickly without support
and motivation from various parties. For this reason, the author does not forget to express his gratitude

big thanks to:


1. Allah SWT, for the abundance of His grace and guidance, which is always there at every step

in providing strength, ability, and maintaining the spirit to demand


knowledge.

2. My beloved mother, Sri Rejeki, SE who gives all the support and love
love me.
3. Mr. Fathul Wahid, ST, M.Sc., Ph.D. as Chancellor of the Indonesian Islamic University
4. Mr Prof. Dr. Ir. Hari Purnomo, MT as the Dean of the Faculty of Industrial Technology
Indonesian Islamic University.

5. Mr. Hendrik, ST, M.Eng. as Chair of the Department of Informatics at the Islamic University
Indonesia.

6. Mr. Raden Teduh Dirgahayu, ST, M.Sc., as Chair of the Informatics Study Program
Undergraduate Program in the Faculty of Industrial Technology, Islamic University of Indonesia.

7. Mr. Dhomas Hatta Fudholi, ST, M.Eng., Ph.D. as the assignment supervisor
which provides direction in the preparation of the final report.
8. Mr. and Mrs. lecturers of the Informatics Study Program, who have provided the knowledge
has educated and imparted his knowledge during my studies.
9. Brothers, friends, and my friends who always provide support when
state of joy and sorrow.

Hopefully all parties who provide assistance, support, guidance, and prayers
given to the author to get the goodness of Allah SWT. The author apologizes
if during the process of working on the final report there are oversights and errors. Writer
Machine Translated by Google

viii

Hopefully, this final project report can be useful for the world of education and
development of informatics and technology.

Yogyakarta, 14 July 2021

(Harry Akbar Al Hakim)


Machine Translated by Google

ix

SARI

Communities increasingly understand the importance of managing their assets

for those used for future plans or multiplying its value. One of

The most popular financial instrument among Indonesian people is stocks. Whereas

Understanding own shares according to the Indonesian Stock Exchange (IDX), shares are a sign of participation

capital of a business entity in a company or limited liability company. Stock price

very fluctuating, can be influenced by internal and external factors. To predict

trends in stock price movements in addition to paying attention to company fundamentals and reading

stock price charts, can take advantage of artificial intelligence technology , especially deep

learning. In this study used the Temporal Convolutional deep learning algorithm

Network (TCN) which uses the convolution concept to predict movement trends

stock prices utilize the Darts library which was developed to process time data

series, the stock data used are shares from Netflix, Inc (NFLX). Results that

obtained, TCN is able to provide predictive results that outperform some algorithms

others such as Long Short Term Memory (LSTM), Linear Regression, and Decision Tree

Regression. With the calculated value of Root Mean Squared Error (RMSE), TCN gets

value 9,865, LSTM 10,710, Lineaer Regression 11,894, and Decision Tree Regression 30,868.

It can be seen that the TCN algorithm is quite effective for predicting price movement trends

stocks and the algorithm is more concise in its use.

Keywords: stocks, Machine Learning, Deep Learning, Temporal Convolutional Network,

Long Short Term Memory, Linear Regression, Decision Tree Regression.


Machine Translated by Google

GLOSSARY

BatchSize the amount of data that is trained at one time

steps to trace program code errors.


Datasets a group of data used in model building

Epoch the number of repetitions in the training data

Pre-processing the stages of preparing data so that it can be processed in the algorithmic model

.
Machine Translated by Google

xi

LIST OF CONTENTS

TITLE PAGE…………………………………………………………………………...i

SUPERVISOR LECTURER APPROVAL PAGE……………………………………...ii

EXAMINING LECTURER APPROVAL PAGE……………………………………………….iii

PRESENTATION PAGE……………………………………………………………………….v

MOTO PAGE…………………………………………………………………………..vi

PREFACE……………………………………………………………………………….. vii

SARI…………………………………………………………………………………………………..ix

GLOSSARY……………………………………………………………………………….... x

LIST OF CONTENTS…………………………………………………………………………………. xi

LIST OF TABLES…………………………………………………………………………... xiii

LIST OF FIGURES………………………………………………………………………...xiv

CHAPTER I INTRODUCTION…………………………………………………………….. 1

1.1 Background…………………………………………………………………....1
1.2 Problem Formulation………………………………………………………………...3

1.3 Research Objectives……………………………………………………………….... 3


1.4 Research Benefits……………………………………………………………….. 4

1.5 Problem Limitation…………………………………………………………………. 4

1.6 Research Methodology…………………………………………………………….4


1.7 Writing Systematics……………………………………………………………. 5

CHAPTER II THEORY BASIS……………………………………………………………….... 7

2.1 Stock Analysis……………………………………………………………………. 7

2.1.1 Fundamental Analysis……………………………………………………...7

2.1.2 Technical Analysis…………………………………………………………..8

2.1.3 News…………………………………………………………………….. 13

2.2 Netflix………………………………………………………………………….... 14

2.3 Artificial Intelligence……………………………………………………………. 15

2.3.1 Machine Learning………………………………………………………. 16 2.3.2 Deep

Learning…………………………………………………………...18

2.3.3 Artificial Neural Network………………………………………………..18 2.4 Temporal

Convolutional Network (TCN)................ ........................................... 20


Machine Translated by Google

xi

2.4.1 Sequence Modeling…………………………………………………….. 21


2.4.2 1 Dimensional Convolutional Networks………………………………....21
2.4.3 Causal Convolutions……………………………………………………. 22
2.4.4 Dilated Convolutions…………………………………………………….23
2.4.5 Residual Connections…………………………………………………....25

2.4.6 Activation Function, Normalization, and Regularization………. 26


2.4.7 Final Model…………………………………………………………….. 27
2.5 Evaluation Matrix…………………………………………………………………..27

2.5.1 Mean Absolute Error (MAE)................................................. ........................... 28


2.5.2 Mean Square Error (MSE)............. .................................................. ........28
2.5.3 Root Mean Squared Error (MAE)................................................. .....................29
2.6 Related Research………………………………………………………………... 29

CHAPTER III RESEARCH METHODOLOGY…………………………………………………….32

3.1 Data Collection……………………………………………………………….32 3.2 Research


Design……………………………………………… …………..33
3.2.1 Temporal Convolutional Network (TCN)................................................. ..........35
3.2.2 Comparison Algorithm…………………………………………………. 35
3.3 Evaluation…………………………………………………………………………..38

CHAPTER IV RESULTS AND DISCUSSION……………………………………………………. 39

4.1 Implementation…………………………………………………………………….. 39 4.1.1


Temporal Convolutional Network (TCN).......... ...........................................39
4.1.2 Long Short Term Memory (LSTM) ............................................... ................... 44
4.1.3 Linear Regression and Decision Tree Regression………………………. 54
4.2 Visualization……………………………………………………………………….. 61

4.2.1 Temporal Convolutional Network (TCN)................................................. ........ 61


4.2.2 Long Short Term Memory (LSTM) .................................. ............................ 63
4.2.3 Linear Regression and Decision Tree Regression………………………. 64
4.3 Evaluation…………………………………………………………………………..68

CHAPTER V CLOSING……………………………………………………………………………71

5.1 Conclusion…………………………………………………………………….... 71
5.2 Suggestions…………………………………………………………………………….. 71

REFERENCES………………………………………………………………………... 73

ATTACHMENT…………………………………………………………………………………. 77
Machine Translated by Google

xiii

LIST OF TABLES

Table 2.1 An example of a table created using MS Word................................................. ........29


Table 2.2 An example of a table made with MS Excel................................................. .....................4
Table 2.1 Related Research................................................. .................................................. ....28

Table 4.1 Comparison of Martik.................................................. ...............................................67


Machine Translated by Google

xiv

LIST OF FIGURES

Figure 2.1 Please copy and paste to create an image title ............................................... ........3

Figure 2.2 How to copy and paste equation ( 3.1 ) into equation ( 2.1 )................................5

Figure 3.1 Example of program code that is considered as an image. .........................................6

Figure 2.1 Trends in stock price movements................................................. ...............................8

Figure 2.2 Line chart on NFLX shares................................................. ...............................9

Figure 2.3 Bar chart on NFLX shares................................................. ...............................10

Figure 2.4 Candlestick chart on NFLX stocks................................................. ...........................10

Figure 2.5 Support and resistance areas for NFLX stocks................................................. ........11

Figure 2.6 The main parts of an Artificial Intelligence system................................................. ......14

Figure 2.7 Sections on Artificial Intelligence ............................................... ...........................15

Figure 2.8 The division of categories in Machine Learning................................................. ..........16

Figure 2.9 The structure of a neuron................................................. ...............................................17

Figure 2.10 Structure of an Artificial Neural Network ............................................... ...............18

Figure 2.11 Processes 1 dimensional convolution ............................................... ...........................21

Figure 2.12 The process of causal convolution................................................. ...............................22

Figure 2.13 Dilated convolution................................................. ............................................23

Figure 2.14 Dilated base................................................. .................................................. .......24

Figure 2.15 Residual connection structure................................................. ...............................24

Figure 2.16 Addition of activation, normalization, regularization functions ..................26

Figure 2.17 TCN final model................................................. ...............................................26

Figure 3.1 Research flowchart ............................................... ............................................30

Figure 3.2 Flowchart of the Temporal Convolutional Network (TCN) model ….................................32

Figure 3.3 Flowchart of the Long Short Term Memory (LSTM) model ….................................33

Figure 3.4 Flowchart of the Linear Regression model and Regression Decision Tree ..................34

Figure 4.1 Import library................................................. .................................................. ......36

Figure 4.2 Obtaining stock data................................................. ...........................................37

Figure 4.3 NFLX stock data................................................. .................................................. 37

Figure 4.4 Exploratory Data Analysis (EDA) on stock data................................................. ....38

Figure 4.5 Exploratory Data Analysis Results................................................. ...........................38

Figure 4.6 Close price visualization................................................. ...........................................39

Figure 4.7 Retrieving column close and scaling data................................................. ...............39

Figure 4.8 Split datasets................................................. .................................................. ........40


Machine Translated by Google

xv

Figure 4.9 Building a Temporal Convolutional Network (TCN) model….................40

Figure 4.10 The training process.............................................. .................................................. ...41

Figure 4.11 The backtesting process ................................................. ...............................................41

Figure 4.12 Import libraries................................................. .................................................. ....42

Figure 4.13 Obtaining stock data................................................. ...........................................42


Figure 4.14 NFLX stock data................................................. ...............................................43

Figure 4.15 Exploratory Data Analysis (EDA) on stock data................................................. ..44

Figure 4.16 Exploratory Data Analysis Results................................................. ...........................44

Figure 4.17 Close price visualization................................................. .........................................45

Figure 4.18 Taking the close column................................................. ...........................................45

Figure 4.19 Scaling function................................................. .................................................. ...46

Figure 4.20 Scaling results................................................. .................................................. ......46

Figure 4.21 Creating a variable to store data division ..................................47

Figure 4.22 Results of data division................................................. ...........................................47

Figure 4.23 Reshape function................................................. .................................................. ..48

Figure 4.24 Building the LSTM model and training process................................................. ......49

Figure 4.25 Creating variables to store testing data................................................. ..49

Figure 4.26 Prediction process................................................. .................................................. ...50

Figure 4.27 Prediction results from the LSTM model................................................. ...........................51

Figure 4.28 Import libraries................................................. .................................................. ....51

Figure 4.29 Obtaining stock data................................................. ...........................................52


Figure 4.30 NFLX stock data................................................. ...............................................52

Figure 4.31 Exploratory Data Analysis (EDA) on stock data................................................. ..53

Figure 4.32 Exploratory Data Analysis Results................................................. ...........................53

Figure 4.33 Close price visualization................................................. ...........................................54

Figure 4.34 Taking the close column................................................. ...........................................54

Figure 4.35 Creating future days variables and prediction columns.................................55

Figure 4.36 Column new prediction................................................. ...........................................55

Figure 4.37 Creating independent and dependent variables................................................. ......55

Figure 4.38 Dividing the dataset into training and testing data ................................................. .56

Figure 4.39 Model creation and training process ............................................... ...................56

Figure 4.40 Creating the x future variable................................................. ...............................57

Figure 4.41 Prediction process................................................. .................................................. ...57

Figure 4.42 Prediction results from the two models................................................. ...........................58


Machine Translated by Google

xvi

Figure 4.43 Function for displaying TCN visualization ............................................... ........59

Figure 4.44 Visualization of TCN model predictions as a whole.................................................59

Figure 4.45 Visualization of TCN model predictions in detail................................................. ..60

Figure 4.46 The function for displaying the LSTM visualization................................................. .......60

Figure 4.47 Visualization of predictions for the LSTM model as a whole ...............................................61

Figure 4.48 Visualization of the predictions of the LSTM model in detail.................................................61

Figure 4.49 Function for displaying Linear Regression visualization.................................62

Figure 4.50 Visualization of Linear Regression model predictions as a whole ..................63

Figure 4.51 Visualization of Linear Regression model predictions in detail ..................63

Figure 4.52 Function for displaying the visualization of the Decision Tree model.................................64

Figure 4.53 Visualization of the overall prediction of the Decision Tree model .........................64

Figure 4.54 Visualization of the predictions of the Decision Tree model in detail.............................65

Figure 4.55 Function to calculate error ............................................... ............................66


Machine Translated by Google

PIG
INTRODUCTION

1.1 Background
Access to information that is getting easier opens the way for the financial world to be increasingly recognized by

society at large. The community is increasingly understanding the importance of asset management

they have to use for future plans or multiplying


value. One of the popular financial instruments among Indonesian people is
share. Based on data released by the Indonesia Stock Exchange (IDX) listed in
in the last one year to March 2021, the growth of new investors in Indonesia
reached 27% (investasi.kontan.co.id, 2021). When viewed from a demographic perspective, new investors

is dominated by the younger generation under 30 years of age with a percentage of 57.40%.
(CNBC Indonesia, 2021). This significant growth is one
the positive impact due to the Covid-19 pandemic, people are moving their assets to
investment instrument to maintain its value. Even though at the beginning of the pandemic the Stock Price Index

The Composite Index (IHSG), which had experienced a correction, reached 32%. Besides that, a lot

fintech companies that provide investment platforms make it easier for the public
to start investing.
Not only in Indonesia, the US stock market also experienced an impact
as a result of the Covid-19 pandemic. Positive cases of Covid-19 in the United States alone
is the highest in the world reaching 18 million cases by the end of 2020
based on data from Johns Hopkins University which is very influential on the situation
many large companies have their shares on the American stock exchange. But after experiencing
correction at the start of the pandemic, in the second half of 2020 stocks in the S&P 500 index
and the Nasdaq began to strengthen beyond the price before experiencing a correction that was accompanied by

development of the production of the Covid-19 vaccine. The S&P 500 Index closed up 0.5% percent,

while the Nasdaq index of shares of technology companies closed up 0.95%. However
the Dow Jones index of industrial stocks closed below its pre-slump price
by 0.3%. Technology companies benefiting society
who should stay at home like Amazon, Netflix, and FedEx are leading the recovery
happened and even FedEx stock is the best performing stock on the S&P index
500 (Ika Ramadhani, 2020).
Machine Translated by Google

.While the definition of shares themselves according to the Indonesian Stock Exchange (IDX), shares are

sign of capital participation of a business entity in a company or company

limited. With equity participation, the party has a claim on income

company, claims on company assets, and has the right to attend the General Meeting of Shareholders

Shares (GMS) (IDX, nd). These tokens can later be traded on the stock exchange

shares along with the occurrence of price fluctuations to benefit from

capital gains. Or obtained from the distribution of profits generated by

company, or commonly known as dividends.

However, as a company's shares are released to the public and are traded on
stock exchange, the share price will fluctuate. Internal and external factors can

affect the stock price (Zainuddin & Hartono, 1999). Internal factors can

seen from the performance of the company that issued the shares, the company's performance can be

seen from the company's financial statements. While external factors are the impact of
environment outside the company that can affect directly or indirectly

direct. Which includes the economic conditions in which the company is located, social conditions

and the politics of the country. In addition investors must understand the law of demand as well

deals that occur on the stock exchange, understanding this can help investors to

determine trend predictions of stock price movements (Kusumodestoni & Sarwido, 2017). With
Knowing the trend of stock price movements, investors can use it to

maximize profits and minimize losses.

To predict the trend of stock price movements in addition to paying attention to fundamentals

companies and reading stock price charts, can take advantage of artificial technology

intelligence especially deep learning. Deep learning itself is a derivative of


machine learning, which is part of the branch of artificial intelligence.

The concept of machine learning is to try to imitate how the human brain works,

the machine is trained using certain algorithms to learn from complex data and

a lot continuously and repeatedly. So that the machine is able to get

information or patterns from these data (Karno, 2020). Information that has been obtained
later it will be used to predict patterns from data that will occur in the future
stock data.

In its utilization, the data that can be processed in deep learning models is very diverse.

Algorithms applied to deep learning models must also be adapted to

data used. The stock data itself has a time series data type, where each
Machine Translated by Google

data is recorded based on time and the data has an attachment to the data
previously recorded. Then the results of the predictions will be used to update the data
used for learning (Karno, 2020). Data with characteristics
can be processed using the Recurrent Neural Network (RNN) algorithm. Algorithm
RNN is designed to process sequentially by utilizing memory for storing
data that has been pre-processed which makes it possible to recognize patterns from data with
good (Olah, 2015). In this research, we will try to find a machine algorithm model
learning or deep learning to predict trends in stock price movements, especially
will focus on the Temporal Convolutional Network (TCN) algorithm. Based on
research carried out by (Bai et al., 2018) the TCN algorithm which utilizes the
convolution shows more accurate results than algorithms such as LSTM and GRU
in processing sequential data, and the architecture formed is simpler and clearer.
The stock data that will be used is the stock data from Netflix, Inc (NFLX), because
during the Covid-19 pandemic, Netflix was one of the services that was affected
positive. With the company's revenue increasing to reach 24% at the end
quarter of 2020 according to data from (money.kompas.com, 2021), so the stock is attractive
to analyze and predict.

1.2 Problem Formulation

From the background that has been described previously, the formulation of the problem is:
as follows:
a. How to build and evaluate the Temporal Convolutional algorithm
Network (TCN) in predicting the trend of stock price movements?
b. Comparing the performance of the Temporal Convolutional Network (TCN) algorithm with
another algorithm in the case of predicting stock price movements.

1.3 Research Objectives


The objectives of achieving this research are:
a. Knowing the performance of the Temporal Convolutional Network (TCN) algorithm and
compare with some machine learning algorithms to find out
which algorithm gives maximum results in predicting trend movements
stock price.
Machine Translated by Google

b. Building trend visualization of stock price movements predicted by the algorithm

Temporal Convolutional Network (TCN) and compare them with prices

the actual shares that occurred.

c. Knowing whether predictions are made with the Temporal algorithm

Convolutional Network (TCN) can be used in decision making


stock investment.

1.4 Research Benefits

The expected benefits of this research are:

a. By knowing the performance of the Temporal Convolutional Network (TCN) algorithm

and other algorithms, it is hoped that the algorithm that gets good performance can

used to predict the trend of stock price movements in the stock market.

b. Providing technical insight to investors and market participants

It is hoped that this can be used as a reference before making a decision


stock investment.

1.5 Problem Limitation

The limitations of the problem used in this study are:

a. The model developed in this study is only for one stock issuer, namely

shares of Netflix, Inc (NFLX).

b. The predictions made are for 60 days.

c. Comparison of prediction results based on values obtained from Root Mean Squared

Errors (RMSE).

1.6 Research Methodology

This study uses the following research methods:

a. Literature study, the first stage to be carried out is the search for the problem you want

raised in this study by searching through the literature

research that has been done before as well as from problems that occur in

around. Literature study was conducted with the aim of knowing the state of the art of research

research with a similar topic.


Machine Translated by Google

b. Data collection, the data to be used is historical stock price data

selected. Data obtained from the Yahoo Finance website, the range of data taken

can be determined according to need.

c. Data processing, after stock data is obtained then the data must be processed first

first with the aim of adapting it to the algorithm that will be

used. Also, checking whether the data used exists

irregularities and data is divided into training and testing data.

d. Algorithm modeling, building a machine learning algorithm architecture that will

used and perform hyperparameter tuning.

e. The training and testing process, after the machine learning algorithm model is complete

built then the data is entered in the model and the training process is carried out.

The model that has completed the training process will then be tested

performance using data testing.

f. Model evaluation, model testing performance will be evaluated using metrics

measurement error that occurs. Next will be compared and analyzed with

performance of other algorithm models.

1.7 Systematic Writing

In the systematics of writing, the writing is divided into five chapters, namely as follows:
Chapter I Introduction

This chapter contains an explanation of why this research was conducted.


CHAPTER II Theoretical Basis

This chapter contains literature from previous studies

previously carried out on the theme raised in this study, which will

used as a reference.

CHAPTER III Basis of Research Methodology

This chapter contains the stages in conducting research, stages


described in detail.

CHAPTER IV Results and Discussion

This chapter contains the results of the research that has been done,

problems that occur in research and analysis of the results that have been

obtained.
Machine Translated by Google

CHAPTER V Closing

This chapter contains the conclusions of the research that has been done as well

suggestions for future research.


Machine Translated by Google

CHAPTER II

THEORETICAL BASIS

2.1 Stock Analysis

Before investing in stocks, investors must understand investment instruments

that would want to invest. There are many considerations that must be taken carefully

by investors, in order to get companies that have good prospects and stock prices

best (Filbert, 2020). As you know, stock price movements are very volatile

Therefore stocks are classified as investment instruments with very high risk.

Even so, in line with the risks borne, the potential benefits are obtained

also getting bigger. With the right analysis, this potential can be exploited by

investors to gain profits. In analyzing a stock, there are three ways

what is usually done:

2.1.1 Fundamental Analysis

Fundamental analysis is an analysis that is carried out by focusing on

financial statements issued by companies listed on the stock exchange with a view

sides: Profitability (profit), Solvability (company liabilities and assets), Liquidity (ability

pay off debts), and Activity (business continuity) (Filbert, 2020a). Apart from the internal side

company, seen also from the external side related to the corporate sector

such as government policies, changes in interest rates, inflation and others

etc. The results of the analysis produce an assessment of whether the company's shares

is worth buying or not. If the conclusions obtained are considered stock prices

too expensive compared to its fair price based on the value of the company, then shares

recommended for sale rather than buying it. Meanwhile if that happened

otherwise, the shares are recommended to be purchased (Agusta Nanda et al., 2016).

The assessment is long term, due to the company's financial statements

published quarterly or annually. Then the assessment will be updated every time there is

new financial report issue. However, the problem is that investors often lack

information because it only relies on fundamental analysis which results in no

precise timing when making decisions. For this reason, investors can see price movements

stocks through technical analysis.


Machine Translated by Google

2.1.2 Technical Analysis

Technical analysis is an analysis of the historical movement of stock prices in the form of prices

opening, closing price, highest price, lowest price, and trading volume on

certain period presented in graphical form (Filbert, 2020). To observe the chart

This stock price movement requires a charting application that is usually provided

by the stock broker chosen to make the investment. Technical analysis is more used

to observe price trends that are happening and within these trends there are patterns

prices are formed, these patterns are used to predict trends

will happen next. Thus, technical analysis provides a clear picture

simplified and comprehensive information about current stock prices (Suresh, 2013).

Technical analysis itself was first put forward by Charles Henry Dow in

early 19th century whose name is now used in the name of the industrial stock index in America

namely the Dow Jones Industrial Average (DJIA). The theory explains that price movements

90% stock is influenced by psychological factors and 10% logical factors. Prices are determined by

the market participants themselves, whether it is considered too expensive or cheap. dow theory

only explains the direction of trend movement and does not predict future prices. Theory

it uses the share price as a barometer of a company's business condition, it is assumed

that stock prices follow the underlying business (Suresh, 2013). Here are a few

important information contained in technical analysis (Hafizah et al., 2019).

Market Trends

Trends are the tendency for stock prices to move in a certain direction

a span of time (Hafizah et al., 2019). There are three trends in stock trading, namely,

uptrend (increasing trend) when the demand for the stock is more than the supply then

prices will increase. Downtrend (downtrend) is the opposite of the trend

increase, when the demand for the stock is less than the supply. And trend

sideways (consolidation) that is when the price is looking for the direction of the next usual trend

occurs after an uptrend and a downtrend. Figure 2.1 shows the trend in price

stock chart form, a trend is formed by rising and falling phases. trend

bulls occur when the price forms higher troughs and peaks. trend

decline when the price forms lower troughs and peaks. While trend

Consolidation forms prices that tend to be flat.


Machine Translated by Google

Figure 2.1 Trend of stock price movement

Source: (Tri Retno, 2021)

In the formation of a trend, it can be divided into four basic phases so that it is formed

a price movement (Filbert, 2020a). In the first phase is the climbing phase or

reversals, in this phase are usually accompanied by news that does not support

market situation. The second phase is the bullish phase, investors start to enter and cause prices

started to increase. Furthermore, the third phase is the saturation phase, where the price is considered

is too high so it is considered less attractive to buy. The last is the phase

reversal, the price experienced a reversal of the direction of the original trend. These phases occur

repeatedly on every price movement with different timeframes.

In fact, the trend of stock price movement itself is a representation of the taking

decisions by investors when trading stocks, in making

the decision of investor psychology is influenced by the emotion of "fear and greed" (R Tristia, 2019).

That is, when investors experience the emotion of fear or fear, they will tend to

sell their assets for fear that the price will fall further, causing the price to drop

in the market will fall further. Conversely, when investors are too greedy or greedy

to buy assets that are experiencing price increases, so that asset prices will increase

experienced an increase and did not rule out buying at the current price

too high. Decision making by investors is more subjective, emotional and

psychological factor that can dominate in decision making, the fall in prices

stocks often occur due to excessive market reactions (Lestari & Pranyoto, 2015).
Machine Translated by Google

10

Charts

Charts are used to represent stock price movements which helps


investors to observe visually. The chart is arranged in time order on the X axis
(horizontal axis) and prices are arranged on the Y axis (vertical axis) (Hafizah et al., 2019).
There are several charts used to represent stock prices, namely (Sekar,
2020):
The first is a line chart, composed by a single line that connects between
formed price. The line chart is very simple, it only displays price information
just closing. Because of this, the line chart is suitable to be used to conclude conditions
the trend of stock prices is trending up or down and makes it easy to determine
key price points. Figure 2.2 shows NFLX stock prices
using line charts.
The second is a bar chart, composed by bars arranged at each time interval
which contains information about the opening price (open), closing price (close), price
the highest (high), the lowest price (low). If the closing price is lower than the closing price
opening then the stem will be depicted in red. Conversely, if the price
the close is higher than the open price then the bar will be drawn with
green color. On the bar chart shows more information than the line chart,
Bar charts can be used to find out how significant price changes are
occurs, the longer the stem formed, the more significant the changes will be
happen. Figure 2.3 shows NFLX stock prices using a bar chart.
The latter is a candlestick chart, but has a shape like a bar chart
has a body that is shaped like a candle and has a more comfortable appearance to
used. Candlestick chart is the most widely used chart on the exchange. Besides
displays prices, candlestick charts also form candle patterns that can be
identified so as to make it easier to read the trend or momentum that is occurring.
Figure 2.4 shows NFLX stock prices using a candlestick chart.
Machine Translated by Google

11

Figure 2.2 Line chart on NFLX shares


Source: (tradingview.com, 2021)

Figure 2.3 Bar chart on NFLX stock


Source: (tradingview.com, 2021)
Machine Translated by Google

12

Figure 2.4 Candlestick chart on NFLX shares


Source: (tradingview.com, 2021)

Support and Resistance


Furthermore, to get more information from the chart , you can draw lines
with the concept of support and resistance. Support is a price that is believed to be a point
or the lowest area in a certain time range. While resistance is the price
believed to be the highest point or area in a certain time span (Filbert, 2020b). For
determining points or areas on support and resistance can use the method
connecting the extreme points formed by the price in the form of a horizontal line.
An area of support is an area of resistance that was formed in the past, if the price has
form a new peak beyond the resistance area it will turn into an area
new support . Figure 2.5 shows areas of important support and resistance
on NFLX stock prices.
Machine Translated by Google

13

Figure 2.5 Support and resistance areas for NFLX stocks

Source: (tradingview.com, 2021)

Indicator

Apart from using the traditional way of analyzing stock price trend movements,

can also apply modern technical analysis that utilizes stock price indicators.

Indicators on stock price movements are tools that are used to help

in technical analysis, which utilizes statistical formulas on stock prices to

determine movement trends (Hafizah et al., 2019). There are two types of indicators, the first

is a trend following indicator that aims to follow the trend of stock price movements

the. Trend following indicators are formed more slowly than price movements and

located attached to the chart. And the second is an oscillator indicator that shows

the level of a stock price is already in a state of overbought (over bought) or oversold (over

bought) (Pramudya & Pramudya, 2020). The occillator indicator itself is an indicator that

moves ahead of price movements and is located separately from the chart (Ahmar, 2018).

2.1.3 News

Apart from analyzing fundamentally and technically, you can also take advantage of the news

news or sentiments circulating related to the industrial sector or company that

own the shares. Analyzing based on news is usually said to be

sentiment analysis. Stocks are very sensitive to the news circulating because

investors can experience panic over the sentiment that is formed is negative,

so stock prices tend to experience a lot of selling, it is commonly known


Machine Translated by Google

14

with Fear, Uncertainly, and Doubt (FUD). Conversely, if the resulting sentiment is

positive, then investors will tend to be interested in buying.

2.2 Netflix

Netflix is a paid streaming platform from the United States that provides

wide selection of movies and TV series. These services can be enjoyed through various

devices such as smart TVs, smartphones, tablets, PCs, game consoles, and laptops. Company

Netflix, Inc. founded by Marc Randolph and Reed Hastings in 1997 in Los Galtos,

California, United States. Initially, Netflix provided a DVD rental service

physically which can be ordered online. The following year, Netflix started

shifting its business strategy into a subscription system to enjoy its services.

Customers pay a subscription fee and are free to rent the various DVDs available, and

also Netflix began introducing a recommendation system for its subscribers.

After the business began to grow enough, in 2002 he made a decision

to conduct an Initial Public Offering (IPO) on the American stock exchange, the National Association

of Securities Dealers Automated Quotation (NASDAQ) with the stock name “NFLX”. Netflix

managed to get 4.2 million subscribers in 2005. In 2007 Netflix started

released its streaming service platform that allows subscribers to go live

enjoy the service through his personal computer directly. In addition to expanding

In terms of business scope, Netflix began to open various partnerships with companies

technology companies such as Xbox, Apple, Playstation, Blue-ray disc players with the goal of being

its services can be enjoyed on various devices connected to the internet. In 2013

Netflix records that it has 31 million subscribers. Not only in the United States,

Netflix service can be enjoyed in various countries in the world as it develops

internet, In Indonesia alone, Netflix started to enter in 2016 (axa.co.id, 2019).

According to its founder Hastings, Netflix's success is based on subscribers

already started to be dissatisfied with traditional TV broadcasts caused by advertisements.

Netflix doesn't have annoying ads, because it's a paid service. Customers can

enjoy watching whatever they want anytime and anywhere without having to

adhering to schedules and being interrupted by advertisements. Now, the streaming service Netflix is one

who have been positively affected by the ongoing Covid-19 pandemic. Covid-19 pandemic

resulting in people having to reduce their outdoor activities and many

do indoor activities. This resulted in a spike in new users


Machine Translated by Google

15

Netflix due to the need for entertainment services to accompany people during
pandemic. Based on data (money.kompas.com, 2021) new Netflix subscribers are registered
experienced an increase of 30%, namely as many as 37 million new users, the majority
are outside the United States. The company's revenue also increased by
24% in the final quarter of 2020, revenue of 6.6 billion US dollars was recorded with
profit of 524 million US dollars .

2.3 Artificial Intelligence


Artificial Intelligence is a branch of science
computers developed so that software and hardware can think and behave
like humans (Roihan et al., 2019) can even be better and able to do
tasks that humans cannot do. Meanwhile, according to (Rich et al., 2019)
is how to design computers to be able to do things nowadays
done by humans. At first the computer was used to do the task
computing alone, but as technology develops it is hoped that computers can
empowered to facilitate a variety of human work. In designing the system
Artificial intelligence has two main parts. Figure 2.6 shows
part of an artificial intelligence system.

Figure 2.6 The main parts of an artificial intelligence system


Source: (Nurhikmat, 2018)

a. Knowledge Base , this section contains the data used


by the system to learn and make it intelligent.
b. Inference Engine (Decision Making Machine), the part that has the ability
to make decisions or conclusions based on a knowledge base
owned by the system.
Machine Translated by Google

16

Artificial intelligence requires data to be used as a knowledge base such as


man. The data will be used for learning, as more and more
system learning will get smarter. The important point of artificial intelligence is the process
learning, reasoning, and self-correction (Dicoding, 2020). The field of artificial intelligence
has a very broad scope. Figure 2.7 shows the various parts of an artificial
intelligence.

Figure 2.7 Parts of artificial intelligence


Source: (Roziq, 2021)

2.3.1 Machine Learning


Machine Learning is a part of the field of science
Artificial intelligence computers developed so that software and hardware can
think behave like humans (Roihan et al., 2019). To be able to develop
Artificial intelligence system so that it can carry out tasks like humans, aspects
the most important thing is how the system can learn so as to get information
the information it needs to do its job.
For this reason , machine learning was developed, the concept is to train machines
using a mathematical algorithm model through input data with a goal
obtain information (knowledge discovery/ discovery unknown structure) and predict
pattern (pattern discovery) independently (Gotama, 2018). Machine learning processes for
Machine Translated by Google

17

acquire intelligence through the stages of training (training) and testing (testing) (Huang et
al., 2006). The more often a machine is trained and tested, the smarter it will be and
the ability to recognize more accurate guard information. Knowledge used on
machine learning is more towards math and statistics. Like a math formula,
machine learning is used according to the problems encountered and the data
used.
Machine learning itself can be divided into three categories, namely: Supervised lLearning,
Unsupervised Learning and Reinforcement Learning (Roihan et al., 2019). Figure 2.6
shows the division of categories in machine learning.

Figure 2.8 The division of categories in machine learning


Source: (Mustofa, 2017)

a. Supervised Learning, is learning that is done by giving


label on the data so that it can be classified, such as data on the input data where
the desired output is known. Stages of learning carried out, machine
will receive a series of input data with a known output and
studying it will then compare it to the actual output with
predictions made by the machine. Supervised learning will then use
patterns that have been found in the learning process to predict grades or
labels on new data (Samsudiney, 2019). Supervised learning can be classified
in classification and regression forms, classification occurs when outputs are generated
in the form of categories while regression when the resulting output is a real value
(Brownlee, 2016).
Machine Translated by Google

18

b. Unsupervised Learning, is learning that is done without a label


on data. The machine doesn't know which output is correct, its purpose is to
explore the data (Samsudiney, 2019). Unsupervised learning can
classified in the form of clustering and association, clustering is done for
grouping data based on similarity while association is done for
describe the attachment between data (Brownlee, 2016).
c. Reinforcement Learning, is learning that does not require
prior knowledge or information. The machine can learn independently to
obtain information through a process of "trial and error" continuously in
dynamic environment (Qiang & Zhongli, 2011).

2.3.2 Deep Learning


Deep learning (Deep Learning) or Deep Structured Learning (Learning
Deep Structural) is a derived field of machine learning that leverages
Artificial Neural Network (Artificial Neural Network). Namely with the concept of adding
There are many layers in the model so that the learning process becomes more complex and deep.

Then what distinguishes it from machine learning is the data used


huge amount of data. That way it also requires a very heavy computational process
which requires qualified hardware specifications, Graphics is usually used
Processing Units (GPUs). And also deep learning has the main feature, namely feature
engineering, which is to reduce the level of complexity of the data by extracting the pattern
useful for facilitating the model in distinguishing classes.

2.3.3 Artificial Neural Networks


As with the neural network in the human brain and nerve cells, artificial neural network
has the concept of neurons that are connected to each other. Neurons will accept
information from the input data is then channeled to other neurons until it ends with
output results . In neurons there is Weight (Weight) and the activation function used for
determine the properties of a neuron (Nurhikmat, 2018). According to (Pham & Pham, 1999)
artificial neural network is an adaptive system that can solve a problem
by changing its structure based on internal and external information. Picture
2.9 shows the structure of a neuron.
Machine Translated by Google

19

Figure 2.9 Structure of a neuron

Source: (Nurhikmat, 2018)

The way a unit of neurons works is like a human neural network, neurons will

receive input data in the form of independent variables (X 1, X2, X3, …, Xn). Then input data

on neurons there are weights in the form of (W1, W2, W3, …, Wn) which are connected to each other

every node. Then the input data and weight will be processed mathematically

using an activation function. The results of the process will then be compared

with a threshold value (threshold), if the result exceeds the threshold value then the neuron will

activated and information is passed on to the next neuron via its output weights and

so rival. If not, these neurons will not be active and information will not be received

next. Neurons will be arranged in a layer (layer) which contains many neurons.

Each of these layers will be interconnected with other layers before and after it,

except for the input layer and output layer. Connections between layers are connected to each neuron,

so a neuron will be connected to all neurons in the layer before and after it. On

a layer, the weight of each neuron will have the same value. Structure on artificial

Neural networks can be distinguished according to the number of layers contained in the network.

Figure 2.10 shows the structure of an artificial neural network.

Figure 2.10 The structure of an artificial neural network

Source: (Wayan, 2018)


Machine Translated by Google

20

The simplest, there is a single layer neural network structure that is only
It has a single layer, namely the input layer and output layer only. Each neuron in the input layer
directly connected to the output layer, this network structure only accepts input later
processed directly into output results. Then there is a multiple layer neural structure
network, in this structure there are input layers, output layers, and hidden layers. On hidden
this layer can be set how much depends on the complexity of the problem
faced. Algorithms that use structures like this are called algorithms
deep learning, because layers are used so much that the learning process will
deeper and more complex.

2.4 Temporal Convolutional Network (TCN)


The use of the convolution approach has been very widely applied to
the process of predicting and building deep learning models using the Convolutional algorithm
Neural Networks (CNNs). Various recent studies have also applied many algorithms
CNN with various modifications for various needs. But this raises
question to the researchers, whether the success of modeling using the approach
convolution is only limited to certain domains or can also be applied to domains
sequence processing and recurrent networks as well (Bai et al., 2018). Sequence modeling
processing and recurrent networks generally use algorithms that utilize
Recurrent Neural Networks (RNN) such as Long Short Term Memory (LSTM) and Gated
Recurrent Units (GRU). The RNN algorithm is one of the developments of the architecture
ANN algorithm, developed specifically to overcome the problem of having data
sequential characteristics (sequential). In addition, the RNN algorithm also utilizes a
memory to store results from the past in the learning process, that is
allows the model to recognize patterns in data more accurately (Yanuar, 2018).
Various studies have tried to use the convolution approach for processing
problems with sequential data, the performance obtained is able to outperform the algorithm
RNN in various problems and can reduce problems that often occur, namely
exploding/ vanishing gradients (Lässig, 2020). Vanishing gradient
is a problem that arises when the model performs the process of calculating the derived value
of the weight possessed by each neuron by way of backpropagation (Calculation
backward). The longer the layer passed back to back, the value
the weight will get smaller and closer to 0, especially if the process is done repeatedly
Machine Translated by Google

21

repeated (Herlambang, 2019). For this reason, the Temporal Convolutional algorithm was introduced

Network (TCN) is an algorithm that utilizes a one-dimensional convolution process and

used to process problems in sequential data. TCN has characteristics

specifically (Bai et al., 2018).

a. The convolution process in the TCN architecture is causal, meaning there is no "leakage"

information from the future to the past.

b. The architecture can process any length of data and will produce output

the same length.

c. Ability to look far into the past to make predictions, use

very deep architecture and augmented by residual and dilated layers


convolution.

2.4.1 Sequence Modelling

Before discussing the architecture of the Temporal Convolutional Network (TCN), it is necessary

understood about problems in sequential data modeling or commonly called time series.

With the following input data X = ( 0, 1, 2, …, T) and try to predict the output

as follows Y = ( 0, 1, 2, …, T). The limitation is that to predict the output

T, can only use previously observed input data (Wan et al., 2019).

(2.1)

It can be seen that T only depends on X = ( 0, 1, 2, …, T) Not on

future input data such as T+1. The goal of sequence modeling is to search

network that minimizes some differences between the actual output data and the results

prediction. Where the target output is then used as input data for predictions

next, and continuously shift towards the next data by time step (Bai et al., 2018)

2.4.2 1 Dimensional Convolutional Networks

The 1 dimensional convolutional network process is a convolution process that is carried out

on data that has only one dimension such as sequential data. Tensor input data form

has configuration (bartch_size, input_length, input_size) and will generate later

the same tensor output data as well namely (batch_size, input_length, output_size). Because every

layers in the TCN architecture have the same input and output length, so only input and
Machine Translated by Google

22

only the tensor output is different. Since it is only one dimension, the value of input_size and

output size is equal to one. Figure 2.11 shows how process 1

dimensional convolution which converts inputs into outputs.

Figure 2.11 1 dimension convolution process

Source: (Lässig, 2020)

Each convolution process will take place in every data on all of the tensor inputs .

In the picture, the kernel size is three, so the process will be carried out every three data.

The kernel has the same weight on every running process. It can be seen that each

one data in the tensor output is the result of a dot calculation from the kernel on the tensor input.

The process continues the same as the kernel will start moving towards the next data each time

one record. But to be able to get the same length of data on the input and output of the tensor

need to add zero-value padding at the beginning and end of the data.

2.4.3 Causal Convolutions

It was mentioned earlier that TCN cannot use information from the future

to carry out the convolution process. So to avoid those problems, process

the prediction uses causal convolution that is using only the current data and the data

earlier (Liu et al., 2019). This can be achieved by adding

padding with zero values at the beginning and end of the tensor input data, to calculate the amount of padding

the formula used (Wang et al., 2020):


Machine Translated by Google

23

(2.2)
Where:

= Number of paddings

= Kernel size

Figure 2.12 The process of causal convolutions

Source: (Lässig, 2020; Wang et al., 2020)

Can be seen in Figures 2.12 a and b, the difference is when using the causal process

convolutions and no. In figure c, there are four data and sizes used

kernel three, so the amount of padding to be added is kernel size – 1 which is 2.

The convolution process on the first data is using the two previous data, namely padding,

to get the output of the first data, and the same thing applies to

the next data so that the tensor output data has the same length as the input data.

2.4.4 Dilated Convolutions

The process of convolution on the input data which will later produce the output data, the result

depending on the kernel used and previous data. Suppose the length of the input data

is 5 with kernel size is 3, then the 5th data will depend heavily on the ke data

3 and 4. For that to avoid dependence on the data the model is able to capture

attachment to long-term data, the concept of dilated convolutions is used, namely

adding more layers in the network and extending the reach of the kernel on the layer

next by passing some data. That is, the output data must be connected to the data

input data from the very distant past. dilated convolution can be defined as
following:
Machine Translated by Google

24

(2.3)

Where d is the value of the dilation, k is the value of the kernel and s-dxi indicates
steps taken backwards. To calculate how many layers are needed,
and calculating the receptive field can use the formula:

(2.4)

(2.5)
Where:

ÿ= Number of layers

ÿ = Data length
= Kernel size

ÿ= Range of data passed through the dilation process

Figure 2.13 Dilated Convolution

Source: (Lässig, 2020)

In Figure 2.13 you can see an example of using dilated convolution with length
data is 4, kernel size is 3, dilation value is 2, and traversed data range
is 5. If there is no dilatation process, the range of data traversed is the same as the size
the kernel is 3, whereas if it experiences a dilatation process the data range widens to 5.
However, if the dilatation value remains constant, a very long data layer will be required
next. For this reason, in the next layer , the dilatation value will increase incrementally
exponential is shown in figure 2.14, the dilation base constant represented
Machine Translated by Google

25

with ÿ and the calculation is shown in the formula. In Figure 2.14 the length is used

data is 10, kernel size is 3, dilation base is 2, and the number of layers is 3.
In practice the value of the kernel must be greater than the dilatation base. And also impact
the amount of padding will increase for each layer so a formula is needed
new namely:

(2.6)

(2.7)

Figure 2.14 Dilation base

Source: (Lässig, 2020)

2.4.5 Residual Connections

In a simple TCN architecture, each layer will be interconnected with other layers ,
whereas if you use residual connection data it can be channeled directly without having to
through various layers (Wang et al., 2020). Figure 2.15 shows the difference in structure
TCN before added residual connection and after.

Figure 2.15 Structure of residual connections

Source: (Lässig, 2020)


Machine Translated by Google

26

In Figure 2.15, the kernel size is 3 and the dilation value is 2. Can
Look at the changes after adding the residual connection, the output results from both layers
will later be added to the input of the residual block to produce input
on the next block . Due to the convolution process in the first layer of the residual block
first and convolution processes in the second layer of the residual block the last may have
the length of the input data is different, then the length of the residual block must be adjusted accordingly

1x1 convolution process. Adding residual blocks to the TCN architecture makes more
more ranges of data traversed than the usual model. The changes are required
Recalculate how many layers are needed to cover the value

all data. So the data range with dilatation base ÿ, kernel size with ÿ ÿ, and number

residual block n can be formulated as follows:

(2.8)

(2.9)

2.4.6 Activation Function, Normalization, and Regularization


To make TCN not just a complex linear regression model, it is necessary
added activation function above the convolution layer. The activation function used
is the Rectified Linear Unit (ReLU) which causes the model not to be linear (Bai et al.,
2018). The process of normalizing the input on the hidden layer so that an exploding gradient does not occur ,

added weight normalization on each convolution layer. Next to prevent


If overfitting occurs , regularization is used using the dropout function at the end
each convolution layer. The TCN structure after adding the three functions is shown
in Figure 2.16.
Machine Translated by Google

27

Figure 2.16 Addition of activation, normalization, and regularization functions


Source: (Lässig, 2020)

2.4.7 Final Model

Figure 2.17 shows the final model of the Temporal Convolutional algorithm
Network (TCN). Where l is the data length, k is the kernel size, b is the
dilatation base with k ÿ b, the minimum number of residual blocks is n.

Figure 2.17 TCN final model

Source: (Lässig, 2020)


Machine Translated by Google

28

2.5 Evaluation Matrix

To determine the level of accuracy of the prediction results obtained by the machine model

learning can use evaluation matrices. Please note that in machine modeling

learning itself can be divided into two types, namely classification and regression modeling.

Classification itself is a modeling used to group data

into a number of classes or certain categories, while regression is modeling

machine learning by carrying out the process of identifying data to find something

relationships (Suyanto, 2018). The evaluation process in classification modeling can generally be

using an evaluation matrix with a confusion matrix that is calculating the level of accuracy of

model, while for regression modeling can use the Root Mean evaluation matrix

Squared Error (RMSE), namely by calculating the difference between the predicted value and the actual value.

The smaller the RMSE value generated from an algorithm, the smaller the amka value

the error or the difference between the predicted value and the actual value is very small.

2.5.1 Mean Absolute Error (MAE)

Mean Absolute Error (MAE) is an evaluation matrix that calculates absolute values

from the average difference between the predicted value and the actual value. The formula of MAE itself is defined

as follows:

(2.10)

Where:

Y' = Predicted value


Y = Actual value

N = Number of data

2.5.2 Mean Square Error (MSE)

Mean Squared Error (MSE) is an evaluation matrix similar to MAE, however

uses a quadratic process to calculate the error value. Formula from MSE itself

defined as follows:
Machine Translated by Google

29

(2.11)

2.5.3 Root Mean Squared Error (MAE)


Root Mean Squared Error (RMSE) is an evaluation matrix that adds processes
calculation of roots on the MSE matrix. The RMSE formula itself can be defined as
following:

(2.12)

2.6 Related Research

There are 7 research journals that are used as references in the planning process
in this research. Related studies are presented in tabular form
makes it easy to see the results and solutions offered on predicting trend movements
stock price.

Table 2.1 Related Research

Journal No Algorithm Datasets Results

Using the LSTM algorithm to make


(Zayini
predictions. The prediction results obtained
Anwar & Share
Long Short are quite good, with an RMSE value of 0.2286.
1. Habibi, Term Memory apples So the researchers concluded that the LSTM
n.d.) (LSTM) (AAPL) algorithm is quite effective for predicting stock
prices.

This study uses 4 different LSTM models, (i)


LSTM univariate input data of 1 week (ii)
LSTM univariate input data of 2 weeks (iii)
Encoder-Decoder LSTM univariate input data of
Long Short
(Mehtab Index 1 week (iv)
Term Memory
et al., Share LSTM multivariate encoder-decoder input data
2. (LSTM)
n.d.) Multivariate NIFTY of 2 weeks. Price predictions are made for
and Grid 50 the price of one week. The results show
Search that the LSTM model is quite effective for
predicting stock prices, but the multivariate
dimension gives unsatisfactory results and
takes a long time to compute.
Machine Translated by Google

30

Combine the LSTM algorithm with CNN,


Combination then compare the results with the LSTM and
normal CNN algorithms. Extract features and
Long Short
graphic images on stock data. The results
Term Memory
(Kim & Index obtained by the combination model can outperform
(LSTM)
Kim, Share the normal model performance. In
3. with
2019) Convolutional S&P 500 addition, information was obtained that the
neural candlestick chart is the most effective chart for
network predicting stock prices, and can minimize
prediction errors that occur. With an RMSE
(CNN)
value of 0.098.

temporal
(Bai et Convolutional
4. al., 2018) network - Introducing the permissions of the Temporal
Convolutional Network (TCN) algorithm.
(TCN)

Introducing the TCN algorithm with Multi


Channel modification (M-GTCN).
The algorithm is then compared with LSTM, GRU,
and TCN.
Makey
(Liu et al., temporal Glass It was concluded that TCN indeed has better
Convolutional performance than LSTM and GRU in the
5. 2019) data,
network single factor case. However, in multi-factor cases ,
OM2.5
(TCN) data the results of TCN are very poor. M-GTCN
can outperform other algorithms, but the
architecture is more complex.

Using the TCN algorithm to process cases


temporal with multivariate data types (M-TCN).
(Wan Convolutional The results obtained, the M-TCN
et al., network Beijing
6. PM2.5 algorithm has low generalization ability, the
2019) (TCN) with prediction results vary greatly in different datasets .

multivariate cases

Combination
Combines the TCN algorithm with representative
temporal
Convolutional learning called Stock2Vec. This is done
(Wang et Stock to find out the relationship between shares with
network
7. al., 2020) index one another. The results obtained were quite
(TCN) and S&P 500 good with an RMSE value of 2.22.
representatives
Learning

From the related studies that have been mentioned, predict the trend of movement
Many stock prices are developed using the Long Short Term Memory algorithm
(LSTM). However, in the LSTM algorithm itself or the development algorithm from LSTM
there are still many problems with the vanishing gradient. For this reason, the research conducted
Machine Translated by Google

31

by (Bai et al., 2018) started introducing a new algorithm using


the concept of convolution in processing time series data , namely the Temporal Convolutional Network

(TCN). TCN itself has several advantages compared to LSTM, namely using
backpropagation process to minimize the occurrence of vanishing gradients and is capable
process data in parallel so that long data can be executed quickly.
But data processing using TCN requires a larger storage time
carry out the evaluation process. TCN Algorithm Able to provide good and capable results
outperforms commonly used algorithms, shown in research (Bai et al., 2018)
namely LSTM, RNN, and Gated Recurrent Unit (GRU).
For this reason, this study was chosen to use the TCN algorithm because it is based on
Recent studies are showing that TCN gives better results though
use a different approach. The results obtained by TCN are strongly influenced by
the length of the processed data, while LSTM and GRU with the same length of data
the results are variable. LSTM accuracy can drop to 20% for data below 50,
while GRU drops to 20% for data below 200. With these results, you can
demonstrated that TCN is capable of processing long data and retaining history
more distant data (Bai et al., 2018). The TCN algorithm can also be modified for
various needs according to the problem at hand, such as combining with base
knowledge to determine the correlation between data as in research (Wang et al.,
2020). This research will try to compare the performance of the TCN algorithm with
LSTM algorithm as an algorithm that is quite widely used to predict prices
stocks, Linear Regression algorithms and Decision Tree Regression which are rarely used
to predict stock prices. As well as modeling the TCN algorithm using the library
quite recently developed namely Darts.
Machine Translated by Google

32

CHAPTER III

RESEARCH METHODOLOGY

3.1 Data Collection


NFLX stock data was chosen because it is one of the stocks included in the list

the NASDAQ-100 stock index, which has a very large market cap and

high liquidity so that the share price is not easy to manipulate and occur

sudden extreme price spikes. NFLX stock price movements are representative

various trends that occur, such as an uptrend, a downward trend, and a consolidation trend. No
rule out the possibility of using other stock data, every stock price is certain

formed from a combination of these three trends, but there is also stock price data that

the price has not experienced significant movement in a long period of time

and even the price is sprawl. For this reason, stocks that have fluctuating prices are selected
represent trend movements so that the built model can identify patterns

trend movement of the selected stock.

In this study the stock data to be used can be grouped as data

secondary, namely data that is not obtained directly by researchers but data that has been

provided by an institution or someone who is used as a research subject (Jati Lantang M,


2020). Netflix, Inc (NFLX) stock data is provided by a website providing information about

world of finance namely Yahoo Finance. The data is arranged in a daily timeframe, namely data

listed every day on the exchange day (Monday-Friday). Stock data in one year

an average of 252 to 253, not a full 365 days because there are holidays on the exchange.

The range of stock data used is from 1 January 2015 to 31 May 2021, with
the amount of data is 1613 and there are 6 columns, namely the opening price (open), closing price

(close), lowest price (low), highest price (high), transaction volume, and adj close. On

This research will only use the closing price (close), because on the stock exchange day the price

will experience fluctuations, the closing price is used which is the last price

on the exchange day. Then data with daily timeframes are used because of predictions
trends to be done to know the big picture of trends and predictions will be

used for medium term investment. The data is retrieved using the pandas data library

reader, simply by entering information about the stock ticker , data source, and

desired time range.


Machine Translated by Google

33

3.2 Research Design


The research design is a structured description of the research
will be made to facilitate the process. The research design is presented in
flowchart form from start to finish. Figure 3.1 shows the flowchart of this research.

Figure 3.1 Research flowchart

Explanation of the research flowchart :

a. Literature study was conducted to find out the latest research and state of the art from
problem to be raised.
b. The formulation of the problem is done to determine the problems encountered in the
research, and then carried out research design.
c. The first step taken is to retrieve Netflix stock data (NFLX)
which has been provided by the Yahoo Finance website. Data can be retrieved with
Utilize the library from Pandas, namely Pandas Data Reader. By using
library , the data retrieval process becomes easier, just by
Machine Translated by Google

34

enter the ticker of the desired stock then the data source and
the desired data range by setting start and end dates.
d. The next step is preprocessing the stock data that has been obtained. Process
The first thing to do in preprocessing is Exploratory Data Analysis
(EDA). Namely conducting an investigative process to understand the condition of the data

used and prepare the data so that it can be processed by the algorithm model. A number of

the process carried out is: checking the dimensions and amount of data, checking the type

data, and checks whether there is empty data.


e. After the EDA process is carried out, then the data will be visualized using
line chart to see how price movements occur.
f. Take only the closing price column to use in research.
g. Data scaling is done on data with a value range of 0 to 1, so that when
predicting the algorithm model is not biased because of the price range
actual can be very far away.

h. The last process in the preprocessing stage is to split the data into
data training and data testing. Training data is used as data to perform
learning on algorithm models. And data testing is used to test
trained models.
i. The next step is to model the algorithm used.
j. The training process is carried out to carry out learning on the algorithm model.
k. Next, the model will be tested to find out the prediction results
which is conducted.

l. The prediction results will be visualized to find out how they compare
at actual prices.
m. The results of the prediction with the actual price will be calculated to get the error value
conclusion whether the model produces good or bad predictions.
n. The results of the calculation of the error value obtained will then be compared
with the error value of another algorithm. Which algorithm gets
the best and the worst results. And what things will be evaluated
causes the algorithm model to get such predictive results.
o. After the results of predictions and calculations of errors between algorithms are obtained, it will be

generate conclusions regarding the research at hand.


Machine Translated by Google

35

3.2.1 Temporal Convolutional Network (TCN)

Figure 3.2 Flowchart of the Temporal Convolutional Network (TCN) model

Explanation of the Temporal Convolutional Network (LSTM) model flowchart :

a. Building the TCN algorithm model utilizing the darts library, the data already exists

previously prepared, just put it in the darts function to process it on

The TCN algorithm then performs hyperparameter tuning according to


data.

b. The training process on the TCN model

c. The backtesting process is carried out to evaluate the performance of the model using

functions provided by darts and make predictions on the data.

3.2.2 Comparison Algorithm

To compare the performance of the Temporal Convolutional Network (TCN) model,

the most popular and commonly used algorithms are used in problem solving

stock price prediction, namely the Long Short Term Memory (LSTM) algorithm. And two algorithms

The most common and simple used in machine learning models, namely algorithms

Linear Regression and Decision Tree Regression. The following is a research flowchart on

these three algorithms.


Machine Translated by Google

36

Long Short Term Memory (LSTM)

Figure 3.3 Flowchart of the Long Short Term Memory (LSTM) model

Explanation of the Long Short Term Memory (LSTM) flowchart model :

a. First of all create a variable to hold the data to be used on

LSTM model predictions.

b. Create a function to divide data into 60 data

used as predictive data and 1 data into predictive data. 60 data

starting from index data 0 to 59, and 1 data starting from index 60. So

predictions will be made once every 60 data with the prediction results of the 61st data,

then the prediction will continue again from index data 1 to 60 and results

prediction with index 61 and it will go on and on until the end


from data.

c. Changing data that is still in the form of numpy into array data .

d. Then build the LSTM model with a three- layer configuration, with layers

the first layer has 50 neurons, the second layer has 50 neurons, and the last layer

with 25 neurons.

e. Compile the model that has been built, and add functions

optimizer adam.

f. The training process on the LSTM model and setting up the available hyperparameters .

g. The process of testing the LSTM model and setting up the available hyperparameters .
Machine Translated by Google

37

Linear Regression and Decission Tree Regression

Figure 3.4 Flowchart of the Linear Regression model

and Decission Tree Regression

Explanation of the Linear Regression and Decission Tree Regression flowchart models :

a. First of all, it must be determined how many days of prediction you want, the length of the day

will be predicted will be stored in the future_days variable.

b. Linear Regression and Decission Tree Regression algorithms require variables

independent which is the independent variable that will be calculated to get

prediction results, and the dependent variable or dependent variable whose value is affected

independent variable . The close price column is an independent variable, for

the dependent variable will be made from the closing price column minus the number of days

which will be predicted (future_days) which is named as the prediction column.

Then the prediction column will be subject to the shift function to increase data

so that there is blank data at the end of the data which will be filled in by the price

prediction.

c. The independent variable will be separated from the dependent variable and reduced by how much

the length of days to be predicted (future_days), then stored in a variable

new is x.

d. The dependent variable will be separated from the independent variable and reduced by how much

the length of days to be predicted (future_days), then stored in a variable

new namely y.

e. Then the x and y variables will be divided into training data and testing data.
Machine Translated by Google

38

f. The training process on the Linear Regression and Decission Tree Regression models.

g. Creates a new variable for prediction use named x_future, with

retrieves data along future_days at the end of the data close.

h. The prediction process on the Linear Regression and Decission Tree Regression models.

3.3 Evaluation

The evaluation process will be carried out after the prediction process uses an algorithm model

the results have been obtained, and it is known how the visualization of the predicted results is

the. The evaluation carried out is to observe how the prediction results are produced

by the algorithm model using the error calculation matrix using the matrix

Mean Absolute Error (MAE), Mean Squared Error (MAE), Root Mean Squared Error

(RMSE), whether price predictions and trends that are formed can follow the actual price or

No. Will be analyzed why this can happen.


Machine Translated by Google

39

CHAPTER IV

RESULTS AND DISCUSSION

4.1 Implementation
All stages of the research design have been described in the form of a flowchart
in Figure 3.1, implemented in program code using a programming language
Python 3.7. The process of the program code will be described in this chapter.

4.1.1 Temporal Convolutional Network (TCN)


The following is an implementation of the program code using a programming language
Python from flowchart figure 3.2 Temporal Convolutional Network (TCN) algorithm.

Required Import Libraries


Figure 4.1 defines the library used. First do the library
and the packages needed which will later be used in processing the TCN algorithm
provided by the darts library.

1. # Import libraries 2. import


math 3. import numpy
as np 4. import pandas as pd
5. from darts import TimeSeries
6. from darts.models import TCNModel,
RNNModel 7. from darts.dataprocessin.transormers import Scaler
8. from farts.utils.timeseries_generation 9. import datetime_attribute_

10. from darts.metrics import mape, r2_score 11. from


darts.utils.missing_values import fill_missing_values

Figure 4.1 Import library

Get Stock Data


Figure 4.2 defines the function to get Netflix stock data (NFLX)
utilize the pandas data reader library on the 2nd line of code, calling the function
DataReader by entering the ticker code parameters of the stock, data source, data range
from start to finish. Then displayed stock data that has been obtained, data
has 1613 rows and 6 columns of type pandas data frame as shown in the image
4.3.
Machine Translated by Google

40

1. # Get the stock data


2. nflx_tcn = web.DataReader('NFLX', data_source = 'yahoo', start = 3. '2015-01-01', end =
'2021-05-31' 4.

5. # Show the stock data 6.


print(nflx_tcn. head()) 7. print(nflx_tcn.
tail())

Figure 4.2 Obtaining stock data

Figure 4.3 NFLX stock data

Exploratory Data Analysis (EDA) and Data Visualization

Figure 4.4 defines the function to carry out the Exploratory Data Analysis process

(EDA). Because the data used has been arranged neatly and well, the EDA process

not too much to do. With the EDA process, some insights were obtained that the amount

data row 1613 with 6 columns and date being the data index. Then the data type

is float64 and there is no empty data shown in Figure 4.5. Then

visualized data is done to find out how the data is displayed on the line chart

by using the close price column as shown in Figure 4.6.


Machine Translated by Google

41

1. # Exploratory data analysis

2. print(nflx_tcn.shape) 3.

print(nflx_tcn.info())

4. print(nflx_tcn. isnull())
5.

6. # Visualize the close price


7. plt. figure(figsize = (20, 10))

8. plt. plot(nflx_tcn['Close'])
9. plt. title('NFLX Stock Closing Price', fontsize - 24)
10. plt. xlabel('Days')
11. plt.ylabel('Close Price $USD')
12. plt. show()

Figure 4.4 Exploratory Data Analysis (EDA) on stock data

Figure 4.5 Exploratory Data Analysis Results


Machine Translated by Google

42

Figure 4.6 Close price visualization

Taking Column Close and Scaling Data


Figure 4.7 defines the function to retrieve the close column in the nflx_tcn dataframe,
only the close column will be used in this study. Then defined
the scaling function stored in the scaler variable, which makes use of the library
darts. dataprocessing. The data will then be scaled to be in the range between 0 to
1. In the 7th line of code, the scaler function is applied to nflx_tcn data using the function
fit_transform.

1. # Get only the close price

2. nflx_tcn = nflx_daily[['Close']]

3. nflx_tcn. head()
4.

5. # Scaling Data

6. scaler = Scaler()

7. nflx_tcn = scaler. fit_transform(nflx_tcn)

Figure 4.7 Taking the column close and scaling data

Split Dataset function


Figure 4.8 defines the function for splitting the dataset . Data is shared
into training and testing data and split after '2021-03-05' because it will
predictions are made for 60 days, so from the last data minus 60 days.
Machine Translated by Google

43

1. # Create training and validation dataset

2. train, val = nflx_tcn(pd. Timestamp('20210503'))

Figure 4.8 Split datasets

Building Models

Figure 4.9 defines the functions for building a TCN model, several

The available hyperparameters can be changed as needed. models from


the TCN algorithm is defined in the 2nd line of code with the variable name tcn_model with

make use of the TCNModel function. The length of the data to be trained is 1553 dan

with output length = 60. In this study the hyperparameter is set to: n_epoch =

20, droupout = 0.1, dilatation_base = 2, weight_norm = true, kernel_size = 5, num_filter = 3.

The number of epochs used is 20 according to the research, then the dropout value
use 0.1 because it is the most commonly used value, use dilatation_base

the default value is 2 so that the known pattern is not too wide. And then with a big

layer is 5 because the exchange day is open 5 days a week so want to do

convolution process every week, and use 3 layer configuration.

1. # Build TCN models

2. tcn_model = TCNModel(
3. input_chunk_length = 1553,
4. output chunk_length = 60,
5. n_epoch = 20,
6. dropout = 0.1,

7. dilation_base = 2,
8. weight_norm = True,
9. kernel_size = 5,

10. num_filters = 3

11. random_state = 0

12. )

Figure 4.9 Building a Temporal Convolutional Network (TCN) model


Machine Translated by Google

44

Training Process

Figure 4.10 defines the function to carry out the training process on data.

1. #Training the models

2. tcn_model.fit(series = train, val_series = val, verbose = True)

Figure 4.10 The training process

Backtesting Process

Figure 4.11 defines the function to evaluate the performance of the TCN model that has been

preformed in the 2nd line of code with the variable name backtest and with

make use of the historical_forecast function . Multiple hyperparameters are used in functions

In this case, forecast_horizon is how long the day will be predicted. With a span of 60 days

and no retraining.

1. # Backtesting the TCN model

2. backtest = tcn_model. historical_forecast(


3. Series_transformed,
4. Starts = 0.7,
5. Forecast_horizon = 60,
6. Retrains = False,
7. Verbose = True
8. )

Figure 4.11 Backtesting process

4.1.2 Long Short Term Memory (LSTM)

The following is an implementation of the program code using a programming language

Python from the flowchart figure 3.3 Long Short Term Memory (LSTM) algorithm.
Machine Translated by Google

45

Required Import Libraries


Figure 4.12 defines the library used. First do the import
required libraries and packages which will later be used in processing
LSTM algorithm that has been provided by the keras library.

1. # Import libraries 2. import


math 3. import numpy
as np 4. import pandas as pd
5. import pandas_datareader as
web 6. from sklearn import mertics 7. from sklearn.
preprocessing import MinMaxScaler 8. from
keras.models import Sequential 9. from keraas.layers import Dense,
LSTM 10. import matplotlib.pyplot as plt 11.
plt.style.use('fivethirtyeight')

Figure 4.12 Import library

Get Stock Data


Figure 4.13 defines the function to get Netflix stock data (NFLX)
utilize the pandas data reader library on the 2nd line of code by entering the code
stock ticker , data source, data range from start to finish. Then displayed
stock data that has been obtained, the data has 1613 rows and 6 columns of pandas data type
frame as shown in Figure 4.14.

1. # Get the stock data


2. nflx_df = web.DataReader('NFLX', data_source = 'yahoo', start = 3. '2015-01-01', end =
'2021-05-31' 4.

5. # Show the stock data 6.


print(nflx_df. head()) 7. print(nflx_df.
tail())

Figure 4.13 Obtaining stock data


Machine Translated by Google

46

Figure 4.14 NFLX stock data

Exploratory Data Analysis (EDA) and Data Visualization

Figure 4.15 defines the function to carry out the Exploratory Data Analysis process

(EDA). Because the data used has been arranged neatly and well, the EDA process

not too much to do. With the EDA process, some insights were obtained that the amount

data row 1613 with 6 columns and date being the data index. Then the data type

is float64 and there is no empty data as shown in Figure 4.16. Then

visualized data is done to find out how the data is displayed on the line chart

by using the close price column as shown in Figure 4.17.


Machine Translated by Google

47

1. # Exploratory data analysis

2. Print(nflx_df. shape)

3. Print(nflx_df.info())

4. Print(nflx_df. isnull())
5.

6. # Visualize the close price

7. Plt. figure(figsize = (20, 10))

8. Plt.plot(nflx_df['Close'])

9. Plt. title('NFLX Stock Closing Price', fontsize - 24)

10. Plt. xlabel('Days')

11. Plt.ylabel('Close Price $USD')

12. Plt. show()

Figure 4.15 Exploratory Data Analysis (EDA) on stock data

Figure 4.16 Exploratory Data Analysis Results


Machine Translated by Google

48

Figure 4.17 Close price visualization

Retrieving Column Close and Split Dataset Functions

Figure 4.18 defines the function to retrieve the close column in the dataframe

nflx_df, only the close column will be used in this study. Then data

changed to be of type array and divided into training and testing data with

comparison of 80% and 20%, on the 8th line of code by setting the training data parameter
to 0.80.

1. # Create a new dataframe with only the “Close” column

2. df = nflx_df. filter(['Close'])
3.

4. # Convert the dataframe to a numpy array


5. dataset = df. values

6.

7. # Get the number of rows to train the model, 80% of the dataset

8. training_data_len = math.ceil(len(dataset) * .80)

9. training_data_len

Figure 4.18 Taking the close column

Scaling Function

Figure 4.19 defines the scaling function stored in the scaler variable, which

make use of the sklearn.preprocessing library. The data will then be scaled to depth

range from 0 to 1 in the 3rd line of code and apply the fit_transform function to
Machine Translated by Google

49

the dataset to be scaled on the 4th line of code. Figure 4.20 shows the data after
subjected to a scaling function .

1. # Scaling the dataset


2. # The scale will be in the range between 0 and 1

3. scaler = MinMaxScaler(feature_range = (0, 1))

4. scaled_data = scaler.fit_transform(dataset)

5. scaled_data

Figure 4.19 Scaling function

Figure 4.20 Scaling results

Create Variables X Train, Y Train, and Data Split Functions


Figure 4.21 defines empty variables named x_train and y_train on the line
codes 7 and 8, which will be filled by the division of data that will be carried out using data
which has been scaled before. Then the data will be divided into 60 x_training data
which starts from data with index 0 to 59 and 1 data y_train which is taken from index
to 60. Data with an index of 60 is the target of predictions for every 60 initial data
defined in the for function in the 13th line of code. The next division is data with
indexes 1 to 60 and data with index 61, and so on. Result of division
The data is shown in Figure 4.22.
Machine Translated by Google

50

1. # Create the training dataset


2. # Create the scaled training dataset

3. train_data = scaled_data[0:training_data_len, :]
4.

5. # Split the data into x_train and y_train # x_train is independent


6. variable, y_train is dependent variable

7. x_train = []

8. y_train = []
9.

10. # First pass through x_train will contain 60 data indexed 0 to 59

11. # Then y_train for the pass through will contain 1 data indexed 60

12. for i in range(60, len(train_data)):


13. x_train. append(train_data[i-60:i, 0])
14. y_train. append(train_data[i, 0])
15. if i <= 61:
16. print(x_train)
17. print(y_train)

Figure 4.21 Creating a variable to store data division

Figure 4.22 Results of data division


Machine Translated by Google

51

Function Turns Into Array and Function Reshape


Figure 4.23 defines a function to reshape data. Input from
the LSTM model requires a 3-dimensional array of (number of samples, number of time
steps, number of features). The data that is owned is still 2-dimensional, so it must be done
reshaping, defined in line 8 of the code. The result of the reshaping process is (1489, 60, 1).

1. # Convert the x_train and y_train to numpy arrays

2. x_train, y_train = np.array(x_train), np.array(y_train)


3.

4. # Reshape the dataset

5. # LSTM network expect to be 3 dimensional input

6. # Shape:(number of samples, number of time steps, number of

7. features)

8. x_train=np.reshape(x_train, (x_train.shape[0], x_train.shape[1],


9. 1))

Figure 4.23 Reshape function

Building Models and Compile Functions


Figure 4.24 defines the function to build a model from the LSTM algorithm.
First of all make use of the keras.models library to call the Sequential () function
contained in the 2nd line of code, to prepare the LSTM base model that is stored on
model variables. Then make use of the keras.layer library to configure the layer
In the LSTM model, this study used a 3 layer configuration with the number of neurons
50, 50, and 25 are defined in lines of code 3 to 7. After the model is built,
the model will be compiled and added the optimizer function adam. The model will be processed
training with hyperparameters set batch_size = 1 and epoch = 3 which is defined on
lines of code 10 and 13.
Machine Translated by Google

52

1. # Build the LSTM model

2. model = Sequential()

3. model.add(LSTM(50, return_sequences = True, input_shape = (


4. X_train. shape[1], 1)))

5. model.add(LSTM(50, return_sequences = False))

6. model. add(Dense(25))

7. model. add(Dense(1))
8.

9. # Compile the LSTM model

10. model.compile(optimizer = 'adam', loss = 'mean_squared_error')


11.

12. # Training the LSTM model

13. model.fit(x_train, y_train, batch_size = 1, epochs = 3)

Figure 4.24 Building the LSTM model and training process

Create X Test Variables, Y Test, and Data Split Functions


Figure 4.25 defines the empty variables named x_test and y_test, which will be filled
by division of data that will be carried out using data that has been divided and scaled
previously in the 6th and 7th code line. Then the data will be divided into 60 x_test data
which starts from data with index 0 to 59 (data_testing) and 1 data y_test (data_testing)
taken from index 60. Data with index 60 is the target of the prediction
every 60 initial data is defined in the for function in the 9th line of code. Subsequent division
is data with index 1 to 60 and data with index 61, and so on.

1. # Create testing datasets

2. # Create new array containing scaled value for testing dataset

3. test_data = scaled[training_data_len - 60:, :]


4. # Create the datasets x_test and y_test

5. x_test = []

6. y_test = dataset[training_data_len:, :]

7. for i in range(60, lne(test_data)):

10. x_test_append(test_data[i-60:i, 0])

Figure 4.25 Creating variables to store testing data


Machine Translated by Google

53

Prediction Process

Figure 4.26 defines a function to reshape data. Input from

the LSTM model requires a 3-dimensional array of (number of samples, number of time

steps, number of features). The data that is owned is still 2-dimensional, so it must be done

reshaping then the data will be predicted. After the prediction results are obtained,

the inverse function is applied to reverse the price as before. The predicted results are shown

in Figure 4.27.

1. # Convert the data to numpy array

2. x_test = np.array(x_test)
3.

4. # Reshape the dataset

5. # LSTM network expect to be 3 dimensional input

6. # Shape:(number of samples, number of time steps, number of

7. features)

8. x_test = np. reshape(x_test, (x_test. shape[0], x_test. shape[1],


9. 1))

10. x_test. shape


11.

12. # Predict the LSTM model

13. lstm_prediction = model. predict(x_test)

14. # inverse the scaling data

15. lstm_prediction = scaler. inverse_transform(lstm_prediction)

Figure 4.26 Prediction process


Machine Translated by Google

54

Figure 4.27 Prediction results from the LSTM model

4.1.3 Linear Regression and Decision Tree Regression

The following is an implementation of the program code using a programming language

Python from the flowchart figure 3.4 Linear Regression algorithm and Decision Tree Regression.

Required Import Libraries

Figure 4.28 defines the library used. First do the import

required libraries and packages which will later be used in processing

Linear Regression and Decision Tree Regression algorithms that have been provided by the library
Scikit-Learn (sklearn).

1. # Import libraries 2. import


math 3. import numpy
as np 4. import pandas as pd 5.
import pandas_datareader as web
6. from sklearn import metrics 7. from sklearn.tree
import DecisionTreeRegressor 8. from
sklearn.linear_model import LinearRegression 9. from sklearn.model_selection
import train_test_split 10. import matplotlib.pyplot as plt 11.
plt.style.use('fivethirtyeight')

Figure 4.28 Import library


Machine Translated by Google

55

Get Stock Data


Figure 4.29 defines the function to get Netflix stock data (NFLX)
utilize the pandas data reader library on the 2nd line of code. By entering the code
stock ticker , data source, data range from start to finish. Then displayed
stock data that has been obtained, the data has 1613 rows and 6 columns of pandas data type
frame as shown in figure 4.30.

1. # Get the stock data


2. Nflx_daily = web.DataReader('NFLX', data_source = 'yahoo', start 3.
= '2015-01-01', end = '2021-05-31'
4.
5. # Show the stock data 6.
Print(nflx_daily. head())
7. Print(nflx_daily. tail())

Figure 4.29 Obtaining stock data

Figure 4.30 NFLX stock data

Exploratory Data Analysis (EDA) and Data Visualization


Figure 4.31 defines the function to carry out the Exploratory Data Analysis process
(EDA). Because the data used has been arranged neatly and well, the EDA process
not too much to do. With the EDA process, some insights were obtained that the amount
data row 1613 with 6 columns and date being the data index. Then the data type
is float64 and there is no empty data as shown in Figure 4.32. Then
Machine Translated by Google

56

visualized data is done to find out how the data is displayed on the line chart
by using the close price column as shown in Figure 4.33.

1. # Exploratory data analysis

2. print(nflx_daily. shape)

3. print(nflx_daily.info())

4. print(nflx_daily. isnull())
5.

6. # Visualize the close price


7. plt. figure(figsize = (20, 10))

8. plt. plot(nflx_daily['Close'])

9. plt. title('NFLX Stock Closing Price', fontsize - 24)

10. plt. xlabel('Days')

11. plt.ylabel('Close Price $USD')

12. plt. show()

Figure 4.31 Exploratory Data Analysis (EDA) on stock data

Figure 4.32 Exploratory Data Analysis Results


Machine Translated by Google

57

Figure 4.33 Close price visualization

Taking Column Close

Figure 4.34 defines the function to retrieve the close column in a dataframe

nflx_daily. Only the close column will be used in this study.

1. # Get only the close price

2. nflx_daily = nflx_daily[['Close']]

3. nflx_daily. head()

Figure 4.34 Taking the close column

Create Future Days Variables and Prediction Columns

Figure 4.35 defines a new variable named future_days with a value of 60 which

is how long the day will be predicted later on the 2nd line of code. Then

there is a function to create a new column called Prediction whose values are taken from

the close column in the nflx_daily dataframe. The Prediction column's value is subject to the shift function

a number of values of the future_days variable, the results are shown in Figure 4.36.
Machine Translated by Google

58

1. # Create a variable to predict “x” days out into the future

2. future_days = 60
3.

4. # Create a new column (as a target) and shifted “x” days up

5. nflx_daily['Prediction'] = nflx_daily[['Close']]
6. .shift(-future-days)

7. print(nflx_daily. head())

8. print(nflx_daily. tail())

Figure 4.35 Creating the future days variable and the prediction column

Figure 4.36 New Column Prediction

Create Independent Variables and Dependent Variables

Figure 4.37 defines a function to create a new variable of type array

named X (independent) and y (dependent) are taken from the nflx_daily dataframe

defined in the 3rd and 4th line of code.

1. # Create the independent variable (X)


2. # Convert to a numpy array and remove the last “x” days

3. x = np.array(nflx_daily.drop(['Prediction'], 1))[:-future_days]

4. y = np.array(nflx_daily['Prediction'])[:-future_days]

5.print(X)
6.print(y)

Figure 4.37 Creating independent and dependent variables


Machine Translated by Google

59

Split Dataset function

Figure 4.38 defines the function to split the dataset into training data and data

testing with a ratio of 75% to 25%, the data is subject to the random_state function so that

the data does not experience randomization and remains coherent which is defined in the 2nd line of code.

After the split is done, the dimensions of the data will be checked with the results (1164, 1) training data, (389,

1) testing data.

1. # Split the dataset into 75% training and 25Z% testing

2. x_train, x_test, y_train, y_test = train_test_split(X, y,

3. test_size = 0.25, random_state = 0)


4.

5. # Check the shapes

6. print(“shape of x_train :”, x_train. shape) 7. print(“shape of y_train :”,


y_train. shape) 8. print(“shape of x_test :”, x_test. shape)

9. print("shape of y_test :", y_test.shape)

Figure 4.38 Dividing the dataset into training and testing data

Training Process

Figure 4.39 defines the functions to call both models that make use of

library from sklearn.linar_model in line 3 of code and sklearn_tree in line 6 of code.

In the available parameters, just enter the data x_train and y_train, and process

Model training will be carried out.

1. # Create the model

2. # Create the Linear Regression model

3. lr = LinearRegression().fit(x_train, y_train)
4.

5. # Create the Decision Tree Regression

6. tree = DecisionTreeRegressor().fit(x_train, y_train)

Figure 4.39 Model creation and training process


Machine Translated by Google

60

Creating X Future Variables

Figure 4.40 defines a function to create a new variable namely x_future which is

contains the value from the close column in the nflx_daily data frame which is only taken as much

the number of future_days starts from the lowest data.

1. # Get the last "x" rows of the independent variable

2. X_future = nflx_daily. drop(['Prediction'], 1)[:-future_days]

3. X_future = x_future. tail(future_days)

4. X_future = np.array(x_future)

5. X_future

Figure 4.40 Creating the x_future variable

Prediction Process

Figure 4.41 defines the function to perform the prediction process on both models

make use of the library from sklearn.linar_model in the 2nd line of code and sklearn_tree in

6th line of code. In the available parameters, just enter the data x_test and y_test, and

model prediction process will be carried out. The results of the predictions of the two models are shown in

Figure 4.42, the top array is the predicted result of the Decision Tree Regression model

and the bottom one is the predicted result of the Linear Regression model.

1. # Show the Linear Regression model prediction

2. lr_prediction = lr.predict(x_future)

3. print(lr_prediction)
4.

5. # Show the Decision Tree Regression prediction

6. tree_prediction = tree.predict(x_future)

7. print(tree_prediction)

Figure 4.41 Prediction process


Machine Translated by Google

61

Figure 4.42 Prediction results from the two models

4.2 Visualization

The following is a visualization of the results of predictions that have been made previously
each algorithm.

4.2.1 Temporal Convolutional Network (TCN)


After making predictions with the model that has been built, then
visualize the results, to know the predicted price trend with the actual trend.
Figure 4.43 defines a function to visualize the prediction results.
Machine Translated by Google

62

1. # Plot the data

2. valid['Prediction'] = backtest

3.

4. # Visualize the predictions

5. plt. figure(figsize = (20, 20))

6. plt. plot(train['Close'])

7. plt. plot(valid['Close', 'Predictions'])

8. plt.title('TCN Model – NFLX Closing Price Prediction')

9. plt.xlabel('Date', fontsize = 10)

10. plt.ylabel('Close Price $USD', fontsize = 10)

11. plt.legend(['Train', 'Validation', 'Predictions'], loc = 'best',

12. fontsize = 24)

13. plt. show()

Figure 4.43 Function to display the visualization of the LSTM model

The following is a visualization of the predictions made using the TCN algorithm

for 60 days. Figures 4.44 and 4.45 show the visualization results. Can be seen on

the visualization generated by the prediction results of the TCN model shows the trend that occurs

able to follow the current trend. The price difference between the actual price and the predicted price

quite small.

Figure 4.44 Visualization of TCN model predictions as a whole


Machine Translated by Google

63

Figure 4.45 Visualization of TCN model predictions in detail

4.2.2 Long Short Term Memory (LSTM)

After making predictions with the model that has been built, then

visualize the results, to know the predicted price trend with the actual trend.

Figure 4.46 defines a function to visualize the prediction results.

1. # Plot the data

2. train = df[:training_data_len]

3. valid = df[training_data_len:]

4. valid['Predictions'] = lstm_predictions
5.

6. # Visualize the predictions

7. plt. figure(figsize = (20, 20))

8. plt. plot(train['Close'])

9. plt. plot(valid['Close', 'Predictions'])

10. plt.title('LSTM Model – NFLX Closing Price Prediction')

11. plt.xlabel('Date', fontsize = 10)

12. plt.ylabel('Close Price $USD', fontsize = 10)

13. plt.legend(['Train', 'Validation', 'Predictions'], loc = 'best',

14. fontsize = 24)

15. plt. show()

Figure 4.46 Function to display the visualization of the LSTM model


Machine Translated by Google

64

The following is a visualization of the predictions made using the LSTM algorithm

for 60 days. Figures 4.47 and 4.48 show the visualization results. Can be seen on

the visualization generated by the prediction results of the LSTM model shows the trend that occurs

able to follow the current trend. The price difference between the actual price and the predicted price is not

too far.

Figure 4.47 Visualization of the predictions of the LSTM model as a whole

Figure 4.48 Visualization of the predictions of the LSTM model in detail

4.2.3 Linear Regression and Decision Tree Regression

After making predictions with the model that has been built, then

visualize the results, to know the predicted price trend with the actual trend.

Figure 4.49 and Figure 4.52 define functions for visualizing prediction results.
Machine Translated by Google

65

1. # Plot the data

2. valid = nflx_daily[X.shape[0]:] 3. valid['Predictions'] =

lr_predictions
4.

5. # Visualize the predictions

6. Plt. figure(figsize = (20, 20))

7. plt. plot(train['Close'])

8. plt. plot(valid['Close', 'Predictions'])

9. plt.title('LSTM Model – NFLX Closing Price Prediction')

10. plt.xlabel('Date', fontsize = 10)

11. plt.ylabel('Close Price $USD', fontsize = 10)

12. plt. legend(['Train', 'Validation', 'Predictions'], loc = 'best',

13. fontsize = 24)

14. plt. show()

Figure 4.49 Function to display Linear Regression model visualization

The following is a visualization of the predictions made using the Linear algorithm
Linear Regression for 60 days. Figures 4.50 and 4.51 show the visualization results. Can

seen in the visualization produced by the predicted results of the Linear Regression model

shows the trend that occurs is not able to follow the actual trend. Price difference between

the actual price with the predicted price is too far. It can be categorized as
underfitting, because the model cannot capture patterns that occur properly so that results

predictions get low accuracy. The predicted trend is also the opposite

the actual trend, the predicted trend of price increases while the actual trend

tends to decrease in price.


Machine Translated by Google

66

Figure 4.50 Visualization of the overall Linear Regression model prediction

Figure 4.51 Visualization of Linear Regression model predictions in detail


Machine Translated by Google

67

1. # Plot the data

2. valid = nflx_daily[X.shape[0]:]

3. Valid['Predictions'] = tree_predictions
4.

5. # Visualize the predictions

6. Plt. figure(figsize = (20, 20))

7. Plt. plot(train['Close'])

8. Plt. plot(valid['Close', 'Predictions'])

9. Plt.title('LSTM Model – NFLX Closing Price Prediction')

10. Plt.xlabel('Date', fontsize = 10)

11. Plt.ylabel('Close Price $USD', fontsize = 10)

12. Plt.legend(['Train', 'Validation', 'Predictions'], loc = 'best',

13.Fontsize = 24)

14. Plt.show()

Figure 4.52 Function to display the visualization of the Decision Tree Regression model

Figure 4.53 Visualization of the overall prediction of the Decision Tree Regression model
Machine Translated by Google

68

Figure 4.54 Visualization of the predictions of the Decision Tree Regression model in detail

The following is a visualization of the predictions made using the Decision algorithm

Tree Regression for 60 days. Figures 4.53 and 4.54 show the visualization results. Can

seen in the visualization produced by the prediction results of the Decision Tree Regression model

shows the trend that occurs is able to follow the actual trend. Price difference between prices

actual to the predicted price is very close, but at some point the predicted price

experienced a sharp spike. This can be categorized as overfitting, because of the model

too focused on training data so that if it predicts other data it will get accuracy

The low one. The predicted trend is too close to the actual trend.

4.3 Evaluation

After making predictions with the model that has been built and visualized

the result, the next step is to perform calculations using the error matrix that occurs

between the predicted results and the actual price. Figure 4.55 defines the function for

calculating matrices.
Machine Translated by Google

69

1. #TCN Model evaluation

2. Print("TCN Metric")

3. Print("Mean Absolute Error: ", metrics.mean_absolute_error(


4. val, backtest))

5. Print("Mean Squared Error:", metrics.mean_squared_error(


6. val, backtest))

7. Print("Root Mean Squared Error:", np. sqrt(metrics.

8. mean_squared_error(val, backtest)))
9.

10. #LSTM Model evaluation

11. Print("TCN Metric")

12. Print("Mean Absolute Error: ", metrics.mean_absolute_error(


13. Y_test, lstm_prediction))

14. Print("Mean Squared Error:", metrics.mean_squared_error(


15. Y_test, lstm_prediction))

16. Print("Root Mean Squared Error:", np. sqrt(metrics.

17. mean_squared_error(Y_test, lstm_prediction)))


18.

19. # Linear Regression Model evaluation

20. Print("TCN Metric")

21. Print("Mean Absolute Error: ", metrics.mean_absolute_error(


22. X_future, lr_prediction))

23. Print("Mean Squared Error:", metrics.mean_squared_error(


24. X_future, lr_prediction))

25. Print("Root Mean Squared Error:", np. sqrt(metrics.

26. mean_squared_error(x_future, lr_prediction)))


27.

28. # Decision Tree Regression Model evaluation

29. Print("TCN Metrics")

30. Print("Mean Absolute Error: ", metrics.mean_absolute_error(


31. X_future, tree_prediction))

32. Print("Mean Squared Error:", metrics.mean_squared_error(


33. X_future, tree_prediction))

34. Print(“Root Mean Squared Error:”, np. sqrt(metrics.

35. mean_squared_error(x_future, tree_prediction)))

Figure 4.55 Function to calculate the error matrix


Machine Translated by Google

70

Table 4.1 Matrix Comparison


Linear Decision Tree
Matrix TCN LSTM
Regression Regression
MAE 9,865 10710 11,894 30.868

MSE 98,318 117,391 141,765 1345,383

RMSE 9,890 10,843 11,906 36,679

Based on the prediction results that have been obtained, and the existing error matrix values
in table 4.1, the implementation of the Temporal Convolutional Network (TCN) model has

performance that can outperform other comparison algorithms. With value

RMSE 9,890 which is the lowest value. Then the performance of TCN can be followed
by an algorithm that is quite popular used in the Long Short Term Memory (LSTM)

which has a very small difference in the RMSE value of 10,843 with the RMSE TCN value.

As for the algorithm that is not devoted to processing time series data results

what I got was really bad. However, for the Linear Regression algorithm itself

get a fairly low RMSE value of 11,906, while the Decision Tree algorithm
Regression got the worst RMSE value, namely 36,679. The dilatation process

performed by the TCN algorithm can recognize data that is far in the past, so the model

can recognize patterns from data better and not depend on short-term data only.

Although the results obtained by TCN in this study were not too significant in comparison

with LSTM.
Meanwhile, if the performance of the algorithm model is seen from the visualization side, the predictions are

the resulting TCN and LSTM algorithms are able to provide trend predictions that can follow

the actual trend and have a price difference that is not too big. For Linear algorithms

Regression, the trend prediction results obtained are the opposite of the actual trend so that

it can be said that the model is experiencing underfitting because it cannot recognize patterns
well. Whereas in the Decision Tree Regression algorithm, the trend prediction results are

obtained is too similar to the actual trend or commonly called the prediction experienced

overfitting. The model is too fixated on the data used for the training process

so the model cannot predict well on the new data given.


Machine Translated by Google

71

CHAPTER V

CLOSING

5.1 Conclusion

In this study the following conclusions can be obtained:

a. The Temporal Convolutional Network (TCN) algorithm can be applied to processes

predicting the trend of stock price movements and the Long Short Term Memory (LSTM) algorithm

can also follow the performance of the TCN algorithm.

b. The TCN algorithm can be built using the special Darts library

developed to process time series data and there is a TCN algorithm module,

then the hyperparameter tuning process is carried out according to the data
processed.

c. Both TCN and LSTM have a fairly small error value, that is, with a value

The TCN RMSE is 9,890 and the LSTM RMSE is 10,843. As for the algorithm

Linear Regression and Decision Tree Regression have a fairly large error value

namely 11,906 and 36,679, although the RMSE Linear Regression values can be said

close to the values of TCN and LSTM. RMSE value. So that algorithm is not

developed to process time series data is not suitable for prediction

trend of stock price movements.

d. The visualizations produced by the TCN and LSTM algorithms are able to follow trends

share price that occurred, with a fairly small price difference.

e. The TCN and LSTM algorithms can be used to assist investors in

predict the trend of stock price movements on the stock exchange, but not necessarily

just used. Must be used by professionals and have knowledge

about the world of stock investment well and ready to accept the risks that will

borne.

5.2 Suggestions

After the conclusions obtained from the research conducted, this research is still valid

there are many shortcomings that must be corrected in the future to be able to produce results

which is more optimal and useful. Here are suggestions that can be considered for

further research development:


Machine Translated by Google

72

a. The stock data used is not just one issuer, it is expected that the algorithm model
can be applied to various stock issuers or stocks in an index and
certain stock sector.

b. Do a deeper exploration of the algorithm used, try


use the various possible configurations of the algorithm to
get maximum results.
c. It is hoped that the algorithm model that has been built can be integrated on the platform
buying and selling of shares used by investors.
Machine Translated by Google

73

BIBLIOGRAPHY

Agusta Nanda, R., Rizal, S., & Yuswaliani, S. (2016). Fundamental Analysis and Analysis

technical. https://www.academia.edu/32854302/Analisis_fundamental

Ahmar, US (2018). Sutte indicator: An Approach to Predict the Direction of the Stock Market

Movements. Songklanakarin Journal of Science and Technology, 40(5), 1228–1231.

https://doi.org/10.14456/sjst-psu.2018.150

axa.co.id. (2019). The Beginning of the History of the Netflix Streaming Platform You Need to Know!

https://portal.axa.co.id/direct/Tips/Detail/awal-mula-history-netflix-yang-perlu-kamu
know

Bai, S., Kolter, JZ, & Koltun, V. (2018). An Empirical Evaluation of Generic Convolutional

and Recurrent Networks for Sequence Modeling. http://arxiv.org/abs/1803.01271

IDX. (n.d.). Indonesia stock exchange. https://www.idx.co.id/product/saham/

CNBC Indonesia. (2021, June 29). Number of RI Capital Market Investors.

https://www.cnbcindonesia.com/market/20210629153854-17-256818/naik-56-quantum

investors-capital-market-ri-reach-388-million

Coded. (2020). What Is Artificial Intelligence? The following definition and examples.

https://www.dicoding.com/blog/artificial-intelligence-is/

Filbert, R. (2020a). Swing Trader World Stock Investment (H. Yulianto, Ed.; Print

fourteenth). Elex Media Komputindo.

Filbert, R. (2020b). Investment in Stocks A la Swing Trader World (H. Yulianto, Ed.; 14th ed.). Elex

Media Komputindo.

Hafizah, N., Noviani, E., & Perdana ABSTRACT, H. (2019). Lq-45 Stock Technical Analysis

Using the Bollinger Bands Indicator. Math Scientific Bulletin. Stats. and Applied

(Bimaster) (Vol. 08, Issue 4).

Ika Ramadhani, P. (2020, July 2). S&P 500 and Nasdaq Strengthen Driven by Developments

Corona Vaccine Positive. https://www.liputan6.com/saham/read/4294060/sampp-500-dan

nasdaq-strengthening-coronavirus-vaccine-positive-development-driven

invest.kontan.co.id. (2021, March). Until March 2021, the IDX records an increase in numbers

Investors By 27%. https://investasi.kontan.co.id/news/ Sampai-maret-2021-bei-catat

increase-number-of-investors-by-27

Jati Lantang M, N. (2020). Comparison Between SVM and CNN To Detect Objects

Ships on Satellite Imagery.


Machine Translated by Google

74

Karno, ASB (2020). Prediction of BRI Bank Stock Time Series Data with Learning Machines

LSTM (Long Short Term Memory). Journal of Informatics and Information Security, 1(1).

https://doi.org/10.31599/jiforty.v1i1.133

Kim, T., & Kim, HY (2019). Forecasting stock prices with a LSTM-CNN fusion feature

model using different representations of the same data. PLoS ONE, 14(2).

https://doi.org/10.1371/journal.pone.0212320

Kusumodestoni, RH, & Sarwido, S. (2017). Comparison of Model Support Vector Machines

(SVM) and Neural Networks to Determine the Accuracy of the Highest Price Prediction

Share. Upgris Journal of Informatics, 3(1). https://doi.org/10.26877/jiu.v3i1.1536

Lässig, F. (2020, October 28). Temporal Convolutional Networks and Forecasting.

https://medium.com/unit8-machine-learning-publication/temporal-convolutional

networks-and-forecasting-5ce1b6e97ce4

Lestari, WR, & Pranyoto, DE (2015). Psychological Factors that Shape Behavior

Investor Finance (Behavioral Finance) in Stock Transactions in the Capital Market at

Lampung Psychological Factors Shaping the Behavior of Finance (Behavioral Finance)

Investor Shares in the Capital Market Transactions in Lampung. Winda Rika Lestari and

Edi Pranyotol (Vol. 5, Issue 1).

Liu, Y., Dong, H., Xingmei, W., & Han, S. (2019). Time Series Prediction Based on Temporal

Convolutional Network. 2019 IEEE/ ACIS 18th International Conference on Computing

and Information Science (ICIS), 300–305.

Mehtab, S., Sen, J., & Dutta, A. (nd). Stock Price Prediction Using Machine Learning and

LSTM-Based Deep Learning Models End-to-End Connectivity Management in

Heterogeneous Wireless Networks View project Forecasting of Tourist Inflow for

Infrastructure and Logistics Planning View project Sidra Mehtab NSHM Knowledge

Campus Stock Price Prediction Using Machine Learning and LSTM-Based Deep

Learning Models. https://www.researchgate.net/publication/344324240

money.kompas.com. (2021). Number of Subscribers Surges in the Midst of a Pandemic, Netflix Earns

Revenue Reaches IDR 350 Trillion by the end of 2020.

https://money.kompas.com/read/2021/01/20/165327826/nomor-pelanggan-melonjak-di

mid-pandemic-netflix-earned-revenue-rp-350

Nurhikmat, T. (2018). Implementation of Deep Learning for Image Classification Using

Convolutional Neural Network (CNN) Algorithm on Citra Wayang Golek.


Machine Translated by Google

75

https://dspace.uii.ac.id/bitstream/handle/123456789/7843/TUGAS%20AKHIR_TRIAN

O%20NURHIKMAT_14611209_STATISTICS_UII.pdf?sequence=1&isAllowed=y

Olah, C. (2015, August 27). Github Repository Understanding LSTM Networks.

https://colah.github.io/posts/2015-08-Understanding-LSTMs/

Pham, DT, & Pham, PTN (1999). Artificial Intelligence in Engineering. International

Journal of Machine Tools and Manufacture, 39(6). https://doi.org/10.1016/S0890-

6955(98)00076-5

Pramudya, R., & Pramudya, R. (2020). Technical Analysis to Determine Buying and Selling

Signals in Stock Trade. International Journal of Finance & Banking Studies (2147-4486),

9(1), 58–67. https://doi.org/10.20525/ijfbs.v9i1.666

R Tristia, R. (2019, October 30). Trading Psychology and Emotional Control for Traders.

https://id.catinstitute.org/market-story/read/psikologi-trading

Rich, E., Knight, K., & B Nair, S. (2019). Artificial Intelligence (3rd ed.). The McGrow Hill.

Roziq, M. (2021). Know What is AI (Artificial Intelligence)? The following types, forms and

Its Application in Life. https://caraguna.com/apa-itu-ai-artificial-intelligence

following-type-form-and-application-in-life/

Now. (2020, July 31). Get to Know the Types of Stock Charts for Profit.

https://ajaib.co.id/mengenal-tipe-tipe-chart-saham/

tradingview.com. (2021). Netflix,Inc. (NFLX) Stock.

https://id.tradingview.com/chart/?symbol=FX_IDC:USDIDR&source=unauth_header&f

eate=launch_chart

Tri Retno, I. (2021, March 4). Get to know about Sideways or Consolidation Trends.

https://www.finansialku.com/sideways/

Wan, R., Mei, S., Wang, J., Liu, M., & Yang, F. (2019). Multivariate Temporal Convolutional

Network: A Deep Neural Networks Approach for Multivariate Time Series Forecasting.

Electronics (Switzerland), 8(8). https://doi.org/10.3390/electronics8080876

Wang, X., Wang, Y., Weng, B., & Vinel, A. (2020). Stock2Vec: A Hybrid Deep Learning

Framework for Stock Market Prediction with Representation Learning and Temporal

Convolutional Network. http://arxiv.org/abs/2010.01197

Wayan, D. (2018, February 6). Understanding Artificial Intelligence in the form of Deep Learning and

Machine Learning. https://warstek.com/deepmachinelearning/


Machine Translated by Google

76

Zainuddin, Z., & Hartono, J. (1999). Benefits of Financial Ratios in Predicting

Profit Growth: An Empirical Study of Banking Companies Registered at

Jakarta Stock Exchange. 2(1), 66–90.

Zayini Anwar, M., & Habibi, S. (nd). Analysis of Prediction of Stock Movement Direction Performance

Apple (APPL) uses the Recurrent Neural Networks/ Long Short Term Memory Method

Networks (RNN/LSTM).
Machine Translated by Google

ATTACHMENT

You might also like