{"id":19338,"date":"2023-09-05T14:00:00","date_gmt":"2023-09-05T06:00:00","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=19338"},"modified":"2023-11-20T10:16:26","modified_gmt":"2023-11-20T02:16:26","slug":"macd-tquant","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insight\/macd-tquant\/","title":{"rendered":"TQuant Lab\u00a0MACD Trading Strategy"},"content":{"rendered":"\n<figure class=\"wp-block-image aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1600\" height=\"1063\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/image-29.jpeg\" alt=\"TQuant Lab\u00a0MACD\u4ea4\u6613\u7b56\u7565\" class=\"wp-image-19343\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/image-29.jpeg 1600w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-29-300x199.jpeg 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-29-1024x680.jpeg 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-29-150x100.jpeg 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-29-768x510.jpeg 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-29-1536x1020.jpeg 1536w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><figcaption class=\"wp-element-caption\">Photo by <a href=\"https:\/\/unsplash.com\/@erdaest?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Erda Estremera<\/a> on&nbsp;<a href=\"https:\/\/unsplash.com?utm_source=medium&amp;utm_medium=referral\" 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-69f10e1242682\" 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-69f10e1242682\"  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\/macd-tquant\/#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\/macd-tquant\/#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\/macd-tquant\/#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-4\" href=\"https:\/\/www.tejwin.com\/en\/insight\/macd-tquant\/#Create_the_initialize_function\" >Create the initialize function<\/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\/macd-tquant\/#Create_the_handle_data_function\" >Create the handle_data function<\/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\/macd-tquant\/#Create_the_analyze_Function\" >Create the analyze Function<\/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\/macd-tquant\/#Execute_MACD_Trading_Strategy\" >Execute MACD 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\/macd-tquant\/#Report\" >Report<\/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\/macd-tquant\/#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\/macd-tquant\/#Source_Code\" >Source Code<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.tejwin.com\/en\/insight\/macd-tquant\/#Extended_Reading\" >Extended Reading<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.tejwin.com\/en\/insight\/macd-tquant\/#Related_Links\" >Related Links<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Highlight\"><\/span><strong>Highlight<\/strong><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>Using TQuant Lab to design MACD Trading Strategy  <\/li>\n\n\n\n<li>Using TQuant Lab to generate performance reports and visualizes charts<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Preface\"><\/span><strong>Preface<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>MACD, which stands for Moving Average Convergence Divergence, is a commonly used tool in technical analysis for measuring the trend changes and momentum of an asset.<\/p>\n\n\n\n<p>MACD consists of two main components:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Short-Term Moving Average Line: This is a shorter moving average line typically calculated over a shorter time period, such as a 12-day moving average.<\/li>\n\n\n\n<li>Long-Term Moving Average Line: This is a longer moving average line calculated over a longer time period, such as a 26-day moving average.<\/li>\n<\/ol>\n\n\n\n<p>The calculation steps for MACD are as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Calculate the moving averages for the fast line and slow line.<\/li>\n\n\n\n<li>Subtract the slow line from the fast line to obtain the difference, which is the fast line.<\/li>\n\n\n\n<li>Calculate the moving average of these differences, resulting in the MACD indicator itself, also known as the slow line.<\/li>\n<\/ul>\n\n\n\n<p>MACD values can be positive, negative, or zero, and their relative positions and changes provide insights into the asset&#8217;s price trends.<\/p>\n\n\n\n<p>Key MACD signals include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Golden Cross: When the fast line crosses above the slow line, it is typically considered a signal of an upward trend, potentially indicating a price increase.<\/li>\n\n\n\n<li>Death Cross: When the fast line crosses below the slow line, it is generally seen as a signal of a downward trend, possibly indicating a price decrease.<\/li>\n<\/ul>\n\n\n\n<p>Additionally, the MACD histogram represents the difference between the fast line and slow line, with the height of the bars indicating the magnitude of this difference.<\/p>\n\n\n\n<h2 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><\/h2>\n\n\n\n<p>This article uses the Mac operating system and Jupyter Notebook as the editor.<br>Before delving into the main content, let&#8217;s start by providing the domain and key. Following that, we will proceed with data importation. In this practical implementation, we will use TSMC (stock code: 2330) as an example, setting the time range from December 30, 2018, to May 26, 2023.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>import os<br>import pandas as pd<br>import numpy as np<br><br>os.environ&#91;'TEJAPI_BASE'] = 'https:\/\/api.tej.com.tw'<br>os.environ&#91;'TEJAPI_KEY'] = 'your_key'<br>os.environ&#91;'mdate'] = '20181230 20230526'<br>os.environ&#91;'ticker'] = '2330'<br><br># \u4f7f\u7528 ingest \u5c07\u80a1\u50f9\u8cc7\u6599\u5c0e\u5165\u66ab\u5b58\uff0c\u4e26\u4e14\u547d\u540d\u8a72\u80a1\u7968\u7d44\u5408 (bundle) \u70ba tquant<br>!zipline ingest -b tquant<br><br>import talib<br>from zipline.api import order_target, record, symbol<br>from zipline.finance import commission, slippage<br>import matplotlib.pyplot as plt<\/code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_the_initialize_function\"><\/span>Create the initialize function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Firstly, let&#8217;s establish the initialize function, which is used to define the trading environment before the commencement of trading. In this example, we set:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Stock code<\/li>\n\n\n\n<li>Number of shares held<\/li>\n\n\n\n<li>Position holding status<\/li>\n\n\n\n<li>Transaction fees<\/li>\n\n\n\n<li>Liquidity slippage<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>def initialize(context):<br>context.sym = symbol('2330')<br>context.i = 0<br>context.invested = False<br>context.set_commission(commission.PerDollar(cost=0.00285))<br>context.set_slippage(slippage.VolumeShareSlippage())<\/code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_the_handle_data_function\"><\/span>Create the handle_data function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The handle_data function is used to process the daily trading strategy or actions. In this context:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Condition 1: When the fast line crosses above the slow line, and the MACD histogram changes from negative to positive, it is considered a buy signal.<\/li>\n\n\n\n<li>Condition 2: When the fast line falls below the slow line, the MACD histogram changes from positive to negative, and there is a non-zero position holding, it is considered a sell signal.<\/li>\n<\/ul>\n\n\n\n<p>We use talib to calculate the moving averages, setting the short-term window period to 12 days, the long-term window period to 26 days, and the MACD line&#8217;s window period to 9 days.<\/p>\n\n\n\n<p>In addition to the default output information, we also want to record additional information during the execution of the trading strategy, such as the closing price, fast line index, slow line index, buy signal status, sell signal status, etc. Therefore, in the &#8216;record&#8217; section, we add output fields accordingly.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>def handle_data(context, data):<br>trailing_window = data.history(context.sym, 'price', 35, '1d')#35 = 26 + 9<br>if trailing_window.isnull().values.any():<br>return<br><br>short_ema = talib.EMA(trailing_window.values, timeperiod = 12)<br>long_ema = talib.EMA(trailing_window.values, timeperiod = 26)<br>dif = short_ema - long_ema<br>MACD = talib.EMA(dif, timeperiod = 9)<br>bar = dif - MACD<br>buy = False<br>sell = False<br><br># Trading logic<br>#condition1<br>if (dif&#91;-2] &lt; MACD&#91;-2]) and (dif&#91;-1] &gt; MACD&#91;-1]) and (bar&#91;-2] &lt; 0) and (bar&#91;-1] &gt; 0):<br><br>order_target(context.sym, 1000)<br>context.invested = True<br>buy = True<br><br>#condition2<br>elif (dif&#91;-2] &gt; MACD&#91;-2]) and (dif&#91;-1] &lt; MACD&#91;-1]) and (bar&#91;-2] &gt; 0) and (bar&#91;-1] &lt; 0) and context.invested:<br>order_target(context.sym, 0)<br>context.invested = False<br>sell = True<br><br># Save values for later inspection<br>record(TSMC = data.current(symbol('2330'), 'close'),<br>dif = dif&#91;-1],<br>MACD = MACD&#91;-1],<br>bar = bar&#91;-1],<br>buy = buy,<br>sell = sell)<\/code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_the_analyze_Function\"><\/span>Create the analyze Function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In the analyze function, utilize <strong>matplotlib.pyplot <\/strong>to draw the portfolio value line chart and MACD indicator chart. We plan to generate two charts. The first one is the portfolio value line chart, responsible for recording the trend of the portfolio value. The second one is the MACD indicator chart, tasked with documenting the trends of the fast line, slow line, MACD histogram, and marking buy and sell points.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code># Note: this function can be removed if running<br># this algorithm on quantopian.com<br>def analyze(context=None, results=None):<br>import matplotlib.pyplot as plt<br>import logbook<br>logbook.StderrHandler().push_application()<br>log = logbook.Logger('Algorithm')<br><br>fig = plt.figure()<br>ax1 = fig.add_subplot(211)<br>results.portfolio_value.plot(ax=ax1)<br>ax1.set_ylabel('Portfolio value (TWD)')<br>ax2 = fig.add_subplot(212)<br>ax2.set_ylabel('MACD')<br># If data has been record()ed, then plot it.<br># Otherwise, log the fact that no data has been recorded.<br>if 'dif' in results and 'MACD' in results:<br>results&#91;&#91;'dif', 'MACD']].plot(ax=ax2)<br>ax2.plot(<br>results.index&#91;results&#91;\"buy\"] == True],<br>results.loc&#91;results&#91;\"buy\"] == True, 'MACD'],<br>'^',<br>markersize=10,<br>color='m',<br>)<br>ax2.plot(<br>results.index&#91;results&#91;\"sell\"] == True],<br>results.loc&#91;results&#91;\"sell\"] == True, 'MACD'],<br>'v',<br>markersize=10,<br>color='k',<br>)<br>ax3 = ax2.twinx()<br>colors = &#91;\"red\" if i &gt; 0 else \"green\" for i in results&#91;'bar']]<br>ax3.bar(results.index, results&#91;'bar'], color=colors, alpha=0.5, width=0.4, label='MACD Bar')<br><br>lines, labels = ax2.get_legend_handles_labels()<br>bars, bar_labels = ax3.get_legend_handles_labels()<br>ax2.legend(lines + bars, labels + bar_labels, loc='upper right')<br><br>plt.gcf().set_size_inches(18, 8)<br>else:<br>msg = 'TSMC - dif and MACD data not captured using record().'<br>ax2.annotate(msg, xy=(0.1, 0.5))<br>log.info(msg)<br>plt.show()<\/code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Execute_MACD_Trading_Strategy\"><\/span>Execute MACD Trading Strategy<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Utilize the &#8216;run_algorithm&#8217; function to execute the compiled trading strategy. Set the trading period from December 30, 2018, to May 26, 2023, with an initial capital of 100,000 CNY. Employ the &#8216;tquant&#8217; dataset. The output variable &#8216;results&#8217; will represent the daily performance and details of the trades.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>from zipline import run_algorithm<br><br>start_date = pd.Timestamp('2018-12-30',tz='utc')<br>end_date = pd.Timestamp('2023-05-26',tz='utc')<br>results = run_algorithm(start= start_date,<br>end=end_date,<br>initialize=initialize,<br>capital_base=1e6,<br>analyze=analyze,<br>handle_data=handle_data,<br>data_frequency='daily',<br>bundle='tquant'<br>)<\/code><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" width=\"1088\" height=\"453\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/image-369.png\" alt=\"Trading Strategy Performance Report\" class=\"wp-image-19339\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/image-369.png 1088w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-369-300x125.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-369-1024x426.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-369-150x62.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-369-768x320.png 768w\" sizes=\"(max-width: 1088px) 100vw, 1088px\" \/><figcaption class=\"wp-element-caption\">Trading Strategy Performance Report<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Report\"><\/span>Report<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" width=\"801\" height=\"616\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/image-370.png\" alt=\"Trading Strategy Performance Report\" class=\"wp-image-19341\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/image-370.png 801w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-370-300x231.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-370-150x115.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/image-370-768x591.png 768w\" sizes=\"(max-width: 801px) 100vw, 801px\" \/><figcaption class=\"wp-element-caption\">Trading Strategy Performance Report<\/figcaption><\/figure>\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>Based on the above report, we can observe that the portfolio value increased by approximately thirty percent. Through the MACD indicator chart, we gain a clear understanding of the timing of each trading action and trend performance. With TQuant Lab, we can significantly reduce code complexity, implementing complex backtesting systems with minimal code. However, it&#8217;s important to note that while MACD is a popular technical analysis tool, it is not absolutely reliable, and using it in isolation may generate false signals. Typically, technical analysts combine MACD with other indicators and analysis methods for more accurate judgments.<\/p>\n\n\n\n<p>However, it is crucial to reiterate that the targets mentioned in this article are for illustrative purposes only and do not represent recommendations or advice on any financial products. Additionally, the outcomes generated by the language model do not guarantee absolute correctness and require further confirmation. Therefore, readers interested in topics such as strategy construction, performance backtesting, and research evidence are encouraged to explore solutions available in <a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/index\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">TEJ E Shop<\/a>, which provides comprehensive databases for various tests.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Source_Code\"><\/span><strong>Source Code<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gist.github.com\/tej87681088\/aac61698c312a70fce778b903911464a\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Github<\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Extended_Reading\"><\/span>Extended Reading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.tejwin.com\/en\/insight\/analysis-of-the-chip-concentration\/\" class=\"ek-link\">Analysis of the chip concentration<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.tejwin.com\/wp-admin\/post.php?post=17017&amp;action=edit&amp;lang=en\" class=\"ek-link\">Herding indicators<\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Related_Links\"><\/span>Related Links<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.tej.com.tw\/index.html\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">TEJ API <\/a>HomePage<\/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<\/a> Database Purchase<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>MACD, which stands for Moving Average Convergence Divergence, is a commonly used tool in technical analysis for measuring the trend changes and momentum of an asset.<\/p>\n","protected":false},"featured_media":17247,"template":"","tags":[2603,2371,3008,2388,2428,2537],"insight-category":[690,3509,1356,885],"class_list":["post-19338","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-macd","tag-python","tag-tejapi-quant","tag-tquant-lab","tag-2428","tag-2537","insight-category-data-analysis","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\/19338","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":0,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/19338\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/17247"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=19338"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=19338"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight-category?post=19338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}