<?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 Rodrigo Pedrazas on Medium]]></title>
        <description><![CDATA[Stories by Rodrigo Pedrazas on Medium]]></description>
        <link>https://medium.com/@rodrigopedrazas?source=rss-f49d5775a2b8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*llEaFi5sKXzkAoQQ.jpg</url>
            <title>Stories by Rodrigo Pedrazas on Medium</title>
            <link>https://medium.com/@rodrigopedrazas?source=rss-f49d5775a2b8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:22:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rodrigopedrazas/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[Trading in FOREX using Market Structure & Machine Learning]]></title>
            <link>https://medium.com/trading-in-forex-market-structure/trading-in-forex-using-market-structure-machine-learning-72da6d84cd54?source=rss-f49d5775a2b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/72da6d84cd54</guid>
            <category><![CDATA[market-structure]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[forex]]></category>
            <dc:creator><![CDATA[Rodrigo Pedrazas]]></dc:creator>
            <pubDate>Mon, 02 Aug 2021 17:36:37 GMT</pubDate>
            <atom:updated>2021-08-09T16:24:34.165Z</atom:updated>
            <content:encoded><![CDATA[<p>I was asked, as part of my final project of my Data Scientist Masters degree to submit a final project encompassing all the work I have learnt throughout the course. Well this is the story of a 1 year strategy developed in the Forex Market… A Market Structure Story…</p><p>The main objective of this project is to assess a number of strategies applied in the EURUSD Forex Market. The main problem here is obtain a number of buying/selling points that provides a statistical confidence &gt; 50% in a 3:1 ratio bet, within the spreadbetting market.</p><p>The strategies have been based in Market Structure theory + Machine Learning algorithms.</p><p>The metrics used to assess the strategies has been:</p><p>Precision ≥ 50% in all 3 split dataframes.</p><h3>What is Market Structure</h3><p>The Forex markets trend in 3 different directions at any given time and understanding when a shift occurs based on chosen timeframe is pivotal to successful trading. The 3 types of market structure are:</p><ol><li><strong>Bull trend (Up)</strong></li><li><strong>Bear trend (Down)</strong></li><li><strong>Sideways trend (Right)</strong></li></ol><p>The<strong> bull trend</strong> is depicted by <strong>higher highs (HH) and higher lows (HL)</strong>. The trend will continue in that direction until a lower low is printed by the asset price. The trend begins to show signs of weakness when it fails to print a higher high.</p><p>The <strong>bear trend</strong> is the price action of<strong> lower lows (LL) and lower highs (LH)</strong>. The bear trend will continue to fall as long as lower highs continue to print, once a higher high comes into the price, the trend will end. The sign that the trend may be reversing is when price begins to print higher lows or equal lows.</p><p>The sideways trend is a trend that has equal highs and equal lows. Price trends in a range during this point of the market and is in consolidation. Markets can move in a period of consolidation for a long time. This trend is broken if the price breaks out from the top or bottom of the range. This could be the beginning of one of the first two trends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*qI4D9TuiLGFEqtI66vWcjg.jpeg" /></figure><p>Here´s an example of a plotted figure of the 15M EURUSD Market Structure for a certain period using Plotly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*xaODSFs9DmjChpuLphou0A.png" /></figure><h3>Data</h3><p>The data used for this exercise is the EURUSD market candle sticks from 01.2007 to 06. 2021.</p><h3>Parameters</h3><p>The parameters used are the following. Please note all these functions have been appied for all timeframes (D1, H4, H1 &amp; M15) and have been merged into a unique dataframes further along the line.</p><ul><li><strong>Closing </strong>→ It defines whether the last candle closed up (above the opening price) Closing = 1; or closed down (below the opening price) Closing = -1.</li><li><strong>MS_High </strong>&amp; <strong>MS_Low </strong>→ These are the top and bottom prices for the range in which the price moves.</li><li><strong>Trend </strong>→ It defines the latest trend. If the latest break in structure was bullish, Trend would = 1, and Trend = -1 if the last trend was bearish.</li><li><strong>N_breaks </strong>→ Function that calculates the number of previous breaks in the same direction.</li><li><strong>MS_periods </strong>→ Function that calculates the number of periods the price remains within the same Market Structure range.</li><li><strong>MS_range</strong> → Function that calculates the number of pips between MS_High &amp; MS_Low.</li><li><strong>Indicators</strong>: There have been a number of common trading indicators that will be used in the 2nd part of the strategy to improve predictions. The chosen indicators have been:</li></ul><pre>RSI_14_SMA, RSI_14_EMA, <br>EMA_MACD_12_26_9, Hist_MACD_12_26_9, MACD_signal,<br>Boll_SMA_20</pre><ul><li>Lastly, and most important the <strong>Retracement Levels: </strong>Function that calculates percentage-wise how much the price has retraced (0,100)% between MS_High &amp; MS_Low depending on its trend. An example is shown below:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*zsl3roIPO5Ys8aAt3BHyTA.png" /></figure><h3><strong>Strategy Parameters</strong></h3><p><strong>Ratio </strong>3:1 → This means that for all “bets” we put in, the <strong>Limit </strong>to where we collect our profit (whether we buy or lose) will be 3 times the <strong>Stop loss</strong>. In simple terms: if we bet 1 and lose, we lose 1; and if we win, we win 3.</p><p><strong>Range</strong>: The range is the difference between Market Structure High and Market structure Low and measured in pips (0.0001 = 1 pip):</p><p>Range = [MS High]- [MS Low]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*25LN6vAUSbxz02oO_f0SWQ.png" /></figure><h3>Pricing</h3><p>Two pricing functions have been defined:</p><ul><li><strong>Price_M15_H1</strong>: Function that prices all M15 candles based on the Closing price of M15 candles and calculates its limit &amp; stop loss based on the H1 Market Structure (MS_H_H1 &amp; MS_L_H1).</li><li><strong>Price_M15_H4</strong>: Function that prices all M15 candles based on the Closing price of M15 candles and calculates its limit &amp; stop loss based on the H4 Market Structure (MS_H_H4 &amp; MS_L_H4).</li></ul><p>For every M15 candle this function will attribute a 1 or a 0 to:</p><ul><li><strong>Labelb_M15_H1 </strong>→ 1, if buying at a 3:1 Limit/stop-loss ratio having the <strong>H1_Market_Structure </strong>determining the Limit and the stop-loss settings, and being successful.</li><li><strong>Labels_M15_H1 </strong>→ Same as above but selling instead of buying.</li><li><strong>Labelb_M15_H4 </strong>→1, if buying at a 3:1 Limit/stop-loss ratio having the <strong>H4_Market_Structure </strong>determining the Limit and the stop-loss settings, and being successful.</li><li><strong>Labels_M15_H4 </strong>→Same as above but selling instead of buying.</li></ul><h3>The Strategy</h3><p>The strategy will consist in a two-phase approach. First of all the data will be filtered based on the <strong>Retracement Levels </strong>using the Fibonnaci retracement levels as thresholds [0, 23.6, 38.2, 50, 61.8, 78.6, 90, 99] and the Trends for all timeframes.</p><p>The second phase approach will be to apply Machine Learning (Random orest classifier) using the indicators described above to improve the predictions.</p><h3><strong>Methodology</strong></h3><p>The methodology used has been:</p><ul><li>The 15 year dataframe will be split in 3 different dataframes equal in length (approx 5 years of data for each dataframe) and have the strategy be succesful on all 3 dataframes.</li><li>The same strategy will be applied on buy signals and sell signals, this will guarantee a simetry with the applied strategy, providing more confidence in having a ‘non-bias’ model.</li><li>We aim to assess the models with a ‘healthy’ ROC for all models.</li></ul><h3>1st part of the strategy: Filtering Process</h3><p>The filtering process has been based on the <strong>Retracement Levels </strong>explained above set by the direction of the trend. If the trending were to be bullish (Up), the retracement level is calculated as: ([Close Price 15M] - [MS Low]) /(Range),</p><p>if the trending were to be bearish (Dw), the retracement level is calculated as: ([MS High]-[Close Price 15M]) /(Range).</p><p>By applying an exploration function it has been determined that the following fibonacci retracements levels and trends have shown to be the most successfull:</p><p><strong>Strategy - MS_H1</strong></p><ul><li>BUY - H1 Trend up + MS_D1 between (38.6%, 50%) + MS_H4(23.6%, 61.8%) + MS_H1(0%, 78.6%) + MS_M15(38.2%,61.8%)</li><li>SELL - H1 Trend dw + MS_D1 between (38.6%, 50%) + MS_H4(23.6%, 61.8%) + MS_H1(0%, 78.6%) + MS_M15(38.2%,61.8%)</li></ul><p><strong>Strategy — MS_H4</strong></p><ul><li>BUY - D1 Trend Up + H4 Trend up + MS_D1 between (0%, 78.6%) + MS_H4(23.6%, 78.6%) + MS_H1(0%, 90%) + MS_M15(0%, 99%)</li><li>SELL - D1 Trend Up +H4 Trend dw + MS_D1 between (0%, 78.6%) + MS_H4(23.6%, 78.6%) + MS_H1(0%, 90%) + MS_M15(0%, 99%)</li></ul><p>The results of this first stage are as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*H2PfB2aYdU4xTnUEq-dgrg.png" /><figcaption><strong>Strategy — MS_H1</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*f2tkSlFnqk1XzBQX14xLhg.png" /><figcaption><strong>Strategy — MS_H4</strong></figcaption></figure><ul><li>Mean refers to the average of winning points,</li><li>(Count x 30) would be the number of points in total filtered out for the whole dataframe.</li><li>The Total months represents the number of months accross the whole timeline where points have been identified. It also represents the chances of having a point available any month.</li></ul><h3>2nd part of the strategy: Machine Learning</h3><p>Next we will be applying Random Forest Classifier “throwing” the indicators calculated previously together with any other information that hasn´t been used into the “mix”.</p><p>The Random Forest Classifiers will be applied and trained independtly to 2 of the 3 dataframes, forming the following pairs:</p><ul><li>trained on df1 &amp; df2 and validated on df3,</li><li>trained on df1 &amp; df3 and validated on df2, and</li><li>trained on df2 &amp; df3 and validated on df3.</li></ul><p>The 4 succesful models will be the ones that predict the best results for the Buy and sell strategies on the H1 buying label, H1 selling label, H4 buying label and H4 seling label.</p><p>The results for the optimum 4 models are as follows:</p><p><strong>Strategy - MS_H1 - BUY (ROC curve &amp; precision_recall curve)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*EassxWita6Raz9zQK5wdWQ.png" /><figcaption>ROC &amp; precision recall curves for Strat 1 — BUY</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*vlkf0w-6GDPcvh61wJyzdA.png" /><figcaption>Most relevant features for Strat 1 — BUY</figcaption></figure><p><strong>Strategy - MS_H1 - SELL (ROC curve &amp; precision_recall curve)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8OqQCbME1VukxVb6B_FR2g.png" /><figcaption>ROC &amp; precision recall curves for Strat 1 — SELL</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*hiDSRcmSxjRFQR8BqGv1nA.png" /><figcaption>Most relevant features for Strat 1 — SELL</figcaption></figure><p><strong>Strategy - MS_H4 - BUY (ROC curve &amp; precision_recall curve)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gleOhV2ZKKjlCzAoMZdPQA.png" /><figcaption>ROC &amp; precision recall curves for Strat 2— BUY</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*JUJAzxntUb0HAzoDwNT7vg.png" /><figcaption>Most relevant features for Strat 2 — BUY</figcaption></figure><p><strong>Strategy - MS_H4 - SELL (ROC curve &amp; precision_recall curve)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QOjnkUly6JkOfdVNxslcdg.png" /><figcaption>ROC &amp; precision recall curves for Strat 2 — SELL</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*ReMLGmT5RpD-3izMCQX2rQ.png" /><figcaption>Most relevant features for Strat 2 —SELL</figcaption></figure><p><strong>CONCLUSION</strong></p><p>Strategy 1:</p><p>There are 70% chances that at least 1 of these points (Buying &amp; selling) will appear in the month. By filtering the chances of success is already approx. 40% on a 3:1 bet. But when applying the random forests classifier, by sacrifying approx. 40% of these points we raise are chances of success over 50%.</p><p>Strategy 2:</p><p>There are 33% chances that at least 1 of these points (Buying &amp; selling) will appear in the month. By filtering the chances of success is already approx. 40% on a 3:1 bet. But when applying the random forests classifier, by sacrifying approx. 40% of these points we raise are chances of success over 50%, as well.</p><p><strong>WARNING</strong></p><p>For anyone that has reached to the end of the note, please note that BIAS is always there, and there even though the models have only been ajusted by 2/3 of the data and validate by the other 1/3, threre are always chances of BIAS that could invalidate the strategy. Any strategy always has to be tested in a DEMO scenario and only when the statistics prove right, is smart to invest your own money.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72da6d84cd54" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trading-in-forex-market-structure/trading-in-forex-using-market-structure-machine-learning-72da6d84cd54">Trading in FOREX using Market Structure &amp; Machine Learning</a> was originally published in <a href="https://medium.com/trading-in-forex-market-structure">Trading in Forex — Market Structure</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to improve your AirBNB at no cost!]]></title>
            <link>https://rodrigopedrazas.medium.com/how-to-improve-your-airbnb-at-no-cost-80f314588201?source=rss-f49d5775a2b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/80f314588201</guid>
            <dc:creator><![CDATA[Rodrigo Pedrazas]]></dc:creator>
            <pubDate>Tue, 22 Sep 2020 11:37:03 GMT</pubDate>
            <atom:updated>2020-12-29T14:41:40.557Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*swj7iuDCNE9WHFqkqxylTQ.jpeg" /></figure><p>As part of my Data Scientist Nanodegree I was asked to carryout a study on Seattle´s AirBNB database.</p><p>My chosen field was to study the host´s behaviour against its rating. To be more specific, I was looking for ways improve the profit (rent at higher prices) of the host´s Airbnb at no cost, just based on the host´s behaviour.</p><p>As everyone knows, the location of the Airbnb asset is the factor that has most impact on rating and prices…however, this study was intented to carry out an analysis of the Seattle AirBNB Data and explore opportunities for those hosts that look to improve their performance without spending money and what other factors non-related to location could also have a mjor impact on setting prices and receiving good ratings.</p><p>The 3 main questions asked during my survey were:</p><ul><li>What are the top 5 features which have more impact in the price? i.e. zipcode? square_feet?</li><li>What impact have the ratings over the price?</li><li>What are the top 5 features which customers value when rating their stay that depend only on the host? i.e. experiences_offered? cleanliness?</li></ul><p><strong>Q1: Top 5 features which have more impact in the price</strong></p><p>In regards to the Q1, the table below shows the main factors that have a strong impact on the price. A surprising finding about these is that the host_has_profile_pic factor, which has a strong negative correlation with the price. We cannot confirm whether this is due other underlying factors, but it still an interesting result worth investigating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*wzUjwGRR0HhtcfWmn6_gLw.png" /><figcaption>Price Relative Impact VS feature</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*nVM2uiA9oe-ozq3XFMdvvQ.png" /></figure><p><strong>Q2: What impact have the ratings over the price?</strong></p><p>In regards to the the question Q2, the study has shown that that the ratings have an overall average imapact of 2.5 dollars per rating point. This means that a property, regardless of its location and the type of size of it, can always be rented at a higher price if the ratings are maintained high, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*biP8zc24-IxgL9Amur2hXg.png" /></figure><p><strong>Q3: Top 5 features which customers value when rating their stay, that depend only on the host</strong></p><p>Finally, the findings related to Q3 show from top to bottom, that the following features have the strongest impact:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*oUFmxMCIJ1FjzLKFk5kw7A.png" /><figcaption>Price Impact VS feature</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*0OsTarf8U-ub5_GqD5nTuQ.png" /></figure><ul><li>host_acceptance_rate — affects negatively. Surprisingly a host that chooses its tenants have better chance to put the roperty at a higher price.</li><li>review_scores_cleanliness — affects positively. Although this one would be obvius, it is still interesting to know this factor would come in number 2.</li><li>review_scores_communication — affects positevely. The better the communication, the better rating, the higher the prices you can put on your property!</li><li>review_scores_checkin — affects positevely. It most probably follow the same logic as above.</li><li>host_is_superhost_t — positevely. This last one is intereseting since it sums up all the ones above. Becoming a superhost will have a positive impact on the long term when it comes to setting the price of your property.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80f314588201" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>