{"id":22519,"date":"2024-04-17T22:00:11","date_gmt":"2024-04-17T14:00:11","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=22519"},"modified":"2024-06-13T12:13:19","modified_gmt":"2024-06-13T04:13:19","slug":"tquant-lab-kd-indicator-strategy","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insight\/tquant-lab-kd-indicator-strategy\/","title":{"rendered":"TQuant Lab KD Indicator Strategy: Exploring Stock Price Reversal Timing?"},"content":{"rendered":"\n<figure class=\"wp-block-image aligncenter size-full caption-align-center\"><img fetchpriority=\"high\" decoding=\"async\" width=\"3000\" height=\"2000\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/cdd20-HQH-GOZ6K2c-unsplash.jpg\" alt=\"KD Indicator Strategy\" class=\"wp-image-22370\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/cdd20-HQH-GOZ6K2c-unsplash.jpg 3000w, https:\/\/www.tejwin.com\/wp-content\/uploads\/cdd20-HQH-GOZ6K2c-unsplash-300x200.jpg 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/cdd20-HQH-GOZ6K2c-unsplash-1024x683.jpg 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/cdd20-HQH-GOZ6K2c-unsplash-150x100.jpg 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/cdd20-HQH-GOZ6K2c-unsplash-768x512.jpg 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/cdd20-HQH-GOZ6K2c-unsplash-1536x1024.jpg 1536w, https:\/\/www.tejwin.com\/wp-content\/uploads\/cdd20-HQH-GOZ6K2c-unsplash-2048x1365.jpg 2048w\" sizes=\"(max-width: 3000px) 100vw, 3000px\" \/><figcaption class=\"wp-element-caption\">Photo by <a href=\"https:\/\/unsplash.com\/@cdd20\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">\u611a\u6728\u6df7\u682a cdd20<\/a> on <a href=\"https:\/\/unsplash.com\/\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">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-69fe00780efb7\" 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-69fe00780efb7\"  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\/tquant-lab-kd-indicator-strategy\/#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\/tquant-lab-kd-indicator-strategy\/#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\/tquant-lab-kd-indicator-strategy\/#KD_Indicator_Strategy\" >KD Indicator Strategy<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-lab-kd-indicator-strategy\/#Coding_Environment_and_Module_Requirements\" >Coding Environment and Module Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-lab-kd-indicator-strategy\/#Selecting_Stock_Pool_and_Data_Import\" >Selecting Stock Pool and Data Import<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-lab-kd-indicator-strategy\/#Construct_the_KD_Indicator_Strategy\" >Construct the KD Indicator Strategy<\/a><\/li><\/ul><\/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\/tquant-lab-kd-indicator-strategy\/#Execute_the_Trading_Strategy\" >Execute the Trading Strategy<\/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\/tquant-lab-kd-indicator-strategy\/#Performance_Evaluation_Using_Pyfolio\" >Performance Evaluation Using Pyfolio<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-lab-kd-indicator-strategy\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-lab-kd-indicator-strategy\/#Source_Code\" >Source Code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-lab-kd-indicator-strategy\/#Extended_Reading\" >Extended Reading<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-lab-kd-indicator-strategy\/#About\" >About<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Highlight\"><\/span>Highlight<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Article Difficulty\uff1a\u2605\u2605\u2606\u2606\u2606<\/li>\n\n\n\n<li>This article is adapted from <a href=\"https:\/\/www.tejwin.com\/en\/insight\/kd-indicator\/\" class=\"ek-link\">KD Indicator<\/a>, utilizing TQuant Lab for strategy optimization and adjustment.<\/li>\n\n\n\n<li>The built-in factors in TQuant Lab were used to calculate the KD indicator and determine stock price reversal timing through the indicator. Comparing the KD Indicator Strategy&#8217;s performance from (2020-01-01 to 2024-04-10) to assess if excess returns can be earned.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Preface\"><\/span>Preface<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The KD Indicator, also known as the Stochastic Oscillator, is a practical and widely used tool in technical analysis. It&#8217;s primarily used to determine the short-term strength of stock prices and potential reversal timing. The value of the KD indicator ranges from 0 to 100, with 50 generally serving as the dividing line. When the indicator is above 50, it indicates that the stock price is in a bullish phase; conversely, when the indicator is below 50, it is considered to be in a bearish phase. Additionally, when the KD indicator is below 20, stocks often show signs of being oversold, indicating a potential upward reversal at any time; on the other hand, when the KD indicator is above 80, stocks often exhibit signs of being overbought, suggesting a potential downward reversal at any time. Therefore, this tool is a valuable resource for constructing trading signals for buying and selling stocks, empowering traders with timely and informed decisions.<\/p>\n\n\n\n<p>The calculation process of the KD indicator is as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>RSV = ( ( Today&#8217;s closing price &#8211; Lowest price in the past N days ) \/ ( Highest price in the past N days &#8211; Lowest price in the past N days ) ) * 100<\/li>\n\n\n\n<li>K value = Yesterday&#8217;s K value \u00d7 (2\/3) + Today&#8217;s RSV \u00d7 (1\/3)<\/li>\n\n\n\n<li>D value = Yesterday&#8217;s D value \u00d7 (2\/3) + Today&#8217;s K value \u00d7 (1\/3)<\/li>\n<\/ul>\n\n\n\n<p><br>From the above formulas, RSV can be interpreted as the strength or weakness of today&#8217;s stock price relative to the prices over the past N days. K value, also known as the&nbsp;<em>Fast Stochastic Oscillator<\/em>, is heavily influenced by the strength or weakness of today&#8217;s stock price. On the other hand, the calculation principle of D value is akin to applying another level of smoothing. Hence, it reacts more slowly to current price changes.<\/p>\n\n\n\n<p>Moreover, the value of N in the equations represents the moving window for calculating the indicator. This value can be adjusted according to different investment characteristics, offering a flexible and versatile approach. Setting a larger N value can stabilize the KD values and provide more precise reversal signals based on a more extended historical period, which is suitable for medium- to long-term investors. Conversely, a smaller N value will make the KD indicator more sensitive and suitable for short-term investors. This adaptability allows the KD Indicator to cater to a wide range of investment strategies, making it a valuable tool for all types of traders.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"KD_Indicator_Strategy\"><\/span>KD Indicator Strategy<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we employ the KD indicator to determine stock price reversal timing and utilize the following entry and exit rules to establish a trading strategy and conduct backtesting:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When K \u2264 20:  Buy, as it represents a weaker stock price and an oversold market condition.<\/li>\n\n\n\n<li>When K \u2265 80:  Sell, indicating an overheated market, thus opting for profit-taking.<\/li>\n<\/ul>\n\n\n\n<p>Additionally, since this strategy involves a longer backtesting period, the value of N is 36 days instead of the more common 14-day window length used in calculating the KD indicator.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Coding_Environment_and_Module_Requirements\"><\/span>Coding Environment and Module Requirements<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This article is written using Windows 11 and Jupyter Lab as the editor.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pandas as pd\nimport numpy as np\nimport os\n\ntej_key = 'your key'\napi_base = 'https:\/\/api.tej.com.tw'\n\nos.environ&#91;'TEJAPI_KEY'] = tej_key \nos.environ&#91;'TEJAPI_BASE'] = api_base<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Selecting_Stock_Pool_and_Data_Import\"><\/span>Selecting Stock Pool and Data Import<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Using <code>get_universe<\/code> to select stocks from the Taiwan 50 Index from 2012-01-01 to 2019-12-31.<\/li>\n\n\n\n<li>Setting the backtesting period from 2020-01-01 to 2024-04-10, and importing price and volume data using <code>!zipline ingest -b tquant<\/code>.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>from zipline.sources.TEJ_Api_Data import get_universe\n\n# get the stock list from Taiwan 50 index\nStockList = get_universe('2012-01-01', '2019-12-31', idx_id = 'IX0002')\nStockList.append('IR0001')\n\n# set backtest period\nstart = '2020-01-01'\nend = '2024-04-10'\n\nos.environ&#91;'ticker'] = ' '.join(StockList)\nos.environ&#91;'mdate'] = start + ' ' + end\n\n!zipline ingest -b tquant<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Construct_the_KD_Indicator_Strategy\"><\/span>Construct the KD Indicator Strategy<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>From the <code>pipeline<\/code> and <code>zipline<\/code> function provided in TQuant Lab, we can:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Calculate the K value using the <a href=\"https:\/\/github.com\/tejtw\/TQuant-Lab\/blob\/main\/lecture\/Pipeline%20built-in%20factors.ipynb\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">built-in factors<\/a> from <code>pipeline<\/code>.<\/li>\n\n\n\n<li>Add liquidity slippage, transaction fees, and set the return of TWSE Weighted Stock Return Index as the benchmark.<\/li>\n\n\n\n<li>Set the KD Indicator Strategy and record the transaction details.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full caption-align-center\"><img decoding=\"async\" width=\"487\" height=\"378\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/pipeline-\u8a08\u7b97\u7d50\u679c-1.png\" alt=\"KD Indicator Strategy\" class=\"wp-image-22587\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/pipeline-\u8a08\u7b97\u7d50\u679c-1.png 487w, https:\/\/www.tejwin.com\/wp-content\/uploads\/pipeline-\u8a08\u7b97\u7d50\u679c-1-300x233.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/pipeline-\u8a08\u7b97\u7d50\u679c-1-150x116.png 150w\" sizes=\"(max-width: 487px) 100vw, 487px\" \/><figcaption class=\"wp-element-caption\">Pipeline Calculation Results<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Execute_the_Trading_Strategy\"><\/span>Execute the Trading Strategy<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We use <code>run_algorithm()<\/code> function to execute the configured KD Indicator Strategy with the trading period from 2020-01-01 to 2024-04-10 and with the initial capital of 10,000,000 NTD. The output, or&nbsp;<code>results<\/code>, will represent the daily performance and detailed transaction records.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from zipline import run_algorithm\n\nstart_date = pd.Timestamp('2020-01-01',tz='utc')\nend_date = pd.Timestamp('2024-04-10',tz='utc')\n\nresults = run_algorithm(start = start_date,  \n                        end = end_date,\n                        initialize = initialize,                      \n                        capital_base = 1e7,                      \n                        handle_data = handle_data,\n                        data_frequency = 'daily',\n                        bundle = 'tquant'\n                        )\nresults<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full caption-align-center\"><img decoding=\"async\" width=\"1097\" height=\"540\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u4ea4\u6613\u660e\u7d30\u8868.png\" alt=\"KD Indicator Strategy\" class=\"wp-image-22422\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u4ea4\u6613\u660e\u7d30\u8868.png 1097w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u4ea4\u6613\u660e\u7d30\u8868-300x148.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u4ea4\u6613\u660e\u7d30\u8868-1024x504.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u4ea4\u6613\u660e\u7d30\u8868-150x74.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u4ea4\u6613\u660e\u7d30\u8868-768x378.png 768w\" sizes=\"(max-width: 1097px) 100vw, 1097px\" \/><figcaption class=\"wp-element-caption\">Trading Details<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Performance_Evaluation_Using_Pyfolio\"><\/span>Performance Evaluation Using Pyfolio<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import pyfolio as pf\n\nreturns, positions, transactions = pf.utils.extract_rets_pos_txn_from_zipline(results)\nbenchmark_rets = results.benchmark_return\n\n# Creating a Full Tear Sheet\npf.create_full_tear_sheet(bt_returns, positions = positions, transactions = transactions,\n                          benchmark_rets = benchmark_rets)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full caption-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"1172\" height=\"618\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u7e3e\u6548\u5408\u4f75\u5716\u8868.jpg\" alt=\"KD Indicator Strategy\" class=\"wp-image-22427\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u7e3e\u6548\u5408\u4f75\u5716\u8868.jpg 1172w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u7e3e\u6548\u5408\u4f75\u5716\u8868-300x158.jpg 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u7e3e\u6548\u5408\u4f75\u5716\u8868-1024x540.jpg 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u7e3e\u6548\u5408\u4f75\u5716\u8868-150x79.jpg 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u7e3e\u6548\u5408\u4f75\u5716\u8868-768x405.jpg 768w\" sizes=\"(max-width: 1172px) 100vw, 1172px\" \/><figcaption class=\"wp-element-caption\">Backtesting Performance Compared to Benchmark<\/figcaption><\/figure>\n\n\n\n<p>Through the above chart, it can be observed that the market has doubled its returns over the past four years. In contrast, the KD Indicator Strategy only achieved a cumulative return of approximately 17.7%. The annualized return rate and annualized volatility were 4% and 17.1% respectively. This has resulted in a performance gap between the KD Indicator Strategy and the market during the backtesting period. The author believes there are three main reasons for this:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Indicator lag: During the early stages of a market rally, as stock prices gradually climb, the KD indicator reaches an overbought signal of \u2265 80, prompting the strategy to liquidate positions. This prevents it from benefiting from subsequent sustained upward price movements.<\/li>\n\n\n\n<li>&nbsp;Missed timing of buying and selling points: We use K values of 20 and 80 as entry and exit points for trades in this implementation. However, some stocks may start to rise before falling below 20, while others may encounter selling pressure before crossing 80. In such cases, the KD Indicator Strategy fails to generate returns.<\/li>\n\n\n\n<li>Generation of false trading signals: False trading signals may occur in highly volatile stocks, where significant price fluctuations lead to incorrect interpretations by the indicator. For example, the KD Indicator Strategy may generate a buy signal, but the stock is actually experiencing sideways volatility.<\/li>\n<\/ol>\n\n\n\n<p>Regarding the above three points, we can improve the KD Indicator Strategy by combining it with other indicators, such as factors that assist in identifying indicator divergences ( for application of indicator divergences, please refer to <a href=\"https:\/\/www.tejwin.com\/en\/insight\/rsi-moving-average\/\" class=\"ek-link\">TQuant Lab RSI Moving Average Strategy \u2013 Identifying Reversals in Oversold Conditions<\/a> ), or by integrating indicators like MACD. We will leave this for further exploration in the future.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This strategy was inspired by&nbsp;<a href=\"https:\/\/www.tejwin.com\/en\/insight\/kd-indicator\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">the KD Indicator<\/a>, utilizing TQuant Lab to incorporate multiple stocks and the&nbsp;<a href=\"https:\/\/github.com\/tejtw\/TQuant-Lab\/blob\/main\/lecture\/Pipeline%20built-in%20factors.ipynb\" target=\"_blank\" rel=\"noreferrer noopener\">built-in factor<\/a>&nbsp;library of Pipeline to accelerate calculating the K value required for the KD Indicator Strategy. Subsequently, the backtesting of the KD Indicator Strategy was conducted. Although the backtest results were not entirely satisfactory, we observed three drawbacks of the KD Indicator Strategy: indicator lag, missed timing of buying and selling points, and the generation of false trading signals. Investors should also be mindful of these situations when using the KD indicator. Otherwise, combining it with other indicators to assist in entry and exit decisions is preferable.<\/p>\n\n\n\n<p><strong>Please note that the strategy and target discussed in this article are for reference only and do not constitute any recommendation for specific commodities or investments<\/strong>. In the future, we will also introduce using the TEJ database to construct various indicators and backtest their performance. Therefore, we welcome readers interested in various trading strategies to consider purchasing relevant solutions from&nbsp;<a href=\"https:\/\/tquant.tejwin.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">TQuant Lab<\/a>. With our high-quality databases, you can construct a trading strategy that suits your needs.<\/p>\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;\">[TQuant Lab] Solving Your Quantitative Finance Pain Points<\/p>\n<p style=\"margin: 0px; font-size: 24px; font-weight: bold; line-height: 1.5;\">Comprehensively providing all the tools needed for trading backtesting.<\/p>\n<div style=\"margin-top: 32px;\"><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:\/\/tquant.tejwin.com\/\" target=\"_blank\" rel=\"noopener\">Register and Start Your Trial<\/a><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Source_Code\"><\/span>Source Code<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/tejtw\/TEJAPI_Python_Medium_Quant\/blob\/main\/TQ_KD%20Indicator%20Strategy.ipynb\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Click Here to Github<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Extended_Reading\"><\/span>Extended Reading<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.tejwin.com\/en\/insight\/kd-indicator\/\" class=\"ek-link\">KD Indicator<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.tejwin.com\/en\/insight\/rsi-moving-average\/\" class=\"ek-link\">TQuant Lab RSI Moving Average Strategy \u2013 Identifying Reversals in Oversold Conditions<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"About\"><\/span>About<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/tejtw\/TQuant-Lab\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">TQuant Lab Github<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/tquant.tejwin.com\/\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">TQuant Lab Home Page<\/a> <\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The KD Indicator is a practical and widely used tool in technical analysis. It&#8217;s primarily used to determine the short-term strength of stock prices and potential reversal timing. <\/p>\n","protected":false},"featured_media":22371,"template":"","tags":[3063,3176,2988,2990,3166,2537],"insight-category":[690,50,1356],"class_list":["post-22519","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-backtesting-2","tag-python-2","tag-quantitative-analysis","tag-quantitive-trading","tag-tquant-lab-2","tag-2537","insight-category-data-analysis","insight-category-fintech","insight-category-tquant-lab-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/22519","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":18,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/22519\/revisions"}],"predecessor-version":[{"id":24058,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/22519\/revisions\/24058"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/22371"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=22519"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=22519"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight-category?post=22519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}