{"id":186896,"date":"2023-03-17T10:37:01","date_gmt":"2023-03-17T14:37:01","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=186896"},"modified":"2023-03-17T10:37:24","modified_gmt":"2023-03-17T14:37:24","slug":"backtesting-how-to-backtest-analysis-strategy-and-more","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/","title":{"rendered":"Backtesting: How to Backtest, Analysis, Strategy, and More"},"content":{"rendered":"\n<p><em>Excerpt<\/em><\/p>\n\n\n\n<p>Backtesting is considered to be an important tool in a trader\u2019s toolbox. Without backtesting, traders wouldn\u2019t even think of risking money into the financial markets.<\/p>\n\n\n\n<p>Think about it, before you buy anything, be it a mobile phone or a car, you would want to check the history of the brand, its features etc. You check if it is worth your money. The same principle applies to trading, and backtesting helps you with it.<\/p>\n\n\n\n<p>We will cover the following topics in this article.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Why is backtesting important?<\/li>\n\n\n\n<li>What is backtesting?<\/li>\n\n\n\n<li>Prerequisites for backtesting<\/li>\n\n\n\n<li>How to do backtesting with Python?<\/li>\n\n\n\n<li>Analyzing the performance of the trading strategy<\/li>\n\n\n\n<li>Interpreting and analysing backtesting results<\/li>\n\n\n\n<li>Backtesting vs Walk forward trading testing<\/li>\n\n\n\n<li>Paper trading &amp; Live trading<\/li>\n\n\n\n<li>Common mistakes in backtesting<\/li>\n\n\n\n<li>Backtesting software<\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<p>Why is backtesting important?<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-is-backtesting-important\">Why is backtesting important?<\/h2>\n\n\n\n<p><em>Do you know the majority of the traders in the market lose money?<\/em><\/p>\n\n\n\n<p>They lose money not because they lack understanding of the market. But simply because their trading decisions are not based on sound research and tested trading methods.<\/p>\n\n\n\n<p>They make decisions based on emotions, suggestions from friends and take excessive risks in the hope to get rich quickly. If they remove emotions and instincts from the trading and backtest the ideas before trading, then the chance to trade profitability in the market is increased.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-backtesting\">What is backtesting?<\/h2>\n\n\n\n<p><em>Backtesting a trading strategy is the process of testing a trading hypothesis\/strategy on the historical data.<\/em><\/p>\n\n\n\n<p>Let\u2019s say you formed a hypothesis. This hypothsesis states that securities that have positive returns over the past one year are likely to give positive returns over the next one month.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>How would you test this hypothesis?<\/em><\/li>\n\n\n\n<li><em>How would you know whether the strategy will work in the market or not?<\/em><\/li>\n<\/ul>\n\n\n\n<p>By using historical data, you can backtest and see whether your hypothesis is true or not. It helps assess the feasibility of a trading strategy by discovering how it performs on the historical data.<\/p>\n\n\n\n<p>If you backtest your strategy on the historical data and it gives good returns, you will be confident to trade using it. If the strategy is performing poorly on the&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/course\/day-trading-strategies\" target=\"_blank\" rel=\"noreferrer noopener\">historical data<\/a>, you will discard or re-evaluate the hypothesis.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequisites-for-backtesting\">Prerequisites for backtesting<\/h2>\n\n\n\n<p>Before you start backtesting a trading strategy, you need to consider some of the factors:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Trading logic<\/li>\n\n\n\n<li>Market segment<\/li>\n\n\n\n<li>Data<\/li>\n\n\n\n<li>Programming language<\/li>\n<\/ul>\n\n\n\n<p>Let us look at each of these factors in detail.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"trading-logic-hypothesis-for-backtesting\">Trading logic\/hypothesis for backtesting<\/h3>\n\n\n\n<p>You decided to backtest a trading strategy, but before you backtest, you need to have a clear picture in your mind of what you are going to backtest. That is what is the trading logic or hypothesis of this backtest.<\/p>\n\n\n\n<p>In the above example, you calculate the past one year returns of securities and check whether the returns are positive or negative.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If positive, then you check for the future 1 month returns of the stocks.<\/li>\n\n\n\n<li>If negative, you will do nothing.<\/li>\n<\/ul>\n\n\n\n<p>If you are clear with the trading logic, then only you can backtest the trading strategy, and therefore this is the most crucial step in backtesting.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"choosing-the-right-market-or-asset-segment-for-backtesting\">Choosing the right market or asset segment for backtesting<\/h3>\n\n\n\n<p>There are various factors that you can look at to decide which market or assets will be best for the kind of trading you are looking to conduct.<\/p>\n\n\n\n<p>The factors can be risks you are willing to take, the profits you are looking to earn, and the time you will be investing, whether long-term or short-term.<\/p>\n\n\n\n<p>For example,&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/course\/crypto-trading-strategies-advanced\" target=\"_blank\" rel=\"noreferrer noopener\">trading in cryptocurrencies<\/a>&nbsp;might be riskier than other asset classes but can give higher returns and vice versa. Hence, it is a crucial decision to select the right market and asset class to trade-in.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"data-for-backtesting\">Data for backtesting<\/h3>\n\n\n\n<p>Once you have shortlisted the assets, you would want to backtest your trading strategy. The next step is to choose historical data of the asset. You can get the data from the data vendor or from your broker.<\/p>\n\n\n\n<p>It is important to select high-quality data, that is, data without any errors. If you choose poor quality data, then the output analysis from backtesting will be incorrect and misleading.<\/p>\n\n\n\n<p>You can check out this&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/course\/getting-market-data\" target=\"_blank\" rel=\"noreferrer noopener\">free course<\/a>&nbsp;on Quantra for getting the market data for different asset classes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"choosing-the-programming-language-for-backtesting\">Choosing the programming language for backtesting<\/h3>\n\n\n\n<p>You were clear with the trading logic, selected the right asset for the trading and got the required data of the asset.<\/p>\n\n\n\n<p>The final step is to decide the programming language which you will use to backtest a trading strategy. Actually, it is a matter of personal choice and the language you are comfortable with. Every programming language has its pros and cons.<\/p>\n\n\n\n<p><strong>Python &#8211;&nbsp;<\/strong><a href=\"https:\/\/blog.quantinsti.com\/python-trading\/\">Python<\/a><strong>&nbsp;<\/strong>is a free open-source and cross-platform language. It has a rich library for almost every task imaginable and a specialised research environment. It is more suitable for medium to low frequency trading that is trading on a time scale of minutes and above. However, Python is not suitable for high-frequency trading.<\/p>\n\n\n\n<p><strong>C++ &#8211;&nbsp;<\/strong>C++, on the other hand, is suitable for&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/high-frequency-trading\/\">high-frequency trading<\/a>. It has ultimate execution speed. It offers the most flexibility for managing memory and optimising execution speed but can lead to subtle bugs and is difficult to learn.<\/p>\n\n\n\n<p><strong>MATLAB &#8211;&nbsp;<\/strong>MATLAB is another programming language with multiple numerical libraries for scientific computation. It boasts high execution speed but is still less appealing to retail trades as it is quite expensive.<\/p>\n\n\n\n<p><strong>R &#8211;&nbsp;<\/strong>R is a dedicated statistics scripting environment that is free, open-source, cross-platform, and contains a wealth of freely available statistical packages for extremely advanced analysis but lacks execution speed unless operations are vectorised.<\/p>\n\n\n\n<p><strong>Note:&nbsp;<\/strong>It is important to note that if you are not comfortable with any programming languages for backtesting, that\u2019s not an issue. It doesn\u2019t hinder you from backtesting your trading strategy. You can also start with Microsoft Excel.<\/p>\n\n\n\n<p>For illustration, we will demonstrate how to backtest a trading strategy in Python in the next part of this article.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-do-backtesting-with-python\">How to do backtesting with Python?<\/h2>\n\n\n\n<p>To learn how to use Python for backtesting a trading strategy, check out this highly recommended video on&nbsp;<a href=\"https:\/\/youtu.be\/fvp4yfyedXE\" target=\"_blank\" rel=\"noreferrer noopener\">How to use Python for Trading and Investment<\/a>. It introduces you to the basics of Python programming from a&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/course\/financial-time-series-analysis-trading\" target=\"_blank\" rel=\"noreferrer noopener\">financial markets<\/a>\u2019 point of view.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-backtesting-trading-strategies\">Example of backtesting trading strategies<\/h3>\n\n\n\n<p>The strategy that we are going to backtest is based on the concept of moving average.&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/moving-average-trading-strategies\/\">Moving average<\/a>&nbsp;is the average of the specified data field such as the price for a given set of consecutive periods.<\/p>\n\n\n\n<p>As new data becomes available, the average of the data is computed by dropping the oldest&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/course\/Value-Strategy-Forex\" target=\"_blank\" rel=\"noreferrer noopener\">value<\/a>&nbsp;and adding the latest one.<em><br><\/em><br>The trading logic is very simple.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When the short-term moving average (50-day moving average) crosses above the long-term moving average (200-day crossover), we buy the security. This is also called a&nbsp;<strong>golden crossover<\/strong>.<\/li>\n\n\n\n<li>When the short-term moving average crosses below the long-term average, we sell. This is called the&nbsp;<strong>death cross<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p>We will follow the below steps to backtest the above trading strategy.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"69\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/moving-average-backtesting-flow-1-quantinsti.png\" alt=\"\" class=\"wp-image-186925 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/moving-average-backtesting-flow-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/moving-average-backtesting-flow-1-quantinsti-700x67.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/moving-average-backtesting-flow-1-quantinsti-300x29.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/69;\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"getting-the-price-data-for-backtesting\">Getting the price data for backtesting<\/h3>\n\n\n\n<p>We will do the backtesting on the Microsoft stock. To do that, you need to get the price data of Microsoft stock. We will use Yahoo! Finance to fetch the data.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import pandas as pd\nimport numpy as np\nimport yfinance as yf\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n\ndata = yf.download('MSFT', '2015-01-01')\ndata['Close'].plot(figsize=(10,7))\nplt.title('Microsoft Stock Close Price')\nplt.ylabel('Price')\nplt.show()<\/pre>\n\n\n\n<p><em>Script:<\/em> <a href=\"https:\/\/gist.github.com\/quantra-go-algo\/a18216a710644965fc1f6594086cd74c#file-libraries_moving_average-py\" target=\"_blank\" rel=\"noreferrer noopener\">libraries_moving_average.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"612\" height=\"415\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/microsoft-closing-price-quantinsti.png\" alt=\"\" class=\"wp-image-186930 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/microsoft-closing-price-quantinsti.png 612w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/microsoft-closing-price-quantinsti-300x203.png 300w\" data-sizes=\"(max-width: 612px) 100vw, 612px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 612px; aspect-ratio: 612\/415;\" \/><figcaption class=\"wp-element-caption\">Data: Yahoo! Finance<\/figcaption><\/figure>\n\n\n\n<p><em>Visit QuantInsti to read the full article: <a href=\"https:\/\/blog.quantinsti.com\/backtesting\/\">https:\/\/blog.quantinsti.com\/backtesting\/<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Backtesting is considered to be an important tool in a trader\u2019s toolbox.<\/p>\n","protected":false},"author":1123,"featured_media":151496,"comment_status":"closed","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,349,338,350,341,351,352,344,2197],"tags":[4873,854,5878,5110,5039,4659,1225,1224,12680,595,985,4580,14956,6674],"contributors-categories":[13654],"class_list":{"0":"post-186896","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-programing-languages","9":"category-python-development","10":"category-ibkr-quant-news","11":"category-quant-asia-pacific","12":"category-quant-development","13":"category-quant-europe","14":"category-quant-north-america","15":"category-quant-regions","16":"category-quant-south-america","17":"tag-backtesting","18":"tag-cplusplus","19":"tag-excel","20":"tag-historical-data","21":"tag-matlab","22":"tag-matplotlib","23":"tag-numpy","24":"tag-pandas","25":"tag-paper-trading","26":"tag-python","27":"tag-r-programming","28":"tag-seaborn","29":"tag-walk-forward-trading-testing","30":"tag-yfinance","31":"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.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Backtesting: How to Backtest, Analysis, Strategy, and More<\/title>\n<meta name=\"description\" content=\"Backtesting is considered to be an important tool in a trader\u2019s toolbox.\" \/>\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\/186896\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Backtesting: How to Backtest, Analysis, Strategy, and More | IBKR Campus US\" \/>\n<meta property=\"og:description\" content=\"Backtesting is considered to be an important tool in a trader\u2019s toolbox.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-17T14:37:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-17T14:37:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/python-featured.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=\"Vibhu Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vibhu Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 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\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Vibhu Singh\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/edeee3b4eb3856d273a6a99f06893d12\"\n\t            },\n\t            \"headline\": \"Backtesting: How to Backtest, Analysis, Strategy, and More\",\n\t            \"datePublished\": \"2023-03-17T14:37:01+00:00\",\n\t            \"dateModified\": \"2023-03-17T14:37:24+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/\"\n\t            },\n\t            \"wordCount\": 1262,\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\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/08\\\/python-featured.jpg\",\n\t            \"keywords\": [\n\t                \"backtesting\",\n\t                \"C++\",\n\t                \"Excel\",\n\t                \"historical data\",\n\t                \"MATLAB\",\n\t                \"Matplotlib\",\n\t                \"NumPy\",\n\t                \"Pandas\",\n\t                \"Paper Trading\",\n\t                \"Python\",\n\t                \"R Programming\",\n\t                \"Seaborn\",\n\t                \"Walk forward trading testing\",\n\t                \"yfinance\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Asia Pacific\",\n\t                \"Quant Development\",\n\t                \"Quant Europe\",\n\t                \"Quant North America\",\n\t                \"Quant Regions\",\n\t                \"Quant South America\"\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/\",\n\t            \"name\": \"Backtesting: How to Backtest, Analysis, Strategy, and More | 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\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/08\\\/python-featured.jpg\",\n\t            \"datePublished\": \"2023-03-17T14:37:01+00:00\",\n\t            \"dateModified\": \"2023-03-17T14:37:24+00:00\",\n\t            \"description\": \"Backtesting is considered to be an important tool in a trader\u2019s toolbox.\",\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\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/\"\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\\\/backtesting-how-to-backtest-analysis-strategy-and-more\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/08\\\/python-featured.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/08\\\/python-featured.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Python\"\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\\\/edeee3b4eb3856d273a6a99f06893d12\",\n\t            \"name\": \"Vibhu Singh\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/vibhu-singh\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Backtesting: How to Backtest, Analysis, Strategy, and More","description":"Backtesting is considered to be an important tool in a trader\u2019s toolbox.","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\/186896\/","og_locale":"en_US","og_type":"article","og_title":"Backtesting: How to Backtest, Analysis, Strategy, and More | IBKR Campus US","og_description":"Backtesting is considered to be an important tool in a trader\u2019s toolbox.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/","og_site_name":"IBKR Campus US","article_published_time":"2023-03-17T14:37:01+00:00","article_modified_time":"2023-03-17T14:37:24+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/python-featured.jpg","type":"image\/jpeg"}],"author":"Vibhu Singh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Vibhu Singh","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/"},"author":{"name":"Vibhu Singh","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/edeee3b4eb3856d273a6a99f06893d12"},"headline":"Backtesting: How to Backtest, Analysis, Strategy, and More","datePublished":"2023-03-17T14:37:01+00:00","dateModified":"2023-03-17T14:37:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/"},"wordCount":1262,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/python-featured.jpg","keywords":["backtesting","C++","Excel","historical data","MATLAB","Matplotlib","NumPy","Pandas","Paper Trading","Python","R Programming","Seaborn","Walk forward trading testing","yfinance"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Asia Pacific","Quant Development","Quant Europe","Quant North America","Quant Regions","Quant South America"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/","name":"Backtesting: How to Backtest, Analysis, Strategy, and More | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/python-featured.jpg","datePublished":"2023-03-17T14:37:01+00:00","dateModified":"2023-03-17T14:37:24+00:00","description":"Backtesting is considered to be an important tool in a trader\u2019s toolbox.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/backtesting-how-to-backtest-analysis-strategy-and-more\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/python-featured.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/python-featured.jpg","width":1000,"height":563,"caption":"Python"},{"@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\/edeee3b4eb3856d273a6a99f06893d12","name":"Vibhu Singh","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/vibhu-singh\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/python-featured.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/186896","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\/1123"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=186896"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/186896\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/151496"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=186896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=186896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=186896"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=186896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}