{"id":17885,"date":"2022-12-12T10:09:00","date_gmt":"2022-12-12T02:09:00","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=17885"},"modified":"2026-02-25T14:13:15","modified_gmt":"2026-02-25T06:13:15","slug":"lstm-trading-signal-detection","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insight\/lstm-trading-signal-detection\/","title":{"rendered":"LSTM Trading Signal Detection"},"content":{"rendered":"\n<p id=\"8f22\">Optimizing Trading Signals Using LSTM Deep Learning Models and Performing Historical Backtesting<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1XQlHTmps4Zr6HuRoBFE12A.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Photo by&nbsp;<a href=\"https:\/\/unsplash.com\/@nimisha_mekala\" rel=\"noreferrer noopener\" target=\"_blank\">Nimisha Mekala<\/a>&nbsp;on&nbsp;<a href=\"https:\/\/unsplash.com\/s\/photos\/finance\" rel=\"noreferrer noopener\" target=\"_blank\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f7a6cfaf8d3\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f7a6cfaf8d3\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lstm-trading-signal-detection\/#Highlight\" >Highlight<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lstm-trading-signal-detection\/#Preface\" >Preface<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lstm-trading-signal-detection\/#Characteristic_Indicators_and_Introduction\" >Characteristic Indicators and Introduction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lstm-trading-signal-detection\/#Editing_Environment_and_Module_Requirements\" >Editing Environment and Module Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lstm-trading-signal-detection\/#Data_Preprocessing_and_LSTM_Model\" >Data Preprocessing and LSTM Model<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lstm-trading-signal-detection\/#Model_Results_Training_Set\" >Model Results (Training Set)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lstm-trading-signal-detection\/#Model_Results_Test_Set\" >Model Results (Test Set)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lstm-trading-signal-detection\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"0627\"><span class=\"ez-toc-section\" id=\"Highlight\"><\/span>Highlight<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"febe\">Artical Difficulty\uff1a\u2605\u2605\u2605\u2606\u2606<\/p>\n\n\n\n<p id=\"67b2\">Reading Recommendation: This article utilizes an RNN (Recurrent Neural Network) architecture for time series prediction. It is advisable for readers to have a foundational understanding of time series analysis or deep learning. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"805b\"><span class=\"ez-toc-section\" id=\"Preface\"><\/span>Preface<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"9eaf\">In the previous article, we used an LSTM model to predict stock price trends by using the past 10 days&#8217; opening prices, highest prices, lowest prices, closing prices, and trading volumes to predict the closing price for the next day. However, we observed that the model&#8217;s performance was not very satisfactory when relying solely on yesterday&#8217;s stock price to predict tomorrow&#8217;s price. Therefore, we have decided to change our approach. This time, we aim to use the model to help us <span style=\"text-decoration: underline;\" class=\"ek-underline\">identify buy and sell points and formulate a trading strategy<\/span>. We have also incorporated more feature indicators, hoping to achieve better results.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4db9\"><span class=\"ez-toc-section\" id=\"Characteristic_Indicators_and_Introduction\"><\/span>Characteristic Indicators and Introduction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We have added eight new feature indicators, four of which are technical indicators, and four are macroeconomic indicators, with the hope of enhancing our prediction results using these two facets of feature values.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Technical Indicators:<\/h3>\n\n\n\n<p>\u25ce<strong>KD (Stochastic Oscillator)<\/strong>: Represents the current price&#8217;s relative high-low changes over a specified period, indicating price momentum.<\/p>\n\n\n\n<p>\u25ce<strong>RSI (Relative Strength Index)<\/strong>: Measures the strength of price movements, indicating the balance between buying and selling pressures.<\/p>\n\n\n\n<p>\u25ce<strong>MACD (Moving Average Convergence Divergence)<\/strong>: Indicates the convergence or divergence of long-term and short-term moving averages, helping identify potential trend changes.<\/p>\n\n\n\n<p>\u25ce<strong>MOM (Momentum)<\/strong>: Observes the magnitude of price changes and market trend direction.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Macroeconomic Indicators:<\/h3>\n\n\n\n<p>\u25ce<strong>Taiwan Economic Composite Index<\/strong>: Represents a crucial macroeconomic variable reflecting economic activity and changes in the business cycle.<\/p>\n\n\n\n<p>\u25ce<strong>VIX Index<\/strong>: Reflects market volatility and serves as an indicator of market sentiment and panic.<\/p>\n\n\n\n<p>\u25ce<strong>Leading Indicators<\/strong>: Economic indicators that provide early insights into future economic trends, aiding in predicting economic conditions.<\/p>\n\n\n\n<p>\u25ce<strong>Taiwan Stock Average P\/E Ratio<\/strong>: Calculates the average P\/E ratio of listed companies, offering insights into overall market sentiment, whether it&#8217;s optimistic or pessimistic.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"110a\"><span class=\"ez-toc-section\" id=\"Editing_Environment_and_Module_Requirements\"><\/span>Editing Environment and Module Requirements<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"ee32\">This article is based on the Windows operating system and utilizes Jupyter as the editor.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import tejapi<br>import pandas as pd<br><br>tejapi.ApiConfig.api_key = \"Your Key\"<br>tejapi.ApiConfig.ignoretz = True<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"39a0\">Database Usage<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>0050 Adjustment of stock price (day) \u2014 ex-dividend adjustment <br>Average price-to-earnings ratio of Taiwan stocks &#8211; overall economy<br>Taiwan\u2019s Prosperity Countermeasure Signal \u2013 Overall Economy <br>Leading Indicators &#8211; General Economy <br>Chicago VIX Index \u2014 International Stock Price Index <\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"0a6b\">Data Loading<\/h3>\n\n\n\n<p id=\"47b4\">The data used includes the ex-dividend and adjusted stock prices, as well as the opening price, closing price, highest price, lowest price, and trading volume for the Taiwan 50 Index (0050) spanning from January 2011 to November 2022.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">coid = \"0050\"\nmdate = {'gte':'2011-01-01', 'lte':'2022-11-15'}\ndata = tejapi.get('TWN\/APRCD1',\n                          coid = coid,\n                          mdate = {'gte':'2011-01-01', 'lte':'2022-11-15'},\n                          paginate=True)\n\n\n#Open high, close low, trading volume\ndata = data[[\"coid\",\"mdate\",\"open_adj\",\"high_adj\",\"low_adj\",\"close_adj\",\"amount\"]]\ndata = data.rename(columns={\"coid\":\"coid\",\"mdate\":\"mdate\",\"open_adj\":\"open\",\n                   \"high_adj\":\"high\",\"low_adj\":\"low\",\"close_adj\":\"close\",\"amount\":\"vol\"})<\/pre>\n\n\n\n<p id=\"cd8f\">Besides loading Taiwan 50 Index (0050) adjustment stock price, we also need to consider other indicators in the model, such as Technical indicators(KD\u3001RSI\u3001MACD\u3001MOM) and General economic indicators (Taiwan stock average price-earnings ratio, Taiwan\u2019s business climate countermeasure signal, leading indicators, Chicago VIX index). After eliminating some null values and impractical columns, we could organize the chart below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/135Epj_F7N8hq93CEdzyNTg.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Data Organization Chart<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"e6ae\">Buy and Sell Signals<\/h3>\n\n\n\n<p id=\"42fd\">We have chosen to define trends by combining moving averages with momentum indicators. A simple criterion for identifying an upward trend is when MA10 &gt; MA20 and RSI10 &gt; RSI20. We labeled an upward trend as 1, otherwise it is marked as 0.<\/p>\n\n\n\n<p>Observing the Data Distribution below, we can tell that the data distribution is not overly skewed. Due to the overall upward trend in the market, a higher number of upward trends is a regular occurrence.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1YLCkCuQ7TggZqyz1g5JeDQ.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Data Distribution<\/figcaption><\/figure>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\" id=\"79bb\"><span class=\"ez-toc-section\" id=\"Data_Preprocessing_and_LSTM_Model\"><\/span>Data Preprocessing and LSTM Model<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"02e1\">Before processing, we standardized data by cutting samples into learning and test, whose ratio is 7:3, setting the training data time range as 2011.02.25- 2019.05.08 and the test data time range as 2019.05.09- 2022.11.15. After preparing the data, we reshaped them into three Dimensions to suit the LSTM Model, which includes four layers with Dropout to prevent overfitting. Model Structures can take the figures below as references.<\/p>\n<\/div>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1zDISKppRDD-I3ItDCy1wnQ.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Model Structure (Part I)<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1B8kCPFm7dcF3A4awv1u-NQ.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Model Structure (Part II)<\/figcaption><\/figure>\n\n\n\n<div style=\"border: 1px black; border-style: solid none; text-align: center; border-color: #296580; padding: 24px; margin-top: 24px; margin-bottom: 24px;\">\n<p style=\"margin: 0px; font-size: 24px; font-weight: bold; line-height: 1.5;\">Boost Your Indices universe with TEJ premium Database!<br \/>Build your Quant Data feeds and Transform Insights Into Decisions.<\/p>\n<div style=\"margin-top: 32px;\"><strong><a style=\"border: none; border-radius: 4px; background-color: #296580; color: white; font-size: 20px; width: fit-content; text-decoration: none; padding: 12px 30px 12px 30px;\" href=\"https:\/\/www.tejwin.com\/en\/databank-solution\/economic-data\/\">TEJ Databank Solutions<\/a><\/strong><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"890a\"><span class=\"ez-toc-section\" id=\"Model_Results_Training_Set\"><\/span>Model Results (Training Set)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"e06b\">Set the number of epochs to 100. By examining the Model Loss chart, it\u2019s evident that during the training process, the two lines converged, which indicates that the model did not overfit.<\/p>\n\n\n\n<p id=\"bbf4\"><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1A06Rib6bqwkHIF5es6KSJA.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Convergence Situation<\/figcaption><\/figure>\n\n\n\n<p id=\"ba28\">In addition, the figure below shows the importance of different feature indicators. It indicates that MACD, Taiwan Stock Average P\/E Ratio, and RSI are essential features in this Model.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1qZQCuKbQ-qDbRQNkrCoBYQ.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Features Importance<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2ab8\"><span class=\"ez-toc-section\" id=\"Model_Results_Test_Set\"><\/span>Model Results (Test Set)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"d82f\">Comparing Real Labels and Model Predictions (Predictions), we found that the test set&#8217;s accuracy is as high as 95.49%, indicating that the LSTM model can effectively execute our strategy.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1v7h6Ks0EXIYv4oMSf_vcBQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"b813\">To better understand the performance, we visualize our strategy in the LSTM Strategy Trend Prediction Chart, where red represents an upward trend, and green represents a downward trend.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/14sL-BTuGe6f5pxUyIELLnw.png\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3cc9\">Strategy Backtesting<\/h3>\n\n\n\n<p>Next, we backtested the strategy. When the trend signal is upward, buy one position and hold it. On the other hand, when the trend signal turns downward, sell the original position and take a short one, holding it until the next signal as an upward trend, at which point, close the position. The cumulative return of the LSTM strategy, named \u2018s_return,\u2019 is 82.6%. The actual strategy (MA+MOM) cumulative return, \u2018a_return,\u2019 is 71.3%. The cumulative return for large-cap Buy and Hold, as \u2018m_return,\u2019 is 52%.<br>*Note: This strategy does not account for transaction costs; all capital is used for entering and exiting positions.<\/p>\n\n\n\n<p>*Note: This strategy does not account for transaction costs, and all capital is used for entering and exiting positions.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1TFfntolGIFAmd_zPaKJ22Q.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Backtesting Result<\/figcaption><\/figure>\n\n\n\n<p id=\"eab9\"><br><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1AfYqnMRvh5p8OPwc5ye-ew.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Orange: LSTM strategy; Blue: Buy and hold; Green: Actual strategy<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"94a4\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The primary purpose of this study was to examine whether LSTM could accurately identify buy and sell points according to our predefined original strategy.<strong> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">The result was affirmative, with a high accuracy of 95.49% and a cumulative return of 82.6% in backtesting<\/mark>.<\/strong> This performance even outperformed the original strategy and significantly beat the market\u2019s return of 52%. We believe that one reason for outperforming the original strategy is that LSTM generated fewer trading signals during consolidation periods, avoiding the frequent whipsawing that can lead to reduced trading performance.<\/p>\n\n\n\n<p>Lastly, we would like to reiterate that the assets mentioned in this article are for illustrative purposes only and do not constitute recommendations or advice regarding any financial products. Therefore, if readers are interested in topics such as strategy development, performance testing, empirical research, etc., you are welcome to explore the solutions available on our website, which provide comprehensive databases and tools for various analyses.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-100\"><a class=\"wp-block-button__link has-background has-custom-font-size wp-element-button\" href=\"https:\/\/www.tejwin.com\/en\/databank-solution\/economic-data\/\" style=\"border-radius:13px;background:linear-gradient(135deg,rgb(233,217,148) 0%,rgb(82,196,165) 50%,rgb(25,111,156) 100%);font-size:23px\"><strong>Boost Your Indices universe with TEJ premium Database!<br>Build your Quant Data feeds and Transform Insights Into Decisions.<\/strong><\/a><\/div>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<p style=\"font-size:27px\"><strong>Complete Code<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gist.github.com\/tej87681088\/b599c3dc4db9cbd946554226cfdfd513#file-tejapi_python_lstm_strategy-py\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Click here to <\/a><a href=\"https:\/\/gist.github.com\/tej87681088\/b599c3dc4db9cbd946554226cfdfd513#file-tejapi_python_lstm_strategy-py\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Github<\/a><\/li>\n<\/ul>\n\n\n\n<p style=\"font-size:27px\"><strong>Further Reading<\/strong><\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-tej wp-block-embed-tej\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"4YTEHjcWe7\"><a href=\"https:\/\/www.tejwin.com\/en\/insight\/monthly-sales-growth-rate-application-strategy\/\">Monthly sales growth rate application strategy<\/a><\/blockquote><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Monthly sales growth rate application strategy&#8221; &#8212; TEJ\" src=\"https:\/\/www.tejwin.com\/en\/insight\/monthly-sales-growth-rate-application-strategy\/embed\/#?secret=LDLmPd0PJU#?secret=4YTEHjcWe7\" data-secret=\"4YTEHjcWe7\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-tej wp-block-embed-tej\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"IvKVA8Cz53\"><a href=\"https:\/\/www.tejwin.com\/en\/insight\/herding-indicators\/\">Herding indicators<\/a><\/blockquote><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Herding indicators&#8221; &#8212; TEJ\" src=\"https:\/\/www.tejwin.com\/en\/insight\/herding-indicators\/embed\/#?secret=ninhlAggek#?secret=IvKVA8Cz53\" data-secret=\"IvKVA8Cz53\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p style=\"font-size:27px\"><strong>Related Link<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a aria-label=\"TEJ API \u8cc7\u6599\u5eab\u9996\u9801 (opens in a new tab)\" href=\"https:\/\/api.tej.com.tw\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">TEJ API Database Homepage<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_intro\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">TEJ E-Shop Complete Database Purchase<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In the previous article, we used an LSTM model to predict stock price trends by using the past 10 days&#8217; opening prices, highest prices, lowest prices, closing prices, and trading volumes to predict the closing price for the next day. However, we observed that the model&#8217;s performance was not very satisfactory when relying solely on yesterday&#8217;s stock price to predict tomorrow&#8217;s price. Therefore, we have decided to change our approach. This time, we aim to use the model to help us identify buy and sell points and formulate a trading strategy. We have also incorporated eight new feature indicators, with four being technical indicators and four being macroeconomic indicators, in the hope of improving our prediction results using these two facets of feature values.<\/p>\n","protected":false},"featured_media":9727,"template":"","tags":[2944],"insight-category":[50,689],"class_list":["post-17885","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-historical-backtesting","insight-category-fintech","insight-category-market-research"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/17885","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/types\/insight"}],"version-history":[{"count":7,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/17885\/revisions"}],"predecessor-version":[{"id":43954,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/17885\/revisions\/43954"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/9727"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=17885"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=17885"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight-category?post=17885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}