{"id":216871,"date":"2024-12-31T11:35:18","date_gmt":"2024-12-31T16:35:18","guid":{"rendered":"https:\/\/ibkrcampus.com\/campus\/?p=216871"},"modified":"2025-01-03T15:57:16","modified_gmt":"2025-01-03T20:57:16","slug":"gap-trading-strategy-based-on-the-markov-rule-epat-project","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/","title":{"rendered":"Gap Trading Strategy: Based on the Markov Rule | EPAT Project"},"content":{"rendered":"\n<p><em>The post &#8220;Gap Trading Strategy: Based on the Markov Rule | EPAT Project&#8221; first appeared on <a href=\"https:\/\/blog.quantinsti.com\/epat-project-gap-trading-strategy-based-on-the-markov-rule\/\">QuantInsti<\/a> blog.<\/em><\/p>\n\n\n\n<p>The trading strategy focuses on gap trading in Indian equities, specifically targeting stocks with lower volatility and avoiding high-volatility market conditions. This long-only approach involves entering positions at the day\u2019s close and exiting at the next day&#8217;s open. As Indian markets mature and more stocks become eligible for trading, the strategy\u2019s performance improves over time, yielding better results and a higher Sharpe ratio. Gap trading offers greater predictability and significantly reduces volatility, making it a reliable and effective approach for consistent returns.<\/p>\n\n\n\n<p>This article is the final project submitted by the author as a part of his coursework in the Executive Programme in Algorithmic Trading (<a href=\"https:\/\/www.quantinsti.com\/epat\">EPAT<\/a>) at QuantInsti. Do check our&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/tag\/epat-trading-projects\/\">Projects page<\/a>&nbsp;and have a look at what our students are building.<\/p>\n\n\n\n<p>Other EPAT Project publications on Gap Trading Strategy and Markov Rule are listed below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/blog.quantinsti.com\/market-regime-detection-hidden-markov-model-project-fahim\/\">Market Regime Detection with Hidden Markov Model<\/a>&nbsp;[EPAT PROJECT] &nbsp;(Year: 2020)<\/li>\n<\/ul>\n\n\n\n<p><strong>About the Author<\/strong><\/p>\n\n\n\n<p>My name is Hetansh Gosar, a 23-year-old from Ahmedabad. I hold a Bachelor&#8217;s degree in Business<br><br>Administration and have successfully completed all three levels of the Chartered Market Technician (CMT) program. I will be eligible for the CMT charter upon completing three years of industry experience. For the past two years, I have been working as a Technical Researcher, gaining valuable expertise in market analysis and trading strategies.<\/p>\n\n\n\n<p>EPAT batch: #61<br>Certification status: Certification of Excellence<br>Mentor:&nbsp;<a href=\"https:\/\/www.linkedin.com\/in\/rekhit\/\">Rekhit Pachanekar<\/a><br><br>Connect with me: www.linkedin.com\/in\/hetansh-gosar<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"225\" height=\"300\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/12\/Hetansh-EPAT-1.jpg\" alt=\"\" class=\"wp-image-216956 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 225px; aspect-ratio: 225\/300;\" \/><\/figure>\n\n\n\n<p>Hetansh Gosar, Author &#8211; Gap Trading Strategy: Based on the Markov Rule &#8211; EPAT Project<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"strategy-idea\">Strategy Idea<\/h2>\n\n\n\n<p>The idea is to enter the market when the conditions are satisfied:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>If today\u2019s candlestick body is greater than yesterday\u2019s candlestick body (this is to indicate an increase in momentum).<\/li>\n\n\n\n<li>If today\u2019s close is greater than the open (this is to indicate a positive momentum).<\/li>\n\n\n\n<li>Today\u2019s percentage change should be less than 2%(in order to avoid trades during extreme volatility such as the Great Recession or COVID-19).<br>If these three conditions are satisfied then we enter on today\u2019s closing and exit on the next day\u2019s opening. The graph shows the parameters of when to take a trade.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"691\" height=\"522\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/12\/Gap-Trading-Strategy.png\" alt=\"\" class=\"wp-image-216876 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/12\/Gap-Trading-Strategy.png 691w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/12\/Gap-Trading-Strategy-300x227.png 300w\" data-sizes=\"(max-width: 691px) 100vw, 691px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 691px; aspect-ratio: 691\/522;\" \/><\/figure>\n\n\n\n<p>Parameters of when to take a trade<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"motivation\">Motivation<\/h2>\n\n\n\n<p>The motivation for the strategy comes from the idea that a strong momentum that persisted during the day would continue even when the markets were closed and not being traded. Hence there would be a gap in the opening of the next day. We would like to capture that gap by entering right before the close and exiting on the open. We use long trades only as in case of up moves, there is predictive power of the previous day, while not the same with down moves. &nbsp;<\/p>\n\n\n\n<p>As there is no certainty of continuation in trend in case of down moves, there might be a change of sentiment and we won&#8217;t be able to capture the gap. We use the true range of candles as the true range can show us what the intrinsic strength of the day was.<\/p>\n\n\n\n<p>When there is an increase in the size, we can determine that the momentum has increased for the day which would mean a strong enough momentum. When there is too much volatility in markets, such as during the crash of COVID-19 or the great recession, the predictive power of the previous day is lost and there is a lot of unnecessary movement in the market.<\/p>\n\n\n\n<p>To avoid that, we do not take trades that are greater than 2% in closing as that would be a lot of volatility, and also with such great returns on the day of entry, there are chances of a bit of retracement on the next day. By using just gaps to trade, we do not get a lot of returns and a lot of returns, but we get more stable returns. We can use leverage to magnify the returns, and we aimed to have a better-adjusted hit ratio, so we could have a smoother equity graph.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-project-abstract\">Project Abstract<\/h2>\n\n\n\n<p>The strategy is designed in a way that targets the trade gap. It generates an entry on closing and the exit is at the next open. This strategy best works for low-volatility stocks (equities with less ATR\/price ratio) in Indian markets.<\/p>\n\n\n\n<p>The findings suggest that there was a decent profit with less volatility, theoretically, in backtesting.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-dataset\">Dataset<\/h2>\n\n\n\n<p>We use nifty daily data as our trading dataset.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"data-mining\">Data Mining<\/h2>\n\n\n\n<p>The data we are using is of the stock itself and nifty data along with it. The strategy requires stock data for entering at close price, exiting at open price, and high, low and close data for ATR. While nifty data is required for its ATR since we have used a filter in which if the market is extremely volatile, we stay cash and do not trade.<\/p>\n\n\n\n<p>The data is downloaded from yfinance, which is a part of the code of the testing strategy itself. So, when the function of the backtesting strategy is run, both the data (nifty and stock) will be downloaded and then the backtesting will take place.<\/p>\n\n\n\n<p>After the backtesting is done, there is a different set of code which is of pyfolio, run to have results.<\/p>\n\n\n\n<p>The coding is done in Python completely.<\/p>\n\n\n\n<p>The 10 stocks used to create a portfolio are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Bharti-airtel<\/li>\n\n\n\n<li>Coal India<\/li>\n\n\n\n<li>Colpal<\/li>\n\n\n\n<li>LT<\/li>\n\n\n\n<li>M&amp;M<\/li>\n\n\n\n<li>Reliance<\/li>\n\n\n\n<li>SBI<\/li>\n\n\n\n<li>Solaris Inds<\/li>\n\n\n\n<li>Trent<\/li>\n\n\n\n<li>Zydus Lifescience<\/li>\n<\/ul>\n\n\n\n<p>The testing was done over a period of 10 years, from 2014-1-1 to 2024-1-1. It doesn\u2019t make sense to test before a certain number of years, since the markets were very volatile back then, but had eventually become less volatile. As our markets are maturing, there are more and more stocks becoming less volatile and they would then be tradable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"data-analysis\">Data Analysis<\/h2>\n\n\n\n<p>What we found out is that usually stocks gave a decent return, usually greater than 15% CAGR, with around a max drawdown of 10 to 15 per cent.<\/p>\n\n\n\n<p>If we create a portfolio of the ten stocks mentioned above, the CAGR comes out to be around 24.9%, cumulative returns 771.6%, annual volatility around 4.1%, and max drawdown around 2.4%.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"key-findings\">Key Findings<\/h2>\n\n\n\n<p>The strategy works well when the markets are in a low volatility phase. The stocks should be in general low volatile and not necessarily up trending. This strategy works best in a portfolio, as there is not much systematic risk and more unsystematic risk, so when trading a whole portfolio, the risk-adjusted returns are pretty strong. The theoretical sharp ratio is coming out to be more than 5, which is because of extremely low volatility, but it needs to be tested in live markets as there are a few limitations of the strategy as well.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"challenges-limitations\">Challenges\/Limitations<\/h2>\n\n\n\n<p>One of the greatest challenges is to get the open price, as the strategy is tested on past data, we have a clear opening price, but we need to capture the opening price in order to get the exact same results.<\/p>\n\n\n\n<p>The transaction costs are not included in the backtest results, which could be pretty high as we enter and exit trades on an everyday basis.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>The strategy theoretically works well. It has good enough returns for the amount of risk we take. The limitations might be crucial and should be considered as they may skew the results drastically. But if there is not much change in returns, and because of the low volatility, we might still be able to get a decently or well-performing strategy after application. A benefit of this strategy is that it is applied to equity, so we do not face challenges of derivatives, and as time goes by, and markets mature, the pool of stocks for us to choose from increases, so we can deploy more capital in it with less impact cost.<\/p>\n\n\n\n<p>This strategy might be good for someone looking for a moderate return with less risk. For someone willing to risk more and bear the expense of interest, getting leverage is an option. The strategy has stable returns especially in portfolio format so taking leverage should not be that difficult. With the CAGR of the portfolio being around 25%, it did beat the index well, also with much lesser volatility. It does not affect much if the markets are not bullish, it might create some volatility in our portfolio returns but might not face huge drawdowns.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"annexure\">Annexure<\/h2>\n\n\n\n<p>The following is the code used to generate the strategy function used to create a \u201cpandas\u201d dataframe with strategy returns in it:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def strategy(stock,start_date,end_date):\n\n# Downloading data\n\ndf1 = yf.download(stock, start = start_date, end = end_date, auto_adjust = True)\n\ndata = yf.download('^NSEI', start = start_date, end = end_date)\n\n# Creating ATR and volatility filter on nifty\n\ndata['atr'] = ta.ATR(data['High'], data['Low'], data['Close'], 5)\n\ndata['atr_perc'] = data['atr']\/data['Close']\n\n# Merging data of nifty and stock\n\ndf = df1.merge(data[['atr_perc']], left_index=True, right_index=True, how='left')\n\n# Creating returns\n\ndf['returns'] = np.log(df['Close']\/df['Close'].shift())\n\n# Creating true range\n\ndf['true_range'] = np.maximum.reduce([df['High']-df['Low'],\n\ndf['High']-df['Close'].shift(),\n\ndf['Close'].shift()-df['Low']])\n\n# Creating conditions of entry\n\ndf['condition'] = np.where( (df['true_range'] > df['true_range'].shift()) &amp;\n\n(df['returns'] &lt; 0.02) &amp;\n\n(df['returns'] > -0.02), 1, 0)\n\n# Creating signal with the help of condition\n\ndf['signal'] = np.nan\n\ndf['signal'] = np.where((df['condition'] == 1) &amp; (df['returns'] > 0), 1,\n\nnp.where((df['condition'] == 1) &amp; (df['returns'] &lt; 0), 0, np.nan))\n\ndf['signal'] = df['signal'].ffill()\n\n# A filter for avoiding volatile periods\n\ndf['signal'] = np.where(df['atr_perc'].shift() > 0.03, 0, df['signal'])\n\n# Calculating the returns on trading the gap\n\ndf['o_c_returns'] = np.log(df['Open']\/df['Close'].shift())\n\n# getting returns\n\ndf['strategy_returns'] = df['signal'].shift() * df['o_c_returns']\n\ndf['cum_strategy_returns'] = df['strategy_returns'].cumsum()\n\ndf['b&amp;h_returns'] = df['returns'].cumsum()\n\nreturn df<\/pre>\n\n\n\n<p><em>Visit <a href=\"https:\/\/blog.quantinsti.com\/epat-project-gap-trading-strategy-based-on-the-markov-rule\/\">QuantInsti<\/a> blog to download the Python codes for implementing the strategy.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The trading strategy focuses on gap trading in Indian equities, specifically targeting stocks with lower volatility and avoiding high-volatility market conditions. <\/p>\n","protected":false},"author":1561,"featured_media":182425,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[343,349,338,341],"tags":[851,18216,18217,1224,595],"contributors-categories":[13654],"class_list":{"0":"post-216871","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-programing-languages","8":"category-python-development","9":"category-ibkr-quant-news","10":"category-quant-development","11":"tag-algo-trading","12":"tag-gap-trading-strategy","13":"tag-markov-rule","14":"tag-pandas","15":"tag-python","16":"contributors-categories-quantinsti"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Gap Trading Strategy: Based on the Markov Rule | EPAT Project<\/title>\n<meta name=\"description\" content=\"The trading strategy focuses on gap trading in Indian equities, specifically targeting stocks with lower volatility and avoiding high-volatility market...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/216871\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Gap Trading Strategy: Based on the Markov Rule | EPAT Project\" \/>\n<meta property=\"og:description\" content=\"The trading strategy focuses on gap trading in Indian equities, specifically targeting stocks with lower volatility and avoiding high-volatility market conditions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-31T16:35:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-03T20:57:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/02\/python-blue-button.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Hetansh Gosar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hetansh Gosar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Hetansh Gosar\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/6e72302edc8de8ec88183eb797f3e1be\"\n\t            },\n\t            \"headline\": \"Gap Trading Strategy: Based on the Markov Rule | EPAT Project\",\n\t            \"datePublished\": \"2024-12-31T16:35:18+00:00\",\n\t            \"dateModified\": \"2025-01-03T20:57:16+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/\"\n\t            },\n\t            \"wordCount\": 1454,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/02\\\/python-blue-button.jpg\",\n\t            \"keywords\": [\n\t                \"Algo Trading\",\n\t                \"Gap Trading Strategy\",\n\t                \"Markov Rule\",\n\t                \"Pandas\",\n\t                \"Python\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/\",\n\t            \"name\": \"Gap Trading Strategy: Based on the Markov Rule | EPAT Project | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/02\\\/python-blue-button.jpg\",\n\t            \"datePublished\": \"2024-12-31T16:35:18+00:00\",\n\t            \"dateModified\": \"2025-01-03T20:57:16+00:00\",\n\t            \"description\": \"The trading strategy focuses on gap trading in Indian equities, specifically targeting stocks with lower volatility and avoiding high-volatility market conditions.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/gap-trading-strategy-based-on-the-markov-rule-epat-project\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/02\\\/python-blue-button.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/02\\\/python-blue-button.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Sklearn \u2013 An Introduction Guide to Machine Learning\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/6e72302edc8de8ec88183eb797f3e1be\",\n\t            \"name\": \"Hetansh Gosar\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/hetanshgosar\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Gap Trading Strategy: Based on the Markov Rule | EPAT Project","description":"The trading strategy focuses on gap trading in Indian equities, specifically targeting stocks with lower volatility and avoiding high-volatility market...","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:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/216871\/","og_locale":"en_US","og_type":"article","og_title":"Gap Trading Strategy: Based on the Markov Rule | EPAT Project","og_description":"The trading strategy focuses on gap trading in Indian equities, specifically targeting stocks with lower volatility and avoiding high-volatility market conditions.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/","og_site_name":"IBKR Campus US","article_published_time":"2024-12-31T16:35:18+00:00","article_modified_time":"2025-01-03T20:57:16+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/02\/python-blue-button.jpg","type":"image\/jpeg"}],"author":"Hetansh Gosar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Hetansh Gosar","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/"},"author":{"name":"Hetansh Gosar","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/6e72302edc8de8ec88183eb797f3e1be"},"headline":"Gap Trading Strategy: Based on the Markov Rule | EPAT Project","datePublished":"2024-12-31T16:35:18+00:00","dateModified":"2025-01-03T20:57:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/"},"wordCount":1454,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/02\/python-blue-button.jpg","keywords":["Algo Trading","Gap Trading Strategy","Markov Rule","Pandas","Python"],"articleSection":["Programming Languages","Python Development","Quant","Quant Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/","name":"Gap Trading Strategy: Based on the Markov Rule | EPAT Project | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/02\/python-blue-button.jpg","datePublished":"2024-12-31T16:35:18+00:00","dateModified":"2025-01-03T20:57:16+00:00","description":"The trading strategy focuses on gap trading in Indian equities, specifically targeting stocks with lower volatility and avoiding high-volatility market conditions.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/gap-trading-strategy-based-on-the-markov-rule-epat-project\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/02\/python-blue-button.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/02\/python-blue-button.jpg","width":1000,"height":563,"caption":"Sklearn \u2013 An Introduction Guide to Machine Learning"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/6e72302edc8de8ec88183eb797f3e1be","name":"Hetansh Gosar","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/hetanshgosar\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/02\/python-blue-button.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/216871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/1561"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=216871"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/216871\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/182425"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=216871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=216871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=216871"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=216871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}