{"id":24066,"date":"2024-06-12T13:00:00","date_gmt":"2024-06-12T05:00:00","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=24066"},"modified":"2026-02-12T11:07:25","modified_gmt":"2026-02-12T03:07:25","slug":"trend-following-strategy","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insight\/trend-following-strategy\/","title":{"rendered":"Trend-Following Strategy: A Trading Method Used by Fund Managers"},"content":{"rendered":"\n<figure class=\"wp-block-image aligncenter size-full caption-align-center\"><img fetchpriority=\"high\" decoding=\"async\" width=\"4000\" height=\"2667\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/Calico-kitten-MacBook.jpg\" alt=\"Trend-Following Strategy\" class=\"wp-image-23765\" style=\"aspect-ratio:1.5;object-fit:cover\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/Calico-kitten-MacBook.jpg 4000w, https:\/\/www.tejwin.com\/wp-content\/uploads\/Calico-kitten-MacBook-300x200.jpg 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/Calico-kitten-MacBook-1024x683.jpg 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/Calico-kitten-MacBook-150x100.jpg 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/Calico-kitten-MacBook-768x512.jpg 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/Calico-kitten-MacBook-1536x1024.jpg 1536w, https:\/\/www.tejwin.com\/wp-content\/uploads\/Calico-kitten-MacBook-2048x1366.jpg 2048w\" sizes=\"(max-width: 4000px) 100vw, 4000px\" \/><figcaption class=\"wp-element-caption\">Photo by <a href=\"https:\/\/unsplash.com\/@riiiis?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\" target=\"_blank\" rel=\"noopener\">riis riiiis<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/calico-kitten-standing-in-front-of-macbook-pro-g3B53PbBfwU?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\" 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-69f10c9b12423\" 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-69f10c9b12423\"  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\/trend-following-strategy\/#Summary\" >Summary<\/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\/trend-following-strategy\/#Introduction\" >Introduction<\/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\/trend-following-strategy\/#Trend-Following_Strategy\" >Trend-Following 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\/trend-following-strategy\/#Editing_Environment_and_Module_Requirements\" >Editing Environment and Module Requirements<\/a><\/li><\/ul><\/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\/trend-following-strategy\/#Data_Import\" >Data Import<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.tejwin.com\/en\/insight\/trend-following-strategy\/#Utilize_the_get_universe_function_to_obtain_the_stock_pool\" >Utilize the get_universe function to obtain the stock pool.<\/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\/trend-following-strategy\/#Creating_Pipeline_Function_and_Custom_Factor\" >Creating Pipeline Function and Custom Factor<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.tejwin.com\/en\/insight\/trend-following-strategy\/#Custom_Factor_Function\" >Custom Factor Function<\/a><\/li><\/ul><\/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\/trend-following-strategy\/#Creating_Initialize_Function\" >Creating Initialize Function<\/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\/trend-following-strategy\/#Creating_handle_data_Function\" >Creating handle_data Function<\/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\/trend-following-strategy\/#Executing_the_Trend-Following_Strategy\" >Executing the Trend-Following Strategy<\/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\/trend-following-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-13\" href=\"https:\/\/www.tejwin.com\/en\/insight\/trend-following-strategy\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.tejwin.com\/en\/insight\/trend-following-strategy\/#Extended_Reading\" >Extended Reading<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span><strong>Summary<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Difficulty:<\/strong> \u2605\u2605\u2605\u2606\u2606<\/li>\n\n\n\n<li><strong>Focus:<\/strong> Exploring the relationship between trend-following strategies and expected stock returns.<\/li>\n\n\n\n<li><strong>Implementation:<\/strong> Designing and backtesting trend following trading strategies using the TQuant Lab platform to assess risk and performance.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Introduction\"><\/span><strong>Introduction<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Over the past two decades, trend following has been a successful trading strategy used by many fund managers, professional traders, and global macro hedge funds to profit in global futures markets. Applying trend-following strategies to stocks has recently gained significant attention, with a surge in published research and articles. Increasingly, the literature suggests that the trend effects observed in futures markets can similarly apply to stock markets.<br>Michael W. Covel, the founder of the renowned trend-following company TrendFollowing.com, presents a unique perspective. He states, &#8220;In capital markets, investors often seek to establish &#8216;causal relationships&#8217; in price movements, believing it provides a sense of security to their strategies. However, trend following takes a different path. It doesn&#8217;t attempt to predict market directions, but instead, it places a strong emphasis on discipline, precise trading rules, and strict risk control to navigate market volatility.&#8221;<br>Additionally, <a href=\"https:\/\/www.cis.upenn.edu\/~mkearns\/finread\/trend.pdf\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\"><strong>Cole Wilcox and Eric Crittenden<\/strong><\/a> (2005) outlined the conditions for implementing a trend-following strategy in the U.S. stock market:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Investment Scope:<\/strong> Includes the 100 most liquid U.S. stocks with prices not less than $5.<\/li>\n\n\n\n<li><strong>Entry Condition:<\/strong> An entry signal is generated if today&#8217;s closing price equals or exceeds the highest closing price in the stock&#8217;s history.<\/li>\n\n\n\n<li><strong>Exit Condition:<\/strong> Uses a 10-period Average True Range (ATR) as a trailing stop signal. The stock is exited when its price falls below the current price minus the ATR.<\/li>\n<\/ul>\n\n\n\n<p>Based on these principles, this article designs a trend-following strategy suitable for investors&#8217; reference in the Taiwanese stock market.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Trend-Following_Strategy\"><\/span><strong>Trend-Following Strategy<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Investment Scope:<\/strong> Invest in the most liquid Taiwanese stocks with prices not less than NT$10.<\/li>\n\n\n\n<li><strong>Entry Condition:<\/strong> If today&#8217;s closing price exceeds the previous year&#8217;s highest closing price, an entry signal is generated.<\/li>\n\n\n\n<li><strong>Exit Condition:<\/strong> This strategy uses a 10-day Average True Range (ATR) as a trailing stop signal. The stock is exited when its price falls below the current price minus the ATR.<\/li>\n\n\n\n<li><strong>Position Management:<\/strong> Investors hold all stocks that meet the entry criteria and have not triggered a stop-loss. The portfolio is equally weighted and rebalanced daily.<\/li>\n\n\n\n<li><strong>Transaction Costs:<\/strong> TQuant Lab&#8217;s Taiwan fee model.<\/li>\n<\/ul>\n\n\n\n<p><em>Note: To increase entry opportunities, the entry condition of &#8220;highest closing price in history&#8221; is modified to &#8220;highest closing price in the past year.&#8221; Readers may adjust this condition as they see fit.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Editing_Environment_and_Module_Requirements\"><\/span><strong>Editing Environment and Module Requirements<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This article uses macOS and Jupyter Notebook as the editor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Data_Import\"><\/span><strong>Data Import<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport tejapi\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\n\ntej_key = 'your key'\napi_base = 'https:\/\/api.tej.com.tw'\nos.environ&#91;'TEJAPI_KEY'] = tej_key\nos.environ&#91;'TEJAPI_BASE'] = api_base\nstart = '2019-04-01'\nend = '2024-04-01'<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Utilize_the_get_universe_function_to_obtain_the_stock_pool\"><\/span>Utilize the <code>get_universe<\/code> function to obtain the stock pool.<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The data spans from April 1, 2019, to April 1, 2024. We filter all common stocks listed on the Taiwanese stock market as the stock pool and include the Taiwan Weighted Index (IR0001) for market comparison. Finally, we ingest the bundle.<\/p>\n\n\n\n<p><em>Note: To access all common stocks listed on the market, data for 1,890 stocks needs to be retrieved. The large volume of data may result in local memory insufficiency or significant API key usage. Please use it with caution.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_Pipeline_Function_and_Custom_Factor\"><\/span>Creating Pipeline Function and Custom Factor<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Custom_Factor_Function\"><\/span>Custom Factor Function<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The <code>CustomFactor<\/code> allows users to design customized factors as needed. In this case study, we use it to handle:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Average True Range (ATR)<\/strong><\/li>\n\n\n\n<li><strong>Highest Price in the Past Year (N_Year_Highest)<\/strong><\/li>\n<\/ul>\n\n\n\n<p><code>Pipeline()<\/code> provides users with the capability to quickly process quantitative indicators and price-volume data for multiple stocks. In this case study, we use it to handle:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Stocks trading above their highest price in the past year, priced over NT$10, and ranked in the top ten for trading volume (vol_rank)<\/li>\n\n\n\n<li>Current day&#8217;s closing price (curr_price)<\/li>\n\n\n\n<li>Stop-loss point (atr)<\/li>\n\n\n\n<li>Highest price in the past year (highest_price)<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized caption-align-center\"><img decoding=\"async\" width=\"2506\" height=\"1122\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.40.10.png\" alt=\"Trend-Following Strategy\" class=\"wp-image-23866\" style=\"width:840px;height:auto\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.40.10.png 2506w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.40.10-300x134.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.40.10-1024x458.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.40.10-150x67.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.40.10-768x344.png 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.40.10-1536x688.png 1536w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.40.10-2048x917.png 2048w\" sizes=\"(max-width: 2506px) 100vw, 2506px\" \/><figcaption class=\"wp-element-caption\">Pipeline Information<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_Initialize_Function\"><\/span>Creating <code>Initialize<\/code> Function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The <code>initialize()<\/code> function is used to define the daily trading environment before trading starts. In this example, we set:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Slippage costs<\/li>\n\n\n\n<li>Taiwan stock market fee model<\/li>\n\n\n\n<li>Taiwan Weighted Index (<em>IR0001<\/em>) as the benchmark index<\/li>\n\n\n\n<li>Incorporation of strategy factors designed in the Pipeline into the trading process<\/li>\n\n\n\n<li>Setting the <code>context.stop_loss<\/code> variable to record stop-loss points during backtesting<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_handle_data_Function\"><\/span>Creating <code>handle_data<\/code> Function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The <code>handle_data()<\/code> function is a crucial part of constructing the strategy. It is called daily after the backtest starts and is primarily responsible for setting the trading strategy, placing orders, and recording trading information. <\/p>\n\n\n\n<p>For detailed trading rules for this strategy, please refer to <a href=\"https:\/\/github.com\/tejtw\/TEJAPI_Python_Medium_Application\/blob\/f656231677aa8f89d04ef1f862665b9b3c0da146\/%E8%B6%A8%E5%8B%A2%E8%B7%9F%E8%B9%A4.ipynb\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">trend_following.ipynb<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Executing_the_Trend-Following_Strategy\"><\/span>Executing the Trend-Following Strategy<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Use <code>run_algorithm()<\/code> to execute the above-set strategy, setting the trading period from <code>start_dt<\/code> (<em>2019-04-16<\/em>) to <code>end_dt<\/code> (<em>2024-04-01<\/em>), using the <code>tquant<\/code> dataset, with an initial capital of one million NT dollars. The output <code>results<\/code> includes the daily performance and transaction details.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full caption-align-center\"><img decoding=\"async\" width=\"2602\" height=\"864\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.55.06.png\" alt=\"Trend-Following Strategy\" class=\"wp-image-23868\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.55.06.png 2602w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.55.06-300x100.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.55.06-1024x340.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.55.06-150x50.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.55.06-768x255.png 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.55.06-1536x510.png 1536w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-05-\u4e0b\u53484.55.06-2048x680.png 2048w\" sizes=\"(max-width: 2602px) 100vw, 2602px\" \/><figcaption class=\"wp-element-caption\">Cumulative Return<\/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;\">Start Building Portfolios That Outperform the Market!<\/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\/market-data\/\">TEJ Market Databank<\/a><\/strong><\/div>\n<\/div>\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<figure class=\"wp-block-image size-full caption-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"1705\" height=\"885\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u5408\u4f75\u5716\u50cf-1.png\" alt=\"Trend-Following Strategy\" class=\"wp-image-24000\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u5408\u4f75\u5716\u50cf-1.png 1705w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u5408\u4f75\u5716\u50cf-1-300x156.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u5408\u4f75\u5716\u50cf-1-1024x532.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u5408\u4f75\u5716\u50cf-1-150x78.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u5408\u4f75\u5716\u50cf-1-768x399.png 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u5408\u4f75\u5716\u50cf-1-1536x797.png 1536w\" sizes=\"(max-width: 1705px) 100vw, 1705px\" \/><figcaption class=\"wp-element-caption\">Backtest Performance Comparison with Market<\/figcaption><\/figure>\n\n\n\n<p>The momentum factor strategy achieved an annualized return of approximately 31.1% over these 57 months, with a cumulative return of 266.536%. Although there was a slight underperformance compared to the market in the initial stages, overall profitability was superior to the market. The beta value of 0.79 indicates that the strategy is less sensitive to market fluctuations, reflecting the core concept of trend following, which does not focus on overall market volatility or predict market directions. However, due to the strategy&#8217;s focus on stock price movements, it targets stocks breaking new highs, which intuitively results in higher volatility, reaching 26.1%. Although high, this volatility primarily trends upward, as indicated by the Sortino Ratio of 1.17, an ideal figure (a lower Sortino Ratio means higher negative returns per unit risk).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full caption-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"1070\" height=\"351\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.17.29.png\" alt=\"Trend-Following Strategy\" class=\"wp-image-24002\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.17.29.png 1070w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.17.29-300x98.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.17.29-1024x336.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.17.29-150x49.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.17.29-768x252.png 768w\" sizes=\"(max-width: 1070px) 100vw, 1070px\" \/><figcaption class=\"wp-element-caption\">Annualized Return Bar Chart<\/figcaption><\/figure>\n\n\n\n<p>Apart from the bearish year of 2022, all other trading years showed positive returns.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full caption-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"1604\" height=\"515\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.40.45.png\" alt=\"Trend-Following Strategy\" class=\"wp-image-24004\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.40.45.png 1604w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.40.45-300x96.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.40.45-1024x329.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.40.45-150x48.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.40.45-768x247.png 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.40.45-1536x493.png 1536w\" sizes=\"(max-width: 1604px) 100vw, 1604px\" \/><figcaption class=\"wp-element-caption\">Long\/Short Position Holdings Changes<\/figcaption><\/figure>\n\n\n\n<p>The chart of long and short position holdings indicates that, under the strategy&#8217;s setup with a maximum of 10 stocks, the number of holdings mostly stayed around 10, with a minimum of 4. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full caption-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"1603\" height=\"536\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.49.22.png\" alt=\"Trend-Following Strategy\" class=\"wp-image-24006\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.49.22.png 1603w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.49.22-300x100.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.49.22-1024x342.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.49.22-150x50.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.49.22-768x257.png 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/\u622a\u5716-2024-06-07-\u4e0a\u53489.49.22-1536x514.png 1536w\" sizes=\"(max-width: 1603px) 100vw, 1603px\" \/><figcaption class=\"wp-element-caption\">Turnover Rate Distribution<\/figcaption><\/figure>\n\n\n\n<p>Due to daily rebalancing, the turnover rate was occasionally high, warranting attention to transaction fees.<\/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 applies the research of <a href=\"https:\/\/www.cis.upenn.edu\/~mkearns\/finread\/trend.pdf\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Cole Wilcox and Eric Crittenden<\/a> (2005) to verify the profitability of trend following in the Taiwanese stock market, yielding the following results:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Advantages:<\/strong> Excellent profitability, intuitive and simple entry and exit conditions.<\/li>\n\n\n\n<li><strong>Disadvantages:<\/strong> Daily rebalancing results in a higher turnover rate, requiring additional attention to transaction fees.<\/li>\n<\/ul>\n\n\n\n<p>Investors are welcome to refer to this strategy. We will continue introducing various indicators constructed using the TEJ database and backtest their performance. Readers interested in various trading backtests are encouraged to consider <strong><a href=\"https:\/\/tquant.tejwin.com\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">TQuant Lab<\/a><\/strong>&#8216;s related packages to build their trading strategies using high-quality databases.<\/p>\n\n\n\n<p><strong>Disclaimer:<\/strong> This strategy is for reference only and does not represent any product or investment advice.<\/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 has-custom-font-size\" style=\"font-size:22px\"><a class=\"wp-block-button__link has-background wp-element-button\" href=\"https:\/\/www.tejwin.com\/en\/databank-solution\/market-data\/\" style=\"border-radius:16px;background:linear-gradient(135deg,rgb(160,209,216) 0%,rgb(51,145,181) 50%,rgb(50,95,191) 100%)\"><strong>Access to Comprehensive Retail Investors Data<\/strong><br><strong>Start Building Portfolios That Outperform the Market Today!<\/strong><\/a><\/div>\n<\/div>\n\n\n\n<div style=\"height:22px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-text-align-center\" style=\"font-size:32px\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><strong><em>&#8220;Taiwan stock market data, TEJ collect it all.&#8221;<\/em><\/strong><\/mark><\/p>\n\n\n\n<p>The characteristics of the Taiwan stock market differ from those of other European and American markets, and <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\"><span style=\"text-decoration: underline;\" class=\"ek-underline\">the dynamics of retail investors are worth noting<\/span><\/mark>. Especially in the first quarter of 2024, with the <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#c05d5d\" class=\"has-inline-color\">Taiwan Stock Exchange reaching a new high of 20,000 points<\/mark><\/strong> due to the rise in TSMC&#8217;s stock price, global institutional investors are paying more attention to the performance of the Taiwan stock market.&nbsp;<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0978b8\" class=\"has-inline-color\">Taiwan Economical Journal (TEJ)<\/mark><\/strong>, a financial database established in Taiwan for over 30 years, serves local financial institutions and academic institutions, and has long-term cooperation with internationally renowned data providers, providing high-quality financial data for five financial markets in Asia.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><mark style=\"background-color:#ebc766\" class=\"has-inline-color has-black-color\">Complete Coverage<\/mark><\/strong>: Includes all listed companies on stock markets in Taiwan, China, Hong Kong, Japan, Korea, etc.&nbsp;<\/li>\n\n\n\n<li><strong><mark style=\"background-color:#ebc766\" class=\"has-inline-color\">Comprehensive Analysis of Enterprises<\/mark><\/strong>: Operational aspects, financial aspects, securities market performance, ESG sustainability, etc.&nbsp;<\/li>\n\n\n\n<li><strong><mark style=\"background-color:#ebc766\" class=\"has-inline-color\">High-Quality Database<\/mark><\/strong>: TEJ data is cleaned, checked, enhanced, and integrated to ensure it meets the information needs of financial and market analysis.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p>With TEJ&#8217;s assistance, you can access relevant information about major stock markets in Asia, such as securities market, financials data, enterprise operations, board of directors, sustainability data, etc., providing investors with timely and high-quality content. Additionally, TEJ offers advisory services to help solve problems in theoretical practice and financial management!<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-a89b3969 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-100 has-custom-font-size\" style=\"font-size:21px\"><a class=\"wp-block-button__link has-background has-text-align-center wp-element-button\" href=\"https:\/\/www.tejwin.com\/en\/contact\/\" style=\"border-radius:16px;background:linear-gradient(135deg,rgb(160,209,216) 0%,rgb(51,145,181) 50%,rgb(50,95,191) 100%)\"><strong>Want to Learn More About Our Databases?<br>Contact Us and Get the Free Trial!<\/strong><\/a><\/div>\n<\/div>\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\/high-dividend-etf\/\" class=\"ek-link\">The Gospel for Dividend Investors? Backtesting Performance of High Dividend ETF<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-lab-insider-transfer-strategy\/\" class=\"ek-link\">Insider Transfer Strategy: A Solution to Timing Difficulties<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Over the past two decades, trend-following has been a successful trading strategy used by many fund managers, professional traders, and global macro hedge funds to profit in global futures markets. Recently, the application of trend following strategies to stocks has gained significant attention, with a surge in published research and articles. Increasingly, literature suggests that the trend effects observed in futures markets can similarly apply to stock markets.<\/p>\n","protected":false},"featured_media":23766,"template":"","tags":[3063,3176,2990,3005,3166],"insight-category":[3509,1356,885],"class_list":["post-24066","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-backtesting-2","tag-python-2","tag-quantitive-trading","tag-tejapi-application","tag-tquant-lab-2","insight-category-fintech-en","insight-category-tquant-lab-en","insight-category-tquant-lab"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/24066","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":6,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/24066\/revisions"}],"predecessor-version":[{"id":25867,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/24066\/revisions\/25867"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/23766"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=24066"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=24066"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight-category?post=24066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}