<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by mastermindankur on Medium]]></title>
        <description><![CDATA[Stories by mastermindankur on Medium]]></description>
        <link>https://medium.com/@mastermindankur?source=rss-e9e7481e5ee6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Ch5ezt_d9eAwXTgWxZyEyw.jpeg</url>
            <title>Stories by mastermindankur on Medium</title>
            <link>https://medium.com/@mastermindankur?source=rss-e9e7481e5ee6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 23:26:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mastermindankur/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Easiest Way to Lose Weight? Just Know What You’re Eating!]]></title>
            <link>https://medium.com/@mastermindankur/the-easiest-way-to-lose-weight-just-know-what-youre-eating-2c6b54e09425?source=rss-e9e7481e5ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c6b54e09425</guid>
            <category><![CDATA[nutrition]]></category>
            <category><![CDATA[foodtech]]></category>
            <category><![CDATA[healthy-lifestyle]]></category>
            <category><![CDATA[health]]></category>
            <category><![CDATA[food]]></category>
            <dc:creator><![CDATA[mastermindankur]]></dc:creator>
            <pubDate>Sun, 23 Feb 2025 08:21:39 GMT</pubDate>
            <atom:updated>2025-02-23T08:27:18.915Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Problem: No Simple Way to Tell If Your Food is Healthy</h3><p>Walk into any supermarket in India, and you’ll see endless choices — biscuits, chips, and so-called “healthy” drinks. But how do you know which ones are actually good for you? Unlike Europe, where <strong>Nutri-Score</strong> helps people quickly understand the nutritional value of food, India has no such system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3piGcFwgLpYYFIe0EmIqxA.png" /></figure><h3>What is Nutri-Score?</h3><p>Nutri-Score is a front-of-pack label that ranks food from <strong>A to E</strong> (green to red), based on how healthy it is. The score is calculated by looking at good ingredients (fiber, protein, fruits, vegetables) and unhealthy ones (sugar, salt, fats). This makes it easier for people to make informed food choices.</p><p>The score is calculated using a formula that assigns points based on the amount of beneficial and harmful nutrients in the product.</p><ul><li><strong>A (Green):</strong> Indicates the highest nutritional quality, rich in beneficial nutrients like fiber, protein, fruits, and vegetables while being low in sugar, salt, and unhealthy fats.</li><li><strong>B (Light Green):</strong> A good choice, though slightly less nutritionally balanced than an A-rated product.</li><li><strong>C (Yellow):</strong> Represents an intermediate nutritional quality with moderate levels of beneficial and less beneficial nutrients. Products rated <strong>C</strong> tend to be high in sugar, salt, or saturated fat, which, when consumed regularly, can contribute to diet-related diseases. (<a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9438084/">Source</a>)</li><li><strong>D (Orange):</strong> Indicates a lower nutritional quality, often high in sugar, salt, and unhealthy fats, making it a poor choice for regular consumption. A diet high in D-rated foods has been linked to increased risks of obesity, diabetes, and heart disease.</li><li><strong>E (Red):</strong> Represents the lowest nutritional quality, containing high levels of nutrients that should be limited in a balanced diet. Studies have shown that <strong>frequent consumption of E-rated foods is associated with a higher risk of cardiovascular diseases and metabolic disorders.</strong> (<a href="https://pubmed.ncbi.nlm.nih.gov/34487610/">Source</a>)</li></ul><h3>How Do Habits Change When You Know the Food Rating?</h3><p>When people are given clear information about how healthy their food is, their eating habits tend to improve. Here’s how a food rating system like Nutri-Score can influence your behavior:</p><ul><li><strong>More Informed Choices:</strong> When people see a clear A-to-E ranking, they are more likely to choose healthier options.</li><li><strong>Reduced Consumption of Junk Food:</strong> Studies in Europe have shown that products with a red or orange label (D or E) are often avoided in favor of those rated A or B.</li><li><strong>Encourages Food Companies to Improve Products:</strong> When consumers start choosing healthier options, brands are pressured to reformulate their products with better ingredients to achieve a higher Nutri-Score.</li><li><strong>Better Long-Term Health Outcomes:</strong> A clear food rating system helps reduce the risk of diet-related diseases like obesity, diabetes, and heart problems by making it easier to avoid unhealthy choices.</li><li><strong>Mindful Eating:</strong> When shoppers become aware of how their favorite foods rank, they start paying more attention to what they eat, leading to better dietary habits over time.</li></ul><h3>What Do Studies Say About Nutri-Score’s Impact?</h3><p>Several studies have shown that Nutri-Score has positively influenced user behaviour.</p><ul><li><strong>Increased Awareness:</strong> A <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC9370257/">study</a> in France found that <strong>97% of adolescents recognized the Nutri-Score label</strong>, with over <strong>90% finding it easy to understand</strong> on food packaging.</li><li><strong>Changed Purchasing Habits:</strong> <strong>54% of adolescents in the study reported that Nutri-Score influenced their food purchases.</strong> Older adolescents (15–17 years old) and those whose parents considered Nutri-Score were even more likely to make healthier choices.</li><li><strong>Improved Nutritional Quality of Purchases:</strong> Another study found that people managing diseases selected lower-calorie, lower-fat foods when guided by Nutri-Score.</li><li><strong>Healthier Product Reformulations:</strong> A <strong>2023 study by the French consumer group </strong>found that many food brands improved their products (especially cereal bars, pastries, and breakfast cereals) to achieve a better Nutri-Score rating.</li></ul><p>These findings show that simple, clear food labelling can have a significant impact on eating habits and public health.</p><h3>Why is it Hard to Know What’s Healthy in India?</h3><p>In India, food packaging does include nutritional labels, but they are often:</p><ol><li><strong>Complicated:</strong> The information is detailed but not easy to understand at a glance.</li><li><strong>Misleading:</strong> Many products highlight benefits like “high protein” or “low fat” while hiding the unhealthy parts.</li><li><strong>Lacking Clear Warnings:</strong> Even seemingly healthy products can contain high levels of sugar and salt.</li><li><strong>Not Well-Known:</strong> Many consumers are not aware of how to read and interpret nutritional information.</li></ol><h3>What Can India Learn from Europe?</h3><p>Europe’s Nutri-Score system has made healthy eating easier. India can take similar steps by:</p><ul><li><strong>Introducing Simple Labels:</strong> A <strong>color-coded score</strong> would help consumers make better choices quickly.</li><li><strong>Government and Industry Support:</strong> The food industry and regulators should work together to implement clear, front-of-pack labeling.</li><li><strong>Educating Consumers:</strong> People need more awareness about how nutrition affects health.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*zQRPl2bzLi51kA9PwQDmJw.png" /></figure><h3>A Solution: Scan the Barcode and Know the Nutri-Score Instantly</h3><p>To solve this problem, I have created a <strong>Nutri-Score app</strong> for Indian products. With this app, you can <strong>scan the barcode of any food item and instantly see its Nutri-Score. </strong>Most of the food items are listed here.</p><p>🔗 <strong>Try it here:</strong> <a href="https://nutri-score-demo.onrender.com/">Nutri-Score Demo</a></p><h4>How It Works:</h4><ol><li>Open the app.</li><li>Scan the barcode of a packaged food product.</li><li>Instantly see its <strong>Nutri-Score (A to E)</strong> and a breakdown of its ingredients.</li></ol><p>This tool makes it easy to check the nutritional quality of food in real time, just like Nutri-Score does in Europe.</p><h3>Will India Get a System Like This?</h3><p>The <strong>Food Safety and Standards Authority of India (FSSAI)</strong> has proposed a <strong>Health Star Rating (HSR)</strong> system, but it has not been widely implemented yet. Some experts argue that Nutri-Score, which is simpler and easier to understand, would be more effective. With increasing health problems like diabetes and high blood pressure, India needs a system that helps people make better food choices without confusion.</p><h3>Conclusion</h3><p>Europeans have an easy way to check how healthy their food is. India, with its growing packaged food market, needs a similar system. A clear, front-of-pack label can make a big difference in helping people eat healthier and live better. Would you like to see Nutri-Score in India? Share your thoughts in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c6b54e09425" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Settling to a new country outside India and not sure how much is a good pay?]]></title>
            <link>https://medium.com/@mastermindankur/settling-to-a-new-country-outside-india-and-not-sure-how-much-is-a-good-pay-1fb89993ebd7?source=rss-e9e7481e5ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fb89993ebd7</guid>
            <dc:creator><![CDATA[mastermindankur]]></dc:creator>
            <pubDate>Sun, 31 Jul 2022 09:12:53 GMT</pubDate>
            <atom:updated>2022-08-15T18:17:22.967Z</atom:updated>
            <content:encoded><![CDATA[<h3>Settling into a new country outside India and not sure how much is a good pay?</h3><p>Are you planning to move outside India and not sure — what you are getting paid is attractive or not. When you convert it in Indian Rupees it looks attractive on paper, but you are completely clueless — if this is the median salary for your role and it will help you with a quality life overseas.</p><p>Are you an <strong>international business</strong> setting up a business in India and struggling with your <strong>pricing model </strong>in India? The Netflix subscription in US costs 20 USD/month, how much should it be charged for the Indian users?</p><p>If you are also in such dilemma, the Economic concept of PPP — Purchasing Power Parity will help you a lot. <strong><em>Purchase power parity (PPP)</em></strong><em> is an economic theory that allows for the comparison of the purchasing power of various world currencies to one another. It is the theoretical exchange rate at which you can buy the same amount of goods and services with another currency.¹ </em>The <a href="https://www.thebalance.com/the-purpose-of-the-world-bank-3306119">World Bank</a> computes <a href="https://www.worldbank.org/en/programs/icp">PPP for each country</a> in the world. It provides a <a href="https://data.worldbank.org/indicator/PA.NUS.PPP?view=map">map that shows the PPP ratio</a>² compared to the United States. PPP allows economists and investors to determine the exchange rate between currencies for the trade to be on par with the purchasing power of the countries’ currencies. PPP lets you compute that a unit of currency in one country can buy the same basket of goods and services in the other, taking into consideration price levels in both countries.</p><h4><strong>Purchasing Power Parity between India and United States of America</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JZOIwVLRfJrOGM9-" /><figcaption>Photo by <a href="https://unsplash.com/@rwlinder?utm_source=medium&amp;utm_medium=referral">Robert Linder</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As on 20/07/2022 the Purchasing Power Parity between India and USA is <strong>23.13</strong>. What does it mean? 1 USD is equivalent to 23.13 INR. If a Diet Coke in USA costs 2 USD, in India it should be priced at 46.26 INR.</p><p>Let us get down to few examples:</p><ol><li>You have a salary of 1 Lakh in India and you are moving to US, what is equivalent salary in US for you to maintain the same standard of living. You should be earning 4323 USD to maintain the same standard of living.</li><li>Here is a table to show the equivalent purchasing power between India and US. If you earn 20 Lakh in India, you need to earn 86,000 USD to be able to buy the same basket of goods and services.</li></ol><figure><img alt="Equivalent salary in India and United States as per Purchasing Power Parity in 2022" src="https://cdn-images-1.medium.com/max/732/1*42CAC2w6B8K-yTX37gWPDQ.png" /></figure><h4>Purchasing Power Parity between India and Singapore</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x8UXGStpahW7qmAy" /><figcaption>Photo by <a href="https://unsplash.com/@huchenme?utm_source=medium&amp;utm_medium=referral">Hu Chen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ol><li>As on 20/07/2022 the Purchasing Power Parity between India and Singapore is 27.56. What does it mean? 1 SGD is equivalent to 27.56 INR. If you buy a pizza in India and spend 600 INR, you need 21 SGD to buy the same quality of pizza.</li></ol><p>2. Here is a table to show the equivalent purchasing power between India and Singapore. If you earn 10 Lakh in India, you need to earn 36,000 SGD to be able to buy the same basket of goods and services.</p><figure><img alt="Equivalent salary in India and Singapore as per Purchasing Power Parity in 2022" src="https://cdn-images-1.medium.com/max/540/1*5C_ii2s54wxn8ymQ6JRhTA.png" /></figure><h4>Purchasing Power Parity between India and United Kingdom</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EMnAvZk8ExpiH3OI" /><figcaption>Photo by <a href="https://unsplash.com/@lucas_davies?utm_source=medium&amp;utm_medium=referral">Lucas Davies</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ol><li>As on 20/07/2022 the Purchasing Power Parity between India and UK is 33.39. What does it mean? 1 British Pound is equivalent to 33.39 INR. If you buy a Starbucks Coffee in London for £5.52, you need 184 INR in India to buy the same coffee.</li></ol><p>2. Here is a table to show the equivalent purchasing power between India and United Kingdom. If you earn 1 Cr in India, you need to earn £ 300,000 in UK to be able to buy the same basket of goods and services.</p><figure><img alt="Equivalent salary in India and United Kingdom as per Purchasing Power Parity in 2022" src="https://cdn-images-1.medium.com/max/632/1*tCSGSmp61IrZcg9Sk9w9sQ.png" /></figure><h4>Purchasing Power Parity between India and Spain</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hXNN6Fnb0LbPpp0B" /><figcaption>Photo by <a href="https://unsplash.com/@jorgefdezsalas?utm_source=medium&amp;utm_medium=referral">Jorge Fernández Salas</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ol><li>As on 20/07/2022 the Purchasing Power Parity between India and Spain is 37.05. What does it mean? 1€ is equivalent to 37.05 INR. If you buy a Starbucks Coffee in Spain for 4€, you need 148 INR in India to buy the same coffee.</li></ol><p>2. Here is a table to show the equivalent purchasing power between India and Spain.</p><figure><img alt="Equivalent salary in India and Spain as per Purchasing Power Parity in 2022" src="https://cdn-images-1.medium.com/max/620/1*28Bu9UyrK00wT8VYGVpSSA.png" /></figure><h4>Purchasing Power Parity between Any Two Countries</h4><p>Would you want to see the PPP between countries other than mentioned above. This <a href="https://drive.google.com/file/d/1nBef8WC7CKJI9snHqO4p4vjBIyV2ZsSR/view?usp=sharing">PDF</a> gives the conversion rate between India and 140 countries. As promised this <a href="https://t.me/PurchasingPowerParityBot">calculator</a> lets your calculate Purchasing Power Parity between any two countries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*xJmZHw7oL01xprPkavl1HA.gif" /><figcaption>Purchasing Power Parity Calculator <a href="https://t.me/PurchasingPowerParityBot">https://t.me/PurchasingPowerParityBot</a></figcaption></figure><h4>Summary:</h4><ol><li>When foreign products come to India they need to consider the PPP to price their products. A Netflix 20$ subscription in India should be priced at 460 INR. A 5 USD Mc Donalds Burger should be priced at 115 INR.</li><li>When you move jobs between countries — look at PPP to get an estimate, how much you should be asking for.</li><li>PPP lets you compute that a unit of currency in one country can buy the same basket of goods and services in the other, taking into consideration price levels in both countries.</li><li>Happy travelling and exploring the world!</li></ol><p><strong>References:</strong></p><p>¹ <a href="https://www.thebalance.com/purchasing-power-parity-3305953">https://www.thebalance.com/purchasing-power-parity-3305953</a></p><p>²<a href="https://data.worldbank.org/indicator/PA.NUS.PPP?most_recent_year_desc=true&amp;view=map">https://data.worldbank.org/indicator/PA.NUS.PPP?most_recent_year_desc=true&amp;view=map</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fb89993ebd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Data Science Takes the Guesswork out of Trading Decision Making]]></title>
            <link>https://medium.com/@mastermindankur/how-data-science-takes-the-guesswork-out-of-trading-decision-making-f2b206437cde?source=rss-e9e7481e5ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2b206437cde</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[strategy]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[banking]]></category>
            <category><![CDATA[stock-market]]></category>
            <dc:creator><![CDATA[mastermindankur]]></dc:creator>
            <pubDate>Fri, 13 Aug 2021 11:31:47 GMT</pubDate>
            <atom:updated>2021-08-13T11:31:47.343Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re standing on the edge of a lake trying to find out how deep it is, you wouldn’t jump in with both feet to test it out. A more prudent decision would be to put a long stick into the lake to find out just how far down it goes. Using the same analogy, you wouldn’t commit to a new trading strategy without first testing the waters (so to speak), at the risk of losing your hard-earned money, particularly if you aren’t an experienced trader to begin with. So, what are some strategies you can use to aid complex decision-making?</p><p><strong>Past Experience Is Invaluable For Complex Decision Making</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZjRA85QCKilcxH2w" /><figcaption>Photo by <a href="https://unsplash.com/@soymeraki?utm_source=medium&amp;utm_medium=referral">Javier Allegue Barros</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You are probably already using past experiences to make new decisions in your everyday life. And <a href="https://www.sciencedaily.com/releases/2009/05/090513130930.htm">research</a> has shown that this is useful in making complex decisions, particularly when the information you have on hand is uncertain or confusing. Our experiences change the circuitry in our brains, allowing us to quickly categorise what we see and act accordingly.</p><p>However, if you’re completely new to an activity like trading, how do you develop or gain this experience without prior knowledge? One of the ways to do this is to run your strategy on historic data to gauge its performance — also known as <strong>back-testing</strong>. A huge advantage of this method is that it allows you to test your hypothesis without putting in real money, so you can tweak it until you’re confident that you can execute an optimised trading strategy.</p><p>Now, I will back-test a very common strategy which is based on the ideas of Support and Resistance, where you’ll see how this method can be accomplished with a basic understanding of Python (or any programming language) and some commonly used data science libraries. But first, a quick summary of what Support and Resistance mean?</p><p><strong>The Support</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zW_gubE4DqQrbE_UqNpjoQ.png" /></figure><p>As the name suggests, <a href="https://zerodha.com/varsity/chapter/support-resistance/">Support</a> is the price at which the prices of the stock tends to hold. It is also generally the price point at which the price tends to bounce back. The demand tends to increase at this price — there are more buyers than sellers and the price tends to reverse. <em>The </em><a href="https://zerodha.com/varsity/chapter/support-resistance/"><em>support</em></a><em> is one of the critical technical level market participants look for in a falling market. The support often acts as a trigger to buy.</em></p><p><strong>The Resistance</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yikNJIEa-WIokEllH6IJ9Q.png" /></figure><p>As the name suggests <a href="https://zerodha.com/varsity/chapter/support-resistance/">Resistance</a> is the price point where the price of the stock is not expected to move further. The Resistance price is above the market price of the stock. Resistance is also the point at which the price starts to drop again.<em> The </em><a href="https://zerodha.com/varsity/chapter/support-resistance/"><em>resistance</em></a><em> is one of the critical technical analysis tools which market participants look at in a rising market. The resistance often acts as a trigger to sell.</em></p><p>Since the price of stock tends to stop and reverse at these points, as a trader you would see an opportunity to buy near the support levels and sell near the resistance levels. Depending on the time window you want to enter the market, you would want to compute your support and resistance levels for that time frame. There are a few famous techniques used by traders to compute the Support and Resistance levels, including Classic, Fibonacci, Camarilla and Woodie. For the purpose of this article, we will look at the <strong>Classical </strong>way of computation.</p><p><strong>Classical Way of Pivot Point Calculation</strong></p><p>Pivot point (PP) = (High + Low + Close) / 3.</p><p>First resistance (R1) = (2 x PP) — Low.</p><p>First support (S1) = (2 x PP) — High.</p><p>Second resistance (R2) = PP + (High — Low)</p><p>Second support (S2) = PP — (High — Low)</p><p>Third resistance (R3) = High + 2(PP — Low)</p><p>Third support (S3) = Low — 2(High — PP)</p><p>Let us try to “back-test” the following trading strategy for an intra-day trader, one who buys and sells stocks within the same trading day.</p><p>1 Buy just above the Support Level</p><p>2 Sell just a little below the Resistance Level</p><p>Ok let us get back-test this strategy, importing the necessary libraries.</p><pre><strong>import</strong> <strong>matplotlib.pyplot</strong> <strong>as</strong> <strong>plt</strong><br><strong>import</strong> <strong>numpy</strong> <strong>as</strong> <strong>np</strong><br><strong>import</strong> <strong>pandas</strong> <strong>as</strong> <strong>pd</strong><br><strong>import</strong> <strong>matplotlib.dates</strong> <strong>as</strong> <strong>dates</strong><br><strong>import</strong> <strong>quandl</strong><br>%matplotlib inline</pre><p>I am using <a href="https://www.quandl.com/data/BSE-Bombay-Stock-Exchange/usage/quickstart/python">Quandl API</a> for this example to pull the stock prices listed on Bombay Stock Exchange. This call retrieves data from 01 Jan, 2021 to Mar 14, 2021 for BSE/BOM500112. The stock in consideration is of SBI and its code is 500112.</p><pre>quandl.ApiConfig.api_key = &#39;your_own_key&#39;<br>#Get SBI stock prices for a date range<br>sbi =quandl.get(&#39;BSE/BOM500112&#39;, start_date=&#39;2021-01-01&#39;, end_date=&#39;2021-03-14&#39;)</pre><p>The below code evaluates the Pivot Point, Support and Resistance Level as per the classical way.</p><pre>sbi[&#39;PP&#39;]= (sbi[&#39;High&#39;]+sbi[&#39;Low&#39;]+sbi[&#39;Close&#39;])/3<br>sbi[&#39;R1&#39;]= 2*sbi[&#39;PP&#39;] -sbi[&#39;Low&#39;]<br>sbi[&#39;S1&#39;]= 2*sbi[&#39;PP&#39;] -sbi[&#39;High&#39;]<br>sbi[&#39;R2&#39;]= sbi[&#39;PP&#39;] + (sbi[&#39;High&#39;] - sbi[&#39;Low&#39;]) <br>sbi[&#39;S2&#39;]= sbi[&#39;PP&#39;] - (sbi[&#39;High&#39;] - sbi[&#39;Low&#39;]) <br>sbi[&#39;R3&#39;]= sbi[&#39;High&#39;] + 2*(sbi[&#39;PP&#39;] - sbi[&#39;Low&#39;])<br>sbi[&#39;S3&#39;]= sbi[&#39;Low&#39;] - 2*(sbi[&#39;High&#39;] - sbi[&#39;PP&#39;])</pre><p>Instead of executing the trade exactly at the Support and Resistance levels, let us try to buy a little higher than the Support level and sell a little lower that the Resistance level. But how do we decide what these “slightly higher” and “slightly lower” ticks should be? Most stocks tend to trade in a specific range during a day. We would look at this range — the price difference between the highest price to the lower price for a specific day — and calculate the median of the range over a certain time period, and consider 10% of this as our tick value. Why am I calculating these up and down ticks ? To increase the probability of getting the trade.</p><pre><em># Up and Down are the ticks above and below which we want to execute </em>up= sbi[&#39;Spread H-L&#39;].median()*.10<br>down= sbi[&#39;Spread H-L&#39;].median() *.10</pre><p><strong>Great, now set our Target prices.</strong></p><pre>sbi[&#39;Buy&#39;]= sbi[&#39;S1&#39;].shift(1) + up<br>sbi[&#39;Sell&#39;]= sbi[&#39;R1&#39;].shift(1) - down</pre><p>To determine if we were able to execute the trade, we need to look at three possibilities. I am using a flag called ‘got_it’. Depending upon the three possibilities that can happen, I am setting the value of the flag ‘got_it’. <em>One underlying assumption we are making is that the support price hits first before the resistance price, meaning we will buy first and sell later.</em></p><p><strong>1</strong> — If we are able to buy at Support+delta and sell at Resistance-delta the same day, it is a successful Trade.</p><p><strong>2</strong> — If we are able to Buy at Support+delta but are not able to sell it since the Resistance-delta price never came, I would still want to square off my position at the end of the day. I am forced to sell it at the closing price, regardless of whether I am in the money or out of the money.</p><p><strong>0</strong> — If we are not able to buy at all since the Support+delta price was never reached that day, the trade did not happen.</p><pre><em># Set initial value set to 0 of all elements</em><br>sbi[&#39;got_it&#39;] = 0<br><br><em># if the trade happened between support and resistance levels, put 1 in got_it column</em><br>sbi.loc[(sbi[&#39;Buy&#39;]&gt;sbi[&#39;Low&#39;]) &amp; (sbi[&#39;Sell&#39;] &lt;sbi[&#39;High&#39;]) &amp; (sbi[&#39;Sell&#39;]&gt;sbi[&#39;Buy&#39;]),&#39;got_it&#39;]=1<br><br><em># If I was able to Buy but not able to sell it becuase price did not hit resistance level, put 2 in got_it column</em><br>sbi.loc[(sbi[&#39;Buy&#39;]&gt;sbi[&#39;Low&#39;]) &amp; (sbi[&#39;Sell&#39;] &gt;sbi[&#39;High&#39;]) ,&#39;got_it&#39;]=2</pre><p>Now let us compute the profits we earned, when the Resistance level was reached the same day and the trade happened successfully:</p><p><strong>Profit = Selling Price — Buying Price</strong></p><p>However, when the Resistance price was not reached, we are forced to sell at the closing price for that day. In that case:</p><p><strong>Profit (or Loss) = Closing Price — Buying Price</strong></p><pre>sbi[&#39;Profit&#39;]=0<br>profit= sbi[&#39;Sell&#39;]-sbi[&#39;Buy&#39;]<br>forced_profit_or_loss= sbi[&#39;Close&#39;]-sbi[&#39;Buy&#39;]<br><br>sbi.loc[(sbi[&#39;got_it&#39;]==1) ,&#39;Profit&#39;]=profit<br>sbi.loc[(sbi[&#39;got_it&#39;]==2) ,&#39;Profit&#39;]=forced_profit_or_loss</pre><p>Great, I have been able to compute the profit or Forced Profit or Loss. Let me understand in the date range of interest— how many days was I able to execute a Successful Trade OR Forced Square off OR No trade.</p><pre>sbi[&#39;got_it&#39;].plot.hist(label=&#39;Labels: 0= No Trade, 1 = Succesfull Trade, 2 = Squaredoff Trade&#39;, figsize=(12,10))<br>plt.ylabel(&#39;# of Trades&#39;)<br>plt.xlabel(&#39;Trade Status&#39;)<br>plt.xticks([0,1,2])<br>plt.style.use(&#39;ggplot&#39;)<br>plt.legend()</pre><figure><img alt="For the Date Range, finding if we were able to execute the trade, squared off forcefully or trade did not happen" src="https://cdn-images-1.medium.com/max/720/1*QuDG0MJKIqIAv1PVrrdWGw.png" /></figure><p>Out of the 33 trading days between 1 Jan 2021 to 14 March 2021, we would have gotten successful trades on 25 days, done a square-off on 12 days and no trade would have been possible on 12 days.</p><p>Now let us look at the net profit or loss using this strategy in the 2.5 month period.</p><pre>x=sbi[&#39;Profit&#39;].sum()/sbi[&#39;Open&#39;].mean() *100<br>print(&quot;The profit percentage you can get is <strong>{rate}</strong>&quot;.format(rate=x))<br>The profit percentage you can get is 4.66 %</pre><p>Let us have a look visually — what was the band that was formed and whether we were able to get the trade or not.</p><pre>sbi[[&#39;High&#39;,&#39;Low&#39;,&#39;Buy&#39;,&#39;Sell&#39;]].tail(30).plot(figsize=(20,15))<br>plt.ylabel(&#39;SBI Price&#39;)<br>plt.xlabel(&#39;Trading Date&#39;)<br>plt.style.use(&#39;ggplot&#39;)<br>plt.legend()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hwLRTatipjYjAV42-_xsFA.png" /></figure><p><strong>Top Performing Stocks in BSE 100 List Using this Strategy:</strong></p><p>In the above example, if we had executed this strategy on SBI, we would have gotten a return of 4.66%. What if we wanted to back-test this on all the top 100 stocks listed on BSE and compare their returns? We would run this strategy on every stock, calculate the return and sort it in descending order of returns. Here is the analysis of the <a href="https://www.bseindia.com/markets/equity/EQReports/TopMarketCapitalization.aspx">TOP 100 stocks by Market Capitalisation</a> for the time period 1 Jan 2021 to 14 March 2021.</p><p>If you end up <a href="https://github.com/mastermindankur/stock-analysis/">iterating</a> through the 100 BSE stocks, you should end up getting the following returns:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*grEzmDh4ZQNRCLkhIEWhRg.png" /><figcaption>Return of Support Resistance Strategy on Top 100 BSE Companies by Market Capitalisation</figcaption></figure><p>If you had invested in Siemens Ltd daily using this strategy, it would have helped you grow your principal by 36%, while ADANI ENTERPRISES LTD would have given you a return of 29%.</p><p><strong>Conclusion and Key takeaways:</strong></p><ol><li><strong>Back-testing</strong> is a secret weapon in trading because it lets you test your hypothesis without putting in real dollars, allowing you tweak your strategy multiple times before you execute your optimised strategy in the market.</li><li>Since the price of the stock tends to stop and reverse at these points, as a trader you will see an opportunity to buy near the support levels and sell near the resistance levels.</li><li>As an investor you should test the waters, before putting both your feet in it.</li></ol><p><strong>Github Repository Link:</strong></p><p><a href="https://github.com/mastermindankur/stock-analysis//">https://github.com/mastermindankur/stock-analysis/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2b206437cde" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>