{"id":4941,"date":"2024-02-11T12:00:55","date_gmt":"2024-02-11T12:00:55","guid":{"rendered":"https:\/\/eodhd.com\/financial-academy\/?p=4941"},"modified":"2025-02-05T13:33:06","modified_gmt":"2025-02-05T13:33:06","slug":"practical-guide-to-automated-detection-trading-patterns-with-python","status":"publish","type":"post","link":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python","title":{"rendered":"Practical Guide to Automated Detection Trading Patterns with Python"},"content":{"rendered":"\n<p>In order to discuss this topic of Practical Guide to Automated Detection Trading Patterns with Python, we need to introduce the basics first. I&#8217;m sure everyone is familiar with what a trading graph looks like, often represented with green and red bars forming a line graph. There is  a lot of data and information condensed into this simple shape. A candle represents one interval of data E.g. one hour on the graph. It will contain four vital pieces of information. The Open, High, Low, and Close for the interval E.g. hour. This is often referred to as OHLC data. The candle will be displayed green if the candle \/ hour has an Close higher than the Open, and red if the Close is lower than the Open. This is better explained by the image below and hope this enjoy this Practical Guide to Automated Detection Trading Patterns with Python.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"686\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/trading-candlestick.webp\" alt=\"\" class=\"wp-image-4943\"\/><figcaption class=\"wp-element-caption\">Image from <a href=\"https:\/\/www.ig.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">ig.com<\/a><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n\n\n\n\n\n\n<p>An example of what this looks like is as follows:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"4458\" height=\"2626\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/US500-1-hour-Graph.png\" alt=\"\" class=\"wp-image-4945\"\/><figcaption class=\"wp-element-caption\">US500 hourly from <a href=\"https:\/\/www.ig.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">ig.com<\/a><\/figcaption><\/figure>\n<\/div>\n\n\n<p>What you may notice is that certain patterns emerge with the candle sequence, and these are known as candlestick patterns. There are trading strategies based on these patterns.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-using-s-amp-p-500-from-eodhd-apis-to-demonstrate-this\">Using S&amp;P 500 from EODHD APIs to demonstrate this<\/h2>\n\n\n\n<p>The first step is to retrieve the dataset we need, and we will use the <a href=\"https:\/\/eodhd.com\/financial-apis\/python-financial-libraries-and-code-samples\/\" target=\"_blank\" rel=\"noreferrer noopener\">official EODHD API Python library<\/a> for this. The code below will retrieve 720 hours of data which is 30 days.<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-f85c4601cf44a942cdacd36beea65f07\"><code lang=\"python\" class=\"language-python\">import config as cfg\nfrom eodhd import APIClient\n\napi = APIClient(cfg.API_KEY)\n\n\ndef get_ohlc_data():\n    df = api.get_historical_data(\"AAPL.US\", \"1h\", results=(24*30))\n    return df\n\n\nif __name__ == \"__main__\":\n    df = get_ohlc_data()\n    print(df)<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1822\" height=\"426\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/US500-hourly-30-days.png\" alt=\"\" class=\"wp-image-4946\"\/><figcaption class=\"wp-element-caption\">Screenshot by Author<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n\n\n\n<p>We can start with a simple candlestick pattern called the<strong> hammer<\/strong> or <strong>hammer pattern<\/strong>. It is a single-candle bullish reversal pattern that be be spotted at the end of a downtrend. The Open, Close, at the top are approximately at the same price, while there is a long wick that extends lower, twice as big as the short body.&nbsp;For more information on this, I highly recommend the <a href=\"https:\/\/www.investopedia.com\/terms\/h\/hammer.asp\" target=\"_blank\" rel=\"noreferrer noopener\">description on Investopedia<\/a>.<\/p>\n\n\n\n<p>A modified version of the candlestick image above to represent this is as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"388\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/trading-candlestick-hammer-2.webp\" alt=\"\" class=\"wp-image-4949\" style=\"width:840px;height:auto\"\/><\/figure>\n\n\n\n<p>To summarise, the <strong>hammer pattern<\/strong> is a bullish signal and is considered a weak reversal pattern. In other words it suggests that the market may change direction from down to up.<\/p>\n\n\n\n<p>I&#8217;ve written some code to identify these candles in our dataset.<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-233b8175659916796b505ef1c473e40e\"><code lang=\"python\" class=\"language-python\"><strong>import pandas as pd<\/strong>\nimport config as cfg\nfrom eodhd import APIClient\n\napi = APIClient(cfg.API_KEY)\n\n\n<strong>def candle_hammer(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"* Candlestick Detected: Hammer (\"Weak - Reversal - Bullish Signal - Up\"\"\"\n<\/strong>\n<strong>    # Fill NaN values with 0\n    df = df.fillna(0)<\/strong>\n<strong>\n    return (\n        ((df[\"high\"] - df[\"low\"]) &gt; 3 * (df[\"open\"] - df[\"close\"]))\n        &amp; (((df[\"close\"] - df[\"low\"]) \/ (0.001 + df[\"high\"] - df[\"low\"])) &gt; 0.6)\n        &amp; (((df[\"open\"] - df[\"low\"]) \/ (0.001 + df[\"high\"] - df[\"low\"])) &gt; 0.6)\n    )<\/strong>\n\n\ndef get_ohlc_data():\n    df = api.get_historical_data(\"AAPL.US\", \"1h\", results=(24*30))\n    return df\n\n\nif __name__ == \"__main__\":\n    df = get_ohlc_data()\n<strong>    df[\"hammer\"] = candle_hammer(df)\n    print(df)\n    print(df[df[\"hammer\"] == True])<\/strong><\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1938\" height=\"850\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/US500-hammer-candles.png\" alt=\"\" class=\"wp-image-4950\"\/><figcaption class=\"wp-element-caption\">Screenshot by Author<\/figcaption><\/figure>\n<\/div>\n\n\n<p>For illustration purposes, I&#8217;m printing the dataset twice. The first dataset shows the detection of the <strong>hammer candle<\/strong>. The second dataset shows only the rows where the <strong>hammer pattern<\/strong> was detected. Over the last 720 hours, the <strong>hammer pattern<\/strong> has been detected 67 times.<\/p>\n\n\n\n<p>Following on from this there is a closely related candlestick pattern that follows on nicey from this and it is the <strong>inverted hammer pattern<\/strong>. It is the opposite of the hammer and looks like hammer standing on its head on the graph. It&#8217;s still a bullish candle and will be seen at the bottom of a downtrend.<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-12b502d4a21da5000bf8dcbcbbe5364b\"><code lang=\"python\" class=\"language-python\">def candle_inverted_hammer(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"* Candlestick Detected: Inverted Hammer (\"Weak - Continuation - Bullish Pattern - Up\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((df[\"high\"] - df[\"low\"]) &gt; 3 * (df[\"open\"] - df[\"close\"]))\n        &amp; ((df[\"high\"] - df[\"close\"]) \/ (0.001 + df[\"high\"] - df[\"low\"]) &gt; 0.6)\n        &amp; ((df[\"high\"] - df[\"open\"]) \/ (0.001 + df[\"high\"] - df[\"low\"]) &gt; 0.6)\n    )<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2172\" height=\"2078\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/US500-inverted-hammer-candles.png\" alt=\"\" class=\"wp-image-4952\"\/><figcaption class=\"wp-element-caption\">Screenshot by Author<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-candlestick-patterns\">Candlestick Patterns<\/h2>\n\n\n\n<p>Candlestick patterns are generally categorised into two groups:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Bullish or Bearish<\/li>\n\n\n\n<li>Indecision \/ Neutral, Weak, Reliable, or Strong<\/li>\n<\/ol>\n\n\n\n<p>Here is a summary of the common candlestick patterns:<\/p>\n\n\n\n<p><strong>Indecision \/ Neutral <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Doji<\/li>\n<\/ul>\n\n\n\n<p><strong>Weak<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Hammer (bullish)<\/li>\n\n\n\n<li>Inverted Hammer (bearish)<\/li>\n\n\n\n<li>Shooting Star (bearish)<\/li>\n<\/ul>\n\n\n\n<p><strong>Reliable<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Hanging Man (bearish)<\/li>\n\n\n\n<li>Three Line Strike (bullish)<\/li>\n\n\n\n<li>Two Black Gapping (bearish)<\/li>\n\n\n\n<li>Abandoned Baby (bullish)<\/li>\n\n\n\n<li>Morning Doji Star (bullish)<\/li>\n\n\n\n<li>Evening Doji Star (bearish)<\/li>\n<\/ul>\n\n\n\n<p><strong>Strong<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Three White Soldiers (bullish)<\/li>\n\n\n\n<li>Three Black Crows (bearish)<\/li>\n\n\n\n<li>Morning Star (bullish)<\/li>\n\n\n\n<li>Evening Star (bearish)<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-center bordered_paragraph has-background\" style=\"background-color:#f1f6f9;font-size:16px;font-style:normal;font-weight:500\">While understanding the trading signals is crucial, the reliability of the data you use is equally important. Learn more:<br><a href=\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/reliability-of-free-stock-data\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Free vs Paid Stock Data: Which One Can You Trust?<\/strong><\/a> <\/p>\n\n\n\n<p>I&#8217;ve translated these candlestick patterns into Python functions. I&#8217;ve used Numpy for some of the more complicated candlestick patterns.<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-fd9da1a8af0dac562e2d950b74ab3e9f\"><code lang=\"python\" class=\"language-python\"><strong>import numpy as np<\/strong>\n\ndef candle_hammer(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"* Candlestick Detected: Hammer (\"Weak - Reversal - Bullish Signal - Up\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((df[\"high\"] - df[\"low\"]) &gt; 3 * (df[\"open\"] - df[\"close\"]))\n        &amp; (((df[\"close\"] - df[\"low\"]) \/ (0.001 + df[\"high\"] - df[\"low\"])) &gt; 0.6)\n        &amp; (((df[\"open\"] - df[\"low\"]) \/ (0.001 + df[\"high\"] - df[\"low\"])) &gt; 0.6)\n    )\n\n\ndef candle_inverted_hammer(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"* Candlestick Detected: Inverted Hammer (\"Weak - Reversal - Bullish Pattern - Up\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((df[\"high\"] - df[\"low\"]) &gt; 3 * (df[\"open\"] - df[\"close\"]))\n        &amp; ((df[\"high\"] - df[\"close\"]) \/ (0.001 + df[\"high\"] - df[\"low\"]) &gt; 0.6)\n        &amp; ((df[\"high\"] - df[\"open\"]) \/ (0.001 + df[\"high\"] - df[\"low\"]) &gt; 0.6)\n    )\n\n\ndef candle_shooting_star(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"* Candlestick Detected: Shooting Star (\"Weak - Reversal - Bearish Pattern - Down\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((df[\"open\"].shift(1) &lt; df[\"close\"].shift(1)) &amp; (df[\"close\"].shift(1) &lt; df[\"open\"]))\n        &amp; (df[\"high\"] - np.maximum(df[\"open\"], df[\"close\"]) &gt;= (abs(df[\"open\"] - df[\"close\"]) * 3))\n        &amp; ((np.minimum(df[\"close\"], df[\"open\"]) - df[\"low\"]) &lt;= abs(df[\"open\"] - df[\"close\"]))\n    )\n\n\ndef candle_hanging_man(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"* Candlestick Detected: Hanging Man (\"Weak - Reliable - Bearish Pattern - Down\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((df[\"high\"] - df[\"low\"]) &gt; (4 * (df[\"open\"] - df[\"close\"])))\n        &amp; (((df[\"close\"] - df[\"low\"]) \/ (0.001 + df[\"high\"] - df[\"low\"])) &gt;= 0.75)\n        &amp; (((df[\"open\"] - df[\"low\"]) \/ (0.001 + df[\"high\"] - df[\"low\"])) &gt;= 0.75)\n        &amp; (df[\"high\"].shift(1) &lt; df[\"open\"])\n        &amp; (df[\"high\"].shift(2) &lt; df[\"open\"])\n    )\n\n\ndef candle_three_white_soldiers(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"*** Candlestick Detected: Three White Soldiers (\"Strong - Reversal - Bullish Pattern - Up\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((df[\"open\"] &gt; df[\"open\"].shift(1)) &amp; (df[\"open\"] &lt; df[\"close\"].shift(1)))\n        &amp; (df[\"close\"] &gt; df[\"high\"].shift(1))\n        &amp; (df[\"high\"] - np.maximum(df[\"open\"], df[\"close\"]) &lt; (abs(df[\"open\"] - df[\"close\"])))\n        &amp; ((df[\"open\"].shift(1) &gt; df[\"open\"].shift(2)) &amp; (df[\"open\"].shift(1) &lt; df[\"close\"].shift(2)))\n        &amp; (df[\"close\"].shift(1) &gt; df[\"high\"].shift(2))\n        &amp; (\n            df[\"high\"].shift(1) - np.maximum(df[\"open\"].shift(1), df[\"close\"].shift(1))\n            &lt; (abs(df[\"open\"].shift(1) - df[\"close\"].shift(1)))\n        )\n    )\n\n\ndef candle_three_black_crows(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"* Candlestick Detected: Three Black Crows (\"Strong - Reversal - Bearish Pattern - Down\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((df[\"open\"] &lt; df[\"open\"].shift(1)) &amp; (df[\"open\"] &gt; df[\"close\"].shift(1)))\n        &amp; (df[\"close\"] &lt; df[\"low\"].shift(1))\n        &amp; (df[\"low\"] - np.maximum(df[\"open\"], df[\"close\"]) &lt; (abs(df[\"open\"] - df[\"close\"])))\n        &amp; ((df[\"open\"].shift(1) &lt; df[\"open\"].shift(2)) &amp; (df[\"open\"].shift(1) &gt; df[\"close\"].shift(2)))\n        &amp; (df[\"close\"].shift(1) &lt; df[\"low\"].shift(2))\n        &amp; (\n            df[\"low\"].shift(1) - np.maximum(df[\"open\"].shift(1), df[\"close\"].shift(1))\n            &lt; (abs(df[\"open\"].shift(1) - df[\"close\"].shift(1)))\n        )\n    )\n\n\ndef candle_doji(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"! Candlestick Detected: Doji (\"Indecision \/ Neutral\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((abs(df[\"close\"] - df[\"open\"]) \/ (df[\"high\"] - df[\"low\"])) &lt; 0.1)\n        &amp; ((df[\"high\"] - np.maximum(df[\"close\"], df[\"open\"])) &gt; (3 * abs(df[\"close\"] - df[\"open\"])))\n        &amp; ((np.minimum(df[\"close\"], df[\"open\"]) - df[\"low\"]) &gt; (3 * abs(df[\"close\"] - df[\"open\"])))\n    )\n\n\ndef candle_three_line_strike(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"** Candlestick Detected: Three Line Strike (\"Reliable - Reversal - Bullish Pattern - Up\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((df[\"open\"].shift(1) &lt; df[\"open\"].shift(2)) &amp; (df[\"open\"].shift(1) &gt; df[\"close\"].shift(2)))\n        &amp; (df[\"close\"].shift(1) &lt; df[\"low\"].shift(2))\n        &amp; (\n            df[\"low\"].shift(1) - np.maximum(df[\"open\"].shift(1), df[\"close\"].shift(1))\n            &lt; (abs(df[\"open\"].shift(1) - df[\"close\"].shift(1)))\n        )\n        &amp; ((df[\"open\"].shift(2) &lt; df[\"open\"].shift(3)) &amp; (df[\"open\"].shift(2) &gt; df[\"close\"].shift(3)))\n        &amp; (df[\"close\"].shift(2) &lt; df[\"low\"].shift(3))\n        &amp; (\n            df[\"low\"].shift(2) - np.maximum(df[\"open\"].shift(2), df[\"close\"].shift(2))\n            &lt; (abs(df[\"open\"].shift(2) - df[\"close\"].shift(2)))\n        )\n        &amp; ((df[\"open\"] &lt; df[\"low\"].shift(1)) &amp; (df[\"close\"] &gt; df[\"high\"].shift(3)))\n    )\n\n\ndef candle_two_black_gapping(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"*** Candlestick Detected: Two Black Gapping (\"Reliable - Reversal - Bearish Pattern - Down\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        ((df[\"open\"] &lt; df[\"open\"].shift(1)) &amp; (df[\"open\"] &gt; df[\"close\"].shift(1)))\n        &amp; (df[\"close\"] &lt; df[\"low\"].shift(1))\n        &amp; (df[\"low\"] - np.maximum(df[\"open\"], df[\"close\"]) &lt; (abs(df[\"open\"] - df[\"close\"])))\n        &amp; (df[\"high\"].shift(1) &lt; df[\"low\"].shift(2))\n    )\n\n\ndef candle_morning_star(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"*** Candlestick Detected: Morning Star (\"Strong - Reversal - Bullish Pattern - Up\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        (np.maximum(df[\"open\"].shift(1), df[\"close\"].shift(1)) &lt; df[\"close\"].shift(2)) &amp; (df[\"close\"].shift(2) &lt; df[\"open\"].shift(2))\n    ) &amp; ((df[\"close\"] &gt; df[\"open\"]) &amp; (df[\"open\"] &gt; np.maximum(df[\"open\"].shift(1), df[\"close\"].shift(1))))\n\n\ndef candle_evening_star(df: pd.DataFrame = None) -&gt; np.ndarray:\n    \"\"\"*** Candlestick Detected: Evening Star (\"Strong - Reversal - Bearish Pattern - Down\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        (np.minimum(df[\"open\"].shift(1), df[\"close\"].shift(1)) &gt; df[\"close\"].shift(2)) &amp; (df[\"close\"].shift(2) &gt; df[\"open\"].shift(2))\n    ) &amp; ((df[\"close\"] &lt; df[\"open\"]) &amp; (df[\"open\"] &lt; np.minimum(df[\"open\"].shift(1), df[\"close\"].shift(1))))\n\n\ndef candle_abandoned_baby(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"** Candlestick Detected: Abandoned Baby (\"Reliable - Reversal - Bullish Pattern - Up\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (\n        (df[\"open\"] &lt; df[\"close\"])\n        &amp; (df[\"high\"].shift(1) &lt; df[\"low\"])\n        &amp; (df[\"open\"].shift(2) &gt; df[\"close\"].shift(2))\n        &amp; (df[\"high\"].shift(1) &lt; df[\"low\"].shift(2))\n    )\n\n\ndef candle_morning_doji_star(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"** Candlestick Detected: Morning Doji Star (\"Reliable - Reversal - Bullish Pattern - Up\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (df[\"close\"].shift(2) &lt; df[\"open\"].shift(2)) &amp; (\n        abs(df[\"close\"].shift(2) - df[\"open\"].shift(2)) \/ (df[\"high\"].shift(2) - df[\"low\"].shift(2)) &gt;= 0.7\n    ) &amp; (abs(df[\"close\"].shift(1) - df[\"open\"].shift(1)) \/ (df[\"high\"].shift(1) - df[\"low\"].shift(1)) &lt; 0.1) &amp; (\n        df[\"close\"] &gt; df[\"open\"]\n    ) &amp; (\n        abs(df[\"close\"] - df[\"open\"]) \/ (df[\"high\"] - df[\"low\"]) &gt;= 0.7\n    ) &amp; (\n        df[\"close\"].shift(2) &gt; df[\"close\"].shift(1)\n    ) &amp; (\n        df[\"close\"].shift(2) &gt; df[\"open\"].shift(1)\n    ) &amp; (\n        df[\"close\"].shift(1) &lt; df[\"open\"]\n    ) &amp; (\n        df[\"open\"].shift(1) &lt; df[\"open\"]\n    ) &amp; (\n        df[\"close\"] &gt; df[\"close\"].shift(2)\n    ) &amp; (\n        (df[\"high\"].shift(1) - np.maximum(df[\"close\"].shift(1), df[\"open\"].shift(1)))\n        &gt; (3 * abs(df[\"close\"].shift(1) - df[\"open\"].shift(1)))\n    ) &amp; (\n        np.minimum(df[\"close\"].shift(1), df[\"open\"].shift(1)) - df[\"low\"].shift(1)\n    ) &gt; (\n        3 * abs(df[\"close\"].shift(1) - df[\"open\"].shift(1))\n    )\n\n\ndef candle_evening_doji_star(df: pd.DataFrame = None) -&gt; pd.Series:\n    \"\"\"** Candlestick Detected: Evening Doji Star (\"Reliable - Reversal - Bearish Pattern - Down\")\"\"\"\n\n    # Fill NaN values with 0\n    df = df.fillna(0)\n\n    return (df[\"close\"].shift(2) &gt; df[\"open\"].shift(2)) &amp; (\n        abs(df[\"close\"].shift(2) - df[\"open\"].shift(2)) \/ (df[\"high\"].shift(2) - df[\"low\"].shift(2)) &gt;= 0.7\n    ) &amp; (abs(df[\"close\"].shift(1) - df[\"open\"].shift(1)) \/ (df[\"high\"].shift(1) - df[\"low\"].shift(1)) &lt; 0.1) &amp; (\n        df[\"close\"] &lt; df[\"open\"]\n    ) &amp; (\n        abs(df[\"close\"] - df[\"open\"]) \/ (df[\"high\"] - df[\"low\"]) &gt;= 0.7\n    ) &amp; (\n        df[\"close\"].shift(2) &lt; df[\"close\"].shift(1)\n    ) &amp; (\n        df[\"close\"].shift(2) &lt; df[\"open\"].shift(1)\n    ) &amp; (\n        df[\"close\"].shift(1) &gt; df[\"open\"]\n    ) &amp; (\n        df[\"open\"].shift(1) &gt; df[\"open\"]\n    ) &amp; (\n        df[\"close\"] &lt; df[\"close\"].shift(2)\n    ) &amp; (\n        (df[\"high\"].shift(1) - np.maximum(df[\"close\"].shift(1), df[\"open\"].shift(1)))\n        &gt; (3 * abs(df[\"close\"].shift(1) - df[\"open\"].shift(1)))\n    ) &amp; (\n        np.minimum(df[\"close\"].shift(1), df[\"open\"].shift(1)) - df[\"low\"].shift(1)\n    ) &gt; (\n        3 * abs(df[\"close\"].shift(1) - df[\"open\"].shift(1))\n    )<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>Let&#8217;s see if we can find any of the <strong>Strong<\/strong> patterns in our dataset&#8230;<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-e033f3276972e6c499daddf6c066069b\"><code lang=\"python\" class=\"language-python\">if __name__ == \"__main__\":\n    df = get_ohlc_data()\n\n    df[\"three_white_soldiers\"] = candle_three_white_soldiers(df)\n    df[\"three_black_crows\"] = candle_three_black_crows(df)\n    df[\"morning_star\"] = candle_morning_star(df)\n    df[\"evening_star\"] = candle_evening_star(df)\n\n    print(df[(df[\"three_white_soldiers\"] == True) | (df[\"three_black_crows\"] == True) | (df[\"morning_star\"] == True) | (df[\"evening_star\"] == True)])<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2780\" height=\"534\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/US500-strong-candles.png\" alt=\"\" class=\"wp-image-4955\"\/><\/figure>\n\n\n\n<p>It looks like the <strong>Strong<\/strong> patterns have been detected several times over the last 30 days. Based on the data above you can see when a candlestick pattern was detected, and what it was. A challenge for yourself would be to look at an S&amp;P 500 hourly graph at those time intervals and see if you can spot them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n\n\n\n<p>It\u2019s important to remember, however, that no single strategy guarantees success in the markets. The effectiveness of candlestick pattern strategies, like all trading strategies, can be influenced by market conditions, liquidity, and volatility. Therefore, traders should consider these strategies as part of a broader, diversified trading approach, complementing them with other analysis and tools.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to discuss this topic of Practical Guide to Automated Detection Trading Patterns with Python, we need to introduce the basics first. I&#8217;m sure everyone is familiar with what a trading graph looks like, often represented with green and red bars forming a line graph. There is a lot of data and information condensed [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":4959,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1,59],"tags":[],"coding-language":[30],"ready-to-go-solution":[56],"qualification":[31],"financial-apis-category":[36],"financial-apis-manuals":[40],"class_list":["post-4941","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fundamental-analysis-examples","category-technical-analysis-examples","coding-language-python","ready-to-go-solution-eodhd-python-financial-library","qualification-experienced","financial-apis-category-stock-market-prices","financial-apis-manuals-technical-indicators","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.9 (Yoast SEO v26.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Practical Guide to Automated Detection Trading Patterns with Python | EODHD APIs Academy<\/title>\n<meta name=\"description\" content=\"Discover the basics of automated detection trading patterns in Python. Understand the OHLC data, and what candle graph can show us about the relationship between Open and Close. Get insight of candles from the image example\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Practical Guide to Automated Detection Trading Patterns with Python\" \/>\n<meta property=\"og:description\" content=\"Discover the basics of automated detection trading patterns in Python. Understand the OHLC data, and what candle graph can show us about the relationship between Open and Close. Get insight of candles from the image example\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python\" \/>\n<meta property=\"og:site_name\" content=\"Financial Academy\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/eodhistoricaldata\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-11T12:00:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-05T13:33:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"980\" \/>\n\t<meta property=\"og:image:height\" content=\"653\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Whittle\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@EOD_data\" \/>\n<meta name=\"twitter:site\" content=\"@EOD_data\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Whittle\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#article\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python\"},\"author\":{\"name\":\"Michael Whittle\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad\"},\"headline\":\"Practical Guide to Automated Detection Trading Patterns with Python\",\"datePublished\":\"2024-02-11T12:00:55+00:00\",\"dateModified\":\"2025-02-05T13:33:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python\"},\"wordCount\":763,\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg\",\"articleSection\":[\"Fundamental Analysis Examples\",\"Technical Analysis Examples\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python\",\"name\":\"Practical Guide to Automated Detection Trading Patterns with Python | EODHD APIs Academy\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg\",\"datePublished\":\"2024-02-11T12:00:55+00:00\",\"dateModified\":\"2025-02-05T13:33:06+00:00\",\"description\":\"Discover the basics of automated detection trading patterns in Python. Understand the OHLC data, and what candle graph can show us about the relationship between Open and Close. Get insight of candles from the image example\",\"breadcrumb\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#primaryimage\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg\",\"contentUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg\",\"width\":4608,\"height\":3072},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eodhd.com\/financial-academy\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Practical Guide to Automated Detection Trading Patterns with Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/\",\"name\":\"Financial APIs Academy | EODHD\",\"description\":\"Financial Stock Market Academy\",\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eodhd.com\/financial-academy\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\",\"name\":\"EODHD (EOD Historical Data)\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png\",\"contentUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png\",\"width\":159,\"height\":82,\"caption\":\"EODHD (EOD Historical Data)\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/eodhistoricaldata\",\"https:\/\/x.com\/EOD_data\",\"https:\/\/www.reddit.com\/r\/EODHistoricalData\/\",\"https:\/\/eod-historical-data.medium.com\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad\",\"name\":\"Michael Whittle\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5076af85c7ee0445454257247cad4970ae8cf5d7d4940d2b32c521f51c0a0f5a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5076af85c7ee0445454257247cad4970ae8cf5d7d4940d2b32c521f51c0a0f5a?s=96&d=mm&r=g\",\"caption\":\"Michael Whittle\"},\"description\":\"Solution architect, developer, and analyst with over 20+ years experience (TOP author on Medium).\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/author\/michaelwhittle\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Practical Guide to Automated Detection Trading Patterns with Python | EODHD APIs Academy","description":"Discover the basics of automated detection trading patterns in Python. Understand the OHLC data, and what candle graph can show us about the relationship between Open and Close. Get insight of candles from the image example","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python","og_locale":"en_US","og_type":"article","og_title":"Practical Guide to Automated Detection Trading Patterns with Python","og_description":"Discover the basics of automated detection trading patterns in Python. Understand the OHLC data, and what candle graph can show us about the relationship between Open and Close. Get insight of candles from the image example","og_url":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python","og_site_name":"Financial Academy","article_publisher":"https:\/\/www.facebook.com\/eodhistoricaldata","article_published_time":"2024-02-11T12:00:55+00:00","article_modified_time":"2025-02-05T13:33:06+00:00","og_image":[{"url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg","width":980,"height":653,"type":"image\/jpeg"}],"author":"Michael Whittle","twitter_card":"summary_large_image","twitter_creator":"@EOD_data","twitter_site":"@EOD_data","twitter_misc":{"Written by":"Michael Whittle","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#article","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python"},"author":{"name":"Michael Whittle","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad"},"headline":"Practical Guide to Automated Detection Trading Patterns with Python","datePublished":"2024-02-11T12:00:55+00:00","dateModified":"2025-02-05T13:33:06+00:00","mainEntityOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python"},"wordCount":763,"publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg","articleSection":["Fundamental Analysis Examples","Technical Analysis Examples"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python","url":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python","name":"Practical Guide to Automated Detection Trading Patterns with Python | EODHD APIs Academy","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#primaryimage"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg","datePublished":"2024-02-11T12:00:55+00:00","dateModified":"2025-02-05T13:33:06+00:00","description":"Discover the basics of automated detection trading patterns in Python. Understand the OHLC data, and what candle graph can show us about the relationship between Open and Close. Get insight of candles from the image example","breadcrumb":{"@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#primaryimage","url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg","contentUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg","width":4608,"height":3072},{"@type":"BreadcrumbList","@id":"https:\/\/eodhd.com\/financial-academy\/technical-analysis-examples\/practical-guide-to-automated-detection-trading-patterns-with-python#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eodhd.com\/financial-academy\/"},{"@type":"ListItem","position":2,"name":"Practical Guide to Automated Detection Trading Patterns with Python"}]},{"@type":"WebSite","@id":"https:\/\/eodhd.com\/financial-academy\/#website","url":"https:\/\/eodhd.com\/financial-academy\/","name":"Financial APIs Academy | EODHD","description":"Financial Stock Market Academy","publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eodhd.com\/financial-academy\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/eodhd.com\/financial-academy\/#organization","name":"EODHD (EOD Historical Data)","url":"https:\/\/eodhd.com\/financial-academy\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/","url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png","contentUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png","width":159,"height":82,"caption":"EODHD (EOD Historical Data)"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/eodhistoricaldata","https:\/\/x.com\/EOD_data","https:\/\/www.reddit.com\/r\/EODHistoricalData\/","https:\/\/eod-historical-data.medium.com\/"]},{"@type":"Person","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad","name":"Michael Whittle","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5076af85c7ee0445454257247cad4970ae8cf5d7d4940d2b32c521f51c0a0f5a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5076af85c7ee0445454257247cad4970ae8cf5d7d4940d2b32c521f51c0a0f5a?s=96&d=mm&r=g","caption":"Michael Whittle"},"description":"Solution architect, developer, and analyst with over 20+ years experience (TOP author on Medium).","url":"https:\/\/eodhd.com\/financial-academy\/author\/michaelwhittle"}]}},"jetpack_featured_media_url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/02\/AdobeStock_577669371.jpeg","jetpack_shortlink":"https:\/\/wp.me\/pdOdVT-1hH","jetpack_sharing_enabled":true,"acf":[],"_links":{"self":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/4941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/comments?post=4941"}],"version-history":[{"count":15,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/4941\/revisions"}],"predecessor-version":[{"id":6289,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/4941\/revisions\/6289"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media\/4959"}],"wp:attachment":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media?parent=4941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/categories?post=4941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/tags?post=4941"},{"taxonomy":"coding-language","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/coding-language?post=4941"},{"taxonomy":"ready-to-go-solution","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/ready-to-go-solution?post=4941"},{"taxonomy":"qualification","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/qualification?post=4941"},{"taxonomy":"financial-apis-category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-category?post=4941"},{"taxonomy":"financial-apis-manuals","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-manuals?post=4941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}