<?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 The crypto craftsman on Medium]]></title>
        <description><![CDATA[Stories by The crypto craftsman on Medium]]></description>
        <link>https://medium.com/@the-crypto-craftsman?source=rss-ec172928addd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*W6bTuCGiSzEJmGLOgdVgMA.png</url>
            <title>Stories by The crypto craftsman on Medium</title>
            <link>https://medium.com/@the-crypto-craftsman?source=rss-ec172928addd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 07:13:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@the-crypto-craftsman/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[We Missed a 200% Rally on MINA/USDT Today — Here’s How to Ride the Next Crypto Surge]]></title>
            <link>https://medium.com/@the-crypto-craftsman/we-missed-a-200-rally-on-mina-usdt-today-heres-how-to-ride-the-next-crypto-surge-8e4dec62692d?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e4dec62692d</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[mina]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[binance]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 18:17:27 GMT</pubDate>
            <atom:updated>2023-10-24T18:17:27.898Z</atom:updated>
            <content:encoded><![CDATA[<h3>We Missed a 200% Rally on MINA/USDT Today — Here’s How to Ride the Next Crypto Surge</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3eIyHSoi5WJbQLkE" /><figcaption>Photo by <a href="https://unsplash.com/@jonathanborba?utm_source=medium&amp;utm_medium=referral">Jonathan Borba</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>Welcome to the “Hindsight Pump” series, where we dive into exhilarating crypto pumps and unravel the secrets to catching the next one.</em></p><blockquote><strong><em>Disclaimer:</em></strong><em> Keep in mind that the information in this article is for educational purposes only. Crypto trading is a thrilling but unpredictable journey. Invest only what you can afford to lose and do your own research.</em></blockquote><h3>What’s the Story Behind This Crypto Rollercoaster?</h3><p>In the the morning of October 24th, MINA/USDT on Binance about to embark on a wild ride:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3wH3AjJ-i1vsAUUuvKqRYw.png" /><figcaption>BINANCE : MINA/USDT on October 24, 2023 (tradingView)</figcaption></figure><p>Here’s a breakdown of how it went:</p><ul><li>04:15 UTC: Mina surges +28% from 0.48 USDT to 0.62 USDT.</li><li>05:30 UTC: It peaks at 0.7 USDT.</li><li>06:15 UTC: Briefly dips to 0.54 USDT.</li><li>08:15 UTC: Rockets to a new high of 0.86 USDT.</li><li>09:15 UTC: Calms down to 0.7 USDT.</li><li>And by 11:45 UTC, it reaches a jaw-dropping +100% gain, then start slowly descending.</li></ul><p>If only we had hopped on board at the start, we could’ve <strong>doubled our crypto stash</strong>! So, what set off this crypto party? The answer is right here:</p><h3>Upbit Korea on Twitter: &quot;미나(MINA) KRW 마켓 거래지원 안내✅ 지원 마켓: KRW 마켓📅 거래지원 개시 시점: 2023-10-24 16:00 예정🔗 공지 바로가기:https://t.co/gRla2b9kWo#Upbit #MINA pic.twitter.com/XVlIGGetfC / Twitter&quot;</h3><p>미나(MINA) KRW 마켓 거래지원 안내✅ 지원 마켓: KRW 마켓📅 거래지원 개시 시점: 2023-10-24 16:00 예정🔗 공지 바로가기:https://t.co/gRla2b9kWo#Upbit #MINA pic.twitter.com/XVlIGGetfC</p><p>Yeah. I don’t read Korean either but here we go : <strong>UpBit</strong>, South Korea’s crypto behemoth, announced the launch of SPOT trading between Mina and KRW.</p><p>Obviously, hindsight is a crystal ball, but let’s put on our detective hats ands see if we could’ve caught this crypto wave with the right tools.</p><h3>Hunting for the First Clue</h3><p>Let’s start with the obvious — UpBit’s tweet. It was posted at 13:38 KST, which translates to 5:38 UTC. But, as you can see, the crypto pump started at 4:15 UTC, so we’re already late to the party.</p><p>In addition to that, Tweets can be a bit troublesome to integrate in an automated strategy for two reasons:</p><ul><li>The format of twits is rarely standardised, so you’ll have to do some extra work to extract the relevant info.</li><li>It’s kind of in Korean. There is also an international twitter account but it was even more late.</li><li>As you may have heard already, the new Twitter API use conditions and pricing are a bit of a pain to work with.</li></ul><p>But hey, I got a silver lining for you — UpBit has an official news page, and it’s a goldmine of crypto news about the exchange. Here’s the announcement we’re looking for: <a href="https://www.upbit.com/service_center/notice?id=3797">UpBit’s Official Announcement</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*XfD4NOIIAU-1bAFGdzq0sA.png" /></figure><p>This one was published at 13:25 KST, which translates to 4:25 UTC. That’s 50 minutes before the tweet, so we’re getting closer to the source.</p><p>As you can see however, we did miss the actual start of the surge by a few minutes. I couldn’t find any earlier announcement, so I’m guessing the news was leaked to some insiders. But hey, we would have still made a nice profit if we had reacted to the news in time.</p><p>Now, this is only good if we can turn it into a strategy for future gain right ? Well I got you covered !</p><h3>Can Lightning Strike Twice?</h3><p>If we go to the official <a href="https://www.upbit.com/service_center/notice">UpBit announcement pages</a>, we can see a few other that triggered a crypto pump. Even better, we can sort them up ! All we have to do is to type in new digital asset in their search bar.</p><p>Here’s what we get :</p><h3>GLMR/BTC on UpBit — September 25, 2023</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*-pT16sfEcG3gCIksHN8V8A.png" /><figcaption>BINANCE : GLMR/USDT (Tradingview)</figcaption></figure><p><a href="https://www.upbit.com/service_center/notice?id=3748">UpBit’s Official Announcement</a></p><p>The news was released at 14:00 KR, which translates to 6:00 UTC. Just in time to catch a 0.16 USDT to 0.25 USDT rally on Binance.</p><p>By nailing the timing, the potential gain was +56% in a couple of hours. Not bad, but maybe it’s just a fluke. Let’s try another one.</p><h3>IMX/KRW on UpBit — July 28, 2023</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*v4emmq0RYAWfFsJYbsgnfw.png" /><figcaption>BINANCE : IMX/USDT (Tradingview)</figcaption></figure><p>Let’s try another one, with a KRW pair this time. This one was released at 11:30 KR, which translates to 2:30 UTC.</p><p><a href="https://www.upbit.com/service_center/notice?id=3654">UpBit’s Official Announcement</a></p><p>This time, the rally went within a couple hours from 0.725 USDT to 0.85 USDT, which is a +17% gain. Not as impressive as the previous one, but still a nice profit. And it is quite lenient, joining this one half an hour late could still have netted you a 5 to 10% gain.</p><p>Let’s do a last one, just to be sure.</p><h3>STG/USDT on UpBit — August 22, 2023</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*YUHcOkI5S3yPR70r-U7Huw.png" /><figcaption>BINANCE : STG/USDT (Tradingview)</figcaption></figure><p><a href="https://www.upbit.com/service_center/notice?id=3672">UpBit’s Official Announcement</a></p><p>We got the news at 09:10 KR, which translates to 0:10 UTC. This time, the rally went from 0.62 USDT to 0.74 USDT, which is a +19% gain. Not bad, not bad at all. You also had quite a bit of time to jump this train, provided you were awake at 0:10 UTC and reactive enough.</p><p>Or… Maybe provided we coded a little bot ?</p><h3>Amazing ! What now ?</h3><p>I don’t know about you, but I’m certainly keeping my eyes peeled for more hidden crypto signals on UpBit’s announcement page.</p><p>Oh, by the way, as a thank you for reading this article, I’ll let you in on a little tip. You can get the latest UpBit announcements in a sweet sweet JSON format with this URL:</p><p><a href="https://api-manager.upbit.com/api/v1/notices/search?search=new%20digital%20asset&amp;page=1&amp;per_page=20&amp;partition=1&amp;target=non_ios&amp;thread_name=general">https://api-manager.upbit.com/api/v1/notices/search?search=new%20digital%20asset&amp;page=1&amp;per_page=20&amp;partition=1&amp;target=non_ios&amp;thread_name=general</a></p><p>But shhh, that’s our little secret. Happy crafting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e4dec62692d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is your crypto wallet and strategy correctly diversified?]]></title>
            <link>https://medium.com/@the-crypto-craftsman/is-your-crypto-wallet-and-strategy-correctly-diversified-f0d8e7a30383?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0d8e7a30383</guid>
            <category><![CDATA[investment]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[binance]]></category>
            <category><![CDATA[trading]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Thu, 01 Dec 2022 10:59:26 GMT</pubDate>
            <atom:updated>2022-12-01T10:59:26.271Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Explaining and computing asset correlation</em></p><blockquote><em>Disclaimer: The information available in this article and all connected resource is for </em><strong><em>educational purposes only</em></strong><em>. Crypto trading engages your capital, and it will never be safe. Only ever invest what you are prepared to lose and do your own research.</em></blockquote><p>Let me ask you a question : how diversified is your crypto wallet right now ? If you are reading this, I believe that you are prepared, daresay <em>familiar</em> with the reality of one of your assets being very capable of losing half of its value overnight.</p><p>In order to palliate this eventuality, most serious crypto traders use the same strategy : <strong>diversification</strong>. You want to mitigate the risk of holding a single symbol by holding a variety of different ones, just in case another tweet from Elon Musk makes another LUNA incident. But is it sufficient ?</p><p>Last month has been quite a dim one for cryptocurrency trading. Bitcoin had a couple strong daily dips and in a month it was down -17.6%. Good thing you also had Ether, Ripple and Cardano right ? Well it seems it&#39;s not that simple. In the same month, ETH dropped -19.5% and ADA, -22.3%. XRP fell -13.6% and many others followed.</p><p>The reason is quite simple : your wallet cannot possibly be considered diversified if the prices of the crypto you hold are strongly <strong>correlated</strong> with one another. So let me ask again : Is your crypto wallet <em>really</em> diversified ?</p><h3>What is statistical correlation and how to compute it ?</h3><p><strong>Correlation</strong> — or <strong>mathematical dependence</strong> — is a measurement of the relationship between the evolution of two variables relative to a same third one. Applied to the stock market case, we can say that two prices are correlated if as time passes, their prices tend to evolve in the same way.</p><p>More specifically, we will have a look at the <strong>Sample correlation coefficient</strong> of our series. This is a very simple index between -1 and 1 that represents the codependency between two prices curves.</p><p>Here is the equation, if you are into formal math :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kj0cgSkptnGwvBRRAOuDQg.png" /></figure><p>As for the result, it is a lot simpler to interpret :</p><ul><li>If R(x, y) is close to 1, the series are very strongly correlated. They tend to increase together and decrease together. For instance, R([1,2,3], [2,4,6]) = 1</li><li>If R(x, y) is close to -1, the series are very strongly counter-correlated. Which means one tends to decrease when the other tends to increase and vice-versa. For instance, R([1,2,3], [3,2,1]) = -1.</li><li>If R(x, y) is close to 0, there is no strong correlation between those two series. They are independent of each other.</li></ul><p>Okay, that was way too much math. Let’s code it now :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e6026c590ed63065d629803fbe6bc6c/href">https://medium.com/media/4e6026c590ed63065d629803fbe6bc6c/href</a></iframe><p>I hope this is clearer than formal Math. This is mostly mental gymnastic for explanatory purposes we are doing right now, as you can obviously find <a href="https://www.npmjs.com/package/node-correlation">convenient NPM packages</a> to do the heavy lifting for you.</p><h3>Let’s apply this to crypto trading</h3><p>As we stated before, computing the correlation between two prices’ candles chart over is essential when trading in order to ensure that our strategy’s assets are correctly diversified.</p><p>To evaluate this, let’s quickly compute the correlation coefficient between each of the <a href="https://coinmarketcap.com/">top 10 cryptos on Coin Market Cap</a> using Binance’s XXX/USDT daily data over the last 1000 days, and the formula we just implemented :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54330a340a586ada8067f78fea1c8343/href">https://medium.com/media/54330a340a586ada8067f78fea1c8343/href</a></iframe><p>And here’s the result we got :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f43b18cdfdffc8b9e2ad25674736b7b0/href">https://medium.com/media/f43b18cdfdffc8b9e2ad25674736b7b0/href</a></iframe><p>Couple details first :</p><ul><li>The graph is symmetrical because R(x,y) = R(y,x)</li><li>There is a line of 1 in the diagonal because R(x,x) = 1. A serie is always perfectly correlated with itself.</li></ul><p>Then we can see that generally speaking, all currencies tend to correlate quite heavily with BTC prices. One way to look at this is that Bitcoin, being kind of the <em>reserve currency</em> of crypto, is the main reference in USD conversions. Another interpretation is that Bitcoin is a great indicator of the global crypto market health.</p><p>Now, we can also look at some specificities of the ETH line. While ETH does correlate very strongly with BTC, some altcoins tend to follow its price quite closely, while others not so much. For instance, if you are familiar with the technical details of MATIC and the polygon blockchain which is in essence built over the Ethereum chain, it should come at no surprises that ETH and MATIC share an even stronger coefficient than BTC and MATIC.</p><p>Please feel free to run this script at will with different values to assert of the diversification of your strategies, this is an important and often neglected part of having a healthy crypto wallet.</p><p>As an end word, I should also highlight that the vast majority of cryptocurrencies are kind of correlated one way or another. Crypto should never be your only investment, and diversifying also means having a look at entirely different kind of stocks and bonds.</p><p>Stay safe out there !</p><p><em>If you liked this article, you will find it and many others directly on </em><a href="https://thecryptocraftsman.com/"><em>The crypto craftsman blog</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0d8e7a30383" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The hidden secret behind Binance Dual Investment]]></title>
            <link>https://medium.com/@the-crypto-craftsman/the-hidden-secret-behind-binance-dual-investment-907a26be399d?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/907a26be399d</guid>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[staking]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[options]]></category>
            <category><![CDATA[binance]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Wed, 16 Nov 2022 11:11:00 GMT</pubDate>
            <atom:updated>2022-11-16T11:11:00.791Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Is it worth investing in?</em></p><blockquote><em>Disclaimer: The information available in this article and all connected resource is for </em><strong><em>educational purposes only</em></strong><em>. Crypto trading engages your capital, and it will never be safe. Only ever invest what you are prepared to lose and do your own research.</em></blockquote><p>Recently, I was researching material for this blog and I had a look at different staking options on binance.com: namely <em>Binance Earn</em>. While most of them are pretty basic liquidity providers and fixed/flexible deposit options, I did stumble into the “high yield” category, which redirected me to completely different financial products under the name “<strong>Binance Dual Investment</strong>”.</p><p>And believe me, there is a lot to say about those. Let’s get started.</p><h3>What is Binance dual investment</h3><p>First thing about Binance Dual Investment “earn” method is that… It should not be in “earn” at all. This is not only wrong, but also dangerously misleading. While Binance is fairly clear about the fact that your assets are definitely in danger, the type of financial product you are trading here is very different in nature and in concept from your average stacking investment portfolio.</p><p>Dual investment is actually <strong>stock-options trading</strong>. More specifically <em>short stock option selling</em>, or <strong>short-put</strong>. Let’s see how they work :</p><p>For the sake of simplicity, we will focus today on the different BTC/USDT options provided by Binance. This will apply with many other pairs and many other platforms.</p><p>There are two kinds of dual investment you can make, and both of them have a very, very (intentionally?) misleading name :</p><ul><li>Sell high, where you <em>allow Binance to buy your BTC at a given time in the future, below their value if their price exceeds a certain threshold</em>.</li><li>Buy low, where you <em>allow Binance to force you to buy their BTC at a given time in the future, above their value if it falls below a certain threshold</em>.</li></ul><p>While this seems like a loss-loss at first glance, you are being rewarded for taking this specific risk. Each option comes with an APR rate, which you will receive whatever the completion status of the option is at any given date. This is in essence the <strong>price for which you are selling the short put</strong>. By the way, it looks high, but it’s the yearly rate. You need to multiply it by (# of days : 365).</p><p>That was complex. I’m sure an example will make it a lot clearer :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JW9Vw3JEK5SRs7yM.png" /><figcaption><em>Return overview on Binance Dual Investment — BTC/USDT</em></figcaption></figure><p>In the first example, I Sell high - so I place a short put over BTC/USDT for 1 BTC, the 15 of November (as I write this) for the 18 of November (in 3 days) at a threshold of 17,000 USDT/BTC and an APR of 189.45%. This means that :</p><ul><li>If on November 18, the price of BTC is above 17,000, I&#39;ll have to sell my 1 BTC for 17,000 USDT.</li><li>Otherwise, I’ll get to keep my BTC. But its value might be lower than it is right now.</li><li>Whatever happens, I’ll gain interest for three days: 1 BTC * 189.45% * (3 / 365) ≈ 0.0155 BTC.</li></ul><p>And in the second example, I Buy low - so I place a short put over BTC/USDT for 1,000 USDT, the 15 of November (as I write this) for the 18 of November (in 3 days) at a threshold of 16,500 USDT/BTC and an APR of 135.44%. This means that :</p><ul><li>If on November 18, the price of BTC is above 16500, I’ll get to keep my USDT.</li><li>Otherwise, I’ll have to buy the equivalent of 1,000 USDT for 16,500 USDT/BTC.</li><li>Whatever happens, I’ll gain interest for three days : 1,000 USDT * 135.44% * (3 / 365) ≈ 11.1 USDT</li></ul><p>I hope it is clearer now. One big question subsists thought…</p><h3>When is it profitable ?</h3><p>Ready for some math?</p><p>The function returning the return expectancy of a short put option is easy to compute. We just need to evaluate the scenarios we just enumerated and input the correct parameters :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a2ff169cf50be746139cb7c36ec658e/href">https://medium.com/media/5a2ff169cf50be746139cb7c36ec658e/href</a></iframe><p>And here is the final result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/0*wDEGrTQOp53XGyv7.png" /></figure><p>Those of you who are already familiar with option trading will immediately recognize those very typical short put curves. Here is what we can read :</p><p>About the “sell high” option first (red curve) :</p><ul><li>If the final price is above 17,000, we will sell our BTC at this price and essentially cap our profits. We will make around +2% whatever the final price is.</li><li>If the final price is between 16,650 and 17,000, we will keep our BTC. In this range - thanks to the +1.55% APR/3d - we will still make a profit between 0% and 2%.</li><li>If the final price is below 16.650, the APR will not be enough to compensate our loss caused by the drop of BTC.</li></ul><p>Now about the “buy low” option selling (blue curve) :</p><ul><li>If the final price is above 16,500, we will keep our USDT. We will get our APR and make around +1.1% whatever the final price is.</li><li>If the final price is between 16,300 and 16,500, we will buy BTC at 16.500. In this range - thanks to the APR - we will still make a profit between 0% and 1.1%.</li><li>If the final price is below 16.300, the APR will not be enough to compensate our loss caused by the drop of BTC.</li></ul><p>In short, short put options are interesting when you think that the price will either raise, either stay stable. “Sell high” and “Buy low” are in essence the very same thing, depending on if you wish to purchase them in BTC or in USDT.</p><p>In addition to being profitable when the market is stable, short puts come with an embedded take profit and, in Binance’s case, no trading fees. Fantastic right? What’s the catch?</p><h3>Here’s the catch</h3><p>In short: big number probabilities. Given enough time, all stock will eventually have very bearish phases and the associated loss will make up for all the small wins.</p><p>It might have been obvious watching the curves above, but short puts are extremely dangerous because they are characterised with <strong>limited gains</strong> and <strong>unlimited losses</strong>. While your winning expectancy might be very positive thanks to the high APR, you must acknowledge at all time that <em>trading short put lets you take the risk of a strong dip without the expectancy of profiting from a strong raise</em>.</p><p>To put this into perspective with recent events, where BTC/USDT did show strong but not exceptional variations.</p><ul><li>If you had put a 3-day short put on November 7 at APR 150%, you would be down 22%.</li><li>If you immediately had put a 1-day short put on November 10 at APR 150%, the market recovered more than 10%, but you would only be up around 0.5%.</li></ul><p>In this kind of unstable bearish market, which are quite unpredictable and bound to happen often, short put trading is very clearly at a disadvantage. Please keep in mind that even if the market dips, you cannot opt out before the due date! You have to take the entirety of the dip.</p><p>It is a powerful tool if used right that can generate some recurrent revenue, but in absolutely no case a no-brain money-maker on the long run.</p><h3>Last words</h3><p>Binance knows what they are doing here. There is little chance that we can design an algorithm that will outsmart their own revenue calculator, and their APR risk/reward computation. The APR is basically an insurance fee they pay you in order to cover their long trading strategies from strong dips, and they know exactly its average cost.</p><p>Nonetheless, if you do show interest in this kind of content, I would be happy to research this in an upcoming article on this blog and see if there is some recognisable market phases where Binance Dual Investment is a good trading strategy.</p><p>Please let me know, and stay tuned!</p><p><em>If you liked this article, you will find it and many others directly on </em><a href="https://thecryptocraftsman.com/"><em>The crypto craftsman blog</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=907a26be399d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How good are TradingView’s aggregated technical analytics ?]]></title>
            <link>https://medium.com/trading-data-analysis/how-good-are-tradingviews-aggregated-technical-analytics-515cd0d9c2c4?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/515cd0d9c2c4</guid>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[tradingview]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[technical-analysis]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Thu, 10 Nov 2022 13:06:35 GMT</pubDate>
            <atom:updated>2022-11-11T14:36:22.241Z</atom:updated>
            <content:encoded><![CDATA[<h3>How good are TradingView’s aggregated technical analytics ?</h3><p><em>And how can we programmatically exploit them ?</em></p><blockquote><em>Disclaimer: The information available in this article and all connected resource is for </em><strong><em>educational purposes only</em></strong><em>. Crypto trading engages your capital, and it will never be safe. Only ever invest what you are prepared to lose and do your own research.</em></blockquote><h3>What are really TradingView Indicators ?</h3><p>If you have been hovering around the trading world for a while, you probably range from having heard of <a href="https://www.tradingview.com/">TradingView</a> a few times, to going there many times a day. TradingView is a hub that aims to provide traders with pricing data, visualisation tools, community ideas and — what we are looking at today — a very simplified <strong>technical analysis</strong> tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KM6fCrtHHwb48aeS.png" /><figcaption><a href="https://www.tradingview.com/symbols/ETHBTC/technicals/?exchange=BINANCE"><em>BINANCE:ETH/BTC 1day technical analytics on TradingView</em></a></figcaption></figure><p>Here we have three indicators, ranging from “strong sell” to “strong buy” :</p><ul><li><strong>Oscillators</strong> is an aggregate of outputs from many oscillators indicators, such as RSI, AD, AO, MACD, …</li><li><strong>Moving Averages</strong> is an aggregate of outputs from many momentum indicators, such as EMA, SMA, HMA, ICHIMOKU, …</li><li><strong>Summary</strong> is just a sum of the two previous ones.</li></ul><p>While those are extremely simple to understand and to use, any experienced trader will immediately see an issue with the way some analytics are used. For instance, there is more to SMA than simply looking at its absolute value at a set timing and deducting future price movement. Those aggregated indicators seem to be an oversimplified metric that is at best useless, and at worse dangerous.</p><p>We could theorize for literal hours about their performance, invoking pages and pages of math and definitions… Or we could just test them. Yeah, let’s do exactly that.</p><h3>Our data source</h3><p>What we need is an aggregated view of all crypto pairs on our exchange and their ratings. Actually, it does exist on TradingView, it’s called the <a href="https://www.tradingview.com/crypto-screener/">Crypto pairs screener</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/0*bZcqAgMhUxIEVCDj.png" /></figure><p><em>The TradingView Crypto pair screener</em></p><p>You can select your favorite columns (here, symbol price oscillators rating moving averages rating technical rating is very sufficient) and filter with your favorite exchange. Now, let&#39;s create a scrapper code to recover this data for all symbols, and for all time intervals.</p><blockquote><strong><em>About data scrapping</em></strong><em>: while it cannot technically be illegal, as it is just an efficient way to store data which is displayed legally on your screen, data scrapping is still against TradingView’s GCU. As a result, I will not provide here any information about how to programmatically extract the crypto pair screener’s data. Especially since some intervals I’ll extract are behind a paywall. Do your own research or contact me in private.</em></blockquote><p>Here is a sample of the data we extracted :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a32e92b929d62b0ba957b1388d2c8e4/href">https://medium.com/media/7a32e92b929d62b0ba957b1388d2c8e4/href</a></iframe><p>On any interval, the indicators’ values are represented by a number between -1 and 1. Get close to -1 and you are a Strong Sell, get close to 1 and you are a Strong Buy, get close to 0 and you are Neutral.</p><h3>Let’s test it !</h3><p>Now that we have an extract, let’s wait around half a day and compare it to the recent prices evolutions. More precisely, we will try to estimate which TradingView indicator is a better predictor of the percentage of success of a 3% OCO (more information about OCO and LEOCO in <a href="https://thecryptocraftsman.com/blog/5">this other article</a>).</p><p>Using Binance as a historical pricing data source, let’s code !</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a49dd6bd42aa5dce89401bb163e3e3a4/href">https://medium.com/media/a49dd6bd42aa5dce89401bb163e3e3a4/href</a></iframe><p>And here is the result:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/653ace629b806a63ae5a0ad53004e64f/href">https://medium.com/media/653ace629b806a63ae5a0ad53004e64f/href</a></iframe><p>We can see a few interesting metrics:</p><ul><li>There seem to be a very positive correlation between ma and OCO success rate, especially on middle to higher intervals.</li><li>There doesn’t seem to be any relevant correlation between os and success rate.</li><li>The all value being only a sum of the two previous ones, it is mostly driven by ma</li></ul><p>From this, we can create a new aggregated indicator for our OCO/LEOCO entries, defined by <strong>the sum of TradingView’s </strong><strong>ma values on each interval between 15 minutes and 1 week</strong>.</p><h3>Back-testing</h3><p>Now that we got our indicator, let’s compute its performance. Important note: we need to try it on <strong>another set of data</strong> — so using another TradingView data export from a different time.</p><p>Here is the back-testing code :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/abb70ae768fa2c6943873ef5b8b024cb/href">https://medium.com/media/abb70ae768fa2c6943873ef5b8b024cb/href</a></iframe><p>And the result :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8802a26500097078f4e9261ff7da2164/href">https://medium.com/media/8802a26500097078f4e9261ff7da2164/href</a></iframe><p>That is a clear win ! +15% clear gain in the 10 best scoring symbols over around 12 hours (data was collected on Nov 7th 2022 at 23:41 CET and script was run on Nov 8th 2022 at 12:25). As usual, one back-test is not quite enough to guarantee the quality of an indicator, but it is a good start. This script&#39;s setting is easily replicable for more data points.</p><h3>End words</h3><p>TradingView’s <strong>Moving Averages aggregated technical indicator</strong> is by no mean magical. You can see its exact composition in the description, and it is pretty much a sum of <a href="https://thecryptocraftsman.com/blog/7">simple and exponential moving averages</a> that you can easily replicate yourself in a much more controlled environment.</p><p>Also, please keep in mind that an analytic is never objectively <em>good</em> or <em>bad</em>. It is relevant or not in catching a certain type of signals that you are trying to predict. This article was only analyzing the relevance of TradingView’s aggregated indicators in the context of a +3%/-3% OCO on BINANCE:XXX_BTC trading pairs, and another point of view might lead to another conclusion.</p><p>Nonetheless, this analysis provides us with a testing pattern that we can use to attest of the efficiency of any <em>all in one</em> analytic that some technical advices websites are trying to promote. Please always tread carefully with those as they are computed in a black box environment and might be manipulated to impact the market in their creator’s favor. If you are going to use them, always double-check their composition and cross-validate their evolutions with another analytic.</p><p>Anyway, still better than trusting random signals from obscure telegram groups. Stay safe out there!</p><p><em>If you liked this article, you will find it and many others directly on </em><a href="https://thecryptocraftsman.com/"><em>The crypto craftsman blog</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=515cd0d9c2c4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trading-data-analysis/how-good-are-tradingviews-aggregated-technical-analytics-515cd0d9c2c4">How good are TradingView’s aggregated technical analytics ?</a> was originally published in <a href="https://medium.com/trading-data-analysis">Trading Data Analysis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding crypto trading order book and depth graphs data]]></title>
            <link>https://medium.com/trading-data-analysis/understanding-crypto-trading-order-book-and-depth-graphs-data-1bb2adc32976?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bb2adc32976</guid>
            <category><![CDATA[binance]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[order-book]]></category>
            <category><![CDATA[crypto]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Tue, 27 Sep 2022 09:44:57 GMT</pubDate>
            <atom:updated>2022-10-12T14:25:30.388Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>And exploiting them programmatically to make profits</em></h4><blockquote><em>Disclaimer: The information available in this article and all connected resource is for </em><strong><em>educational purposes only</em></strong><em>. Crypto trading engages your capital, and it will never be safe. Only ever invest what you are prepared to lose and do your own research.</em></blockquote><p>As I am sure you probably fully understand by now, crypto market prices are mainly changing following the effects and variations of <strong>offer and demand</strong>. When people buy, the price increases. When people sell, the price decreases. Simple enough, but also unpredictable. If we could anticipate offer and demand, we would also be able to anticipate price evolution and turn out a sure profit.</p><p>As it turns out, we can do partially that. Some offers and demand are already expressed as <strong>bids</strong> and <strong>asks</strong>, forming what is called an <strong>order book</strong> which is publicly available. While it is in no way a magical complete information provider, it is a reliable data source that we can and should use in our stock picking and crypto bot crafting journey.</p><p>In this article, we will have a look at what they are, and how to exploit them. And we will code — because that’s what we do.</p><h3>What are depth graphs</h3><p>For a given crypto trading pair and a given exchange, <strong>depth graphs</strong> represent the current cumulated volume of the <strong>order book</strong>. It is a visualisation of the quantity of bids and the quantity of asks for each aggregated price range on each side of the last close price of the crypto pair.</p><p>Let’s analyse one of those graphs. You can access this one directly on <a href="https://www.binance.com/en/trade/LDO_USDT">binance</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vnRBgplOcoBaQxz7NukIxw.png" /><figcaption><em>BINANCE:LDO/USDT — on SEPT 26 2022 at 16:25 CET</em></figcaption></figure><p>On the left, in green, you can see all the <strong>limit buy orders</strong> that are currently active on the LDO/USDT pair. We call those the <strong>bids</strong>. They are represented with this typical staircase shape because they are <em>cumulated</em> - which means that for any given price on the X axis, the Y axis will show the full volume of all the bids which are superior or equal to this value. Which makes a lot of sense : if you are ready to buy at 1.60, you are also definitively ready to buy at 1.58. That is why the total bid volume increases as the price decreases.</p><p>On the right, is red, same thing. Those are the <strong>cumulated limit sell orders</strong> currently active on LDO/USDT. We call those the <strong>asks</strong>. In the middle, 1.625 is the average price between the best bid 1.62 and the best ask 1.63.</p><p>You can place your mouse on the graph to read the exact cumulated volume of each price. On the previous example, you can see that the cumulated bid volume of 1.58 is 489.51K LDO, and the cumulated ask volume of 1.67 is 87.06K LDO.</p><p>You’ll notice that 1.58 and 1.67 are both equidistant from the middle price - 2.8% apart in each direction - but their cumulated volume is radically different. And trust me on this : <em>where there is an unbalance, there is an exploit</em>.</p><h3>How to exploit depth graphs data</h3><p>In the previous example, LDO/USDT, we saw that on a specific price interval the bid and the ask cumulated volume were radically different. By more than a factor 5, actually. Here is how we can interpret this information :</p><blockquote><em>If the order book doesn’t radically change in the next couple of hours, it will be five times harder for the price to drop 2.8% than to bump 2.8%. That also means that if the amount of market buys and market sells is balanced, the price will inevitably raise !</em></blockquote><p>So, couple precautions here. As limit orders can be opened and closed at any time, the order book is volatile. It is obviously not a sure-bet and there are many traps that you could easily fall into. Namely, <em>whale orders</em>, <em>order book manipulation</em> or <em>bot baiting</em>. This article will already be quite dense, so I will just advise you to exert caution for now, and I’ll get deeper into those subjects in another one.</p><p>Now, let’s refocus on how to profit from those as that is mainly why you are here I presume. The answer is one of my favorite custom tools : <a href="https://thecryptocraftsman.com/blog/5">LEOCO — Limit Entry One Cancel the Other</a>. Don’t hesitate to check out the article I wrote about those.</p><p>LEOCO allow us to choose an <strong>entry point</strong>, a <strong>stop loss</strong> and a <strong>take profit</strong>, then forget about this trade and move to another one. They sound complex but actually are very simple and hassle-free. Let’s see what we can do with the previous example :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bwv03Vrv51zCvrTgK_Mlrg.png" /><figcaption><em>LEOCO BINANCE:LDO/USDT — on SEPT 26 2022 at 16:25 CET</em></figcaption></figure><p>We will first choose a gap that shows a big difference of volume. 2.8% that was our previous example will do perfectly here. We will set the <em>stop loss</em> at avg price * (1 - 2.8%) = 1.58 and the <em>take profit</em> at avg price * (1 + 2.8%) = 1.67.</p><p>As for the entry limit price, it should be close to the average price. I do not recommend applying a simple market buy to this kind of trading, because the gap between the best <em>ask</em> and the best <em>bid</em> might be significant on pairs that offer such depth difference and opportunities. Also, the precision level of Binance’s depth graph does not always match the granularity of the exchange — in this case the depth works in E-2 and the rest of the exchange works in E-3. So a good entry point would be something close to the best <em>bid</em>, in this case let&#39;s say 1.621</p><ul><li>The expected return is :</li></ul><pre>Take profit / Entry limit - 1 - trading fees <br>= 1.67 / 1.621 - 1 - 0.00075 * 2 <br>= 0.0287 = 2.87%</pre><ul><li>The potential loss is :</li></ul><pre>Stop loss / Entry limit - 1 - trading fees <br>= 1.58 / 1.621 - 1 - 0.00075 * 2 <br>= -0.0268 = -2.68%</pre><p>It would be a dangerous oversimplification to assert that the chances of winning are really five time superior to chances of loosing. But depth graph analysis does increase significantly your odds of making the right pick.</p><p>Let’s leave the LEOCO running and check on the result at the end of this article… Suspense, suspense.</p><h3>Programmatically detect opportunities</h3><p>Now, if you are as enthusiastic as I am, you might want to jump in and check all exchanges one by one on Binance to detect depth gaps and opportunities. But I’m just way too lazy to do that manually. Let’s code something.</p><p>Binance’s API got a <a href="https://api.binance.com/api/v3/depth?symbol=LDOUSDT&amp;limit=10">REST endpoint</a> to recover the order book of any exchange. We are going to use this one for the sake of simplicity, but in a live environment I recommend using Binance’s Web sockets to not override the API quotas in a couple requests. /depth with a high limit is quite heavy.</p><p>So here is a simplified example to extract depth data and analysis from one crypto pair on Binance :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c2e5bb89494ae90c423917f071ac57f/href">https://medium.com/media/1c2e5bb89494ae90c423917f071ac57f/href</a></iframe><p>Let’s run it on Sept 26th at 6pm CET :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9209e4cb7bb4c18d033164fa0c130227/href">https://medium.com/media/9209e4cb7bb4c18d033164fa0c130227/href</a></iframe><p>Here is how to interpret this result. Example on index 2 :</p><blockquote><em>The aggregated bid volume for the price </em><em>1.644, which is </em><em>2% below the best (highest) bid price, is </em><em>520% or 5.2 times stronger than the ask volume for the price </em><em>1.58, which is </em><em>2% above the best (lowest) ask price.</em></blockquote><p>This imbalance seems to show that a LEOCO having as parameters an entry limit of 1.612, a stop loss of 1.58 and a take profit of 1.644 would have a positive gain expectancy. We can take a limited risk and bet on this to expect a positive short term return of a bit more than 2%.</p><p>By the way, analysing the order book programmatically actually offers a better precision than watching the price graph on Binance. The order book’s precision of the /depth endpoint is E-3. One more point for the bot here.</p><p>The only drawback here is that Binance — as most brokers — does not provide historical order book data. It is a heavy limitation as it reduces our ability as bot craftsmen to use <a href="https://thecryptocraftsman.com/blog/2">historical analysis</a> and test our strategy on a large amount of data. To solve this issue I coded myself a <em>live LEOCO simulator</em> that I’ll be happy to share with you in an upcoming article. Stay tuned !</p><p>Oh, and remember the LCO/USDT trade in this article ? It&#39;s a win.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4yNfN3R_UNj1J6Vex-6Ag.png" /><figcaption><em>BINANCE:LDO/USDT:15m — from Sept 26 2022 4pm to Sept 27 2022 5am CET</em></figcaption></figure><p><em>If you liked this article, you will find it and many others directly on </em><a href="https://thecryptocraftsman.com/"><em>The crypto craftsman blog</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bb2adc32976" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trading-data-analysis/understanding-crypto-trading-order-book-and-depth-graphs-data-1bb2adc32976">Understanding crypto trading order book and depth graphs data</a> was originally published in <a href="https://medium.com/trading-data-analysis">Trading Data Analysis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ΔSMA long trading : a very simple, but high-return strategy]]></title>
            <link>https://medium.com/@the-crypto-craftsman/%CE%B4sma-long-trading-a-very-simple-but-high-return-strategy-8a835a7ee741?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a835a7ee741</guid>
            <category><![CDATA[binance]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[bots]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Thu, 22 Sep 2022 12:05:07 GMT</pubDate>
            <atom:updated>2022-09-22T12:05:07.215Z</atom:updated>
            <content:encoded><![CDATA[<h3>ΔSMA long trading : a very simple, but high-return strategy</h3><p><em>What you should always do instead of holding !</em></p><blockquote><em>Disclaimer: The information available in this article and all connected resource is for </em><strong><em>educational purposes only</em></strong><em>. Crypto trading engages your capital, and it will never be safe. Only ever invest what you are prepared to lose and do your own research.</em></blockquote><p>If you are reading this blog, there is a chance that a part of your investment portfolio is dedicated to holding — which is the act of keeping a few volatile cryptocurrencies in your wallet for the long run and expecting their value to increase.</p><p>This is not a bad idea, but it is also far from optimal. In this article, we will have a look at the very first bot I implemented, and one that you should definitely consider implementing instead of just holding your cryptos.</p><h3>The SMA and ΔSMA analytics</h3><p>Crypto trading strategies can get complex. Very complex. It is quite easy to get distracted by new and exciting methods, and forget that sometimes the simplest code can actually yield the best results.</p><p>We will only use one analytic : the <strong>Simple moving average — SMA</strong>. It is both simple to compute and extremely powerful if used right. There is going to be a little bit of math but bear with me, it ends up being simple I promise.</p><p>On a period P, the SMA of any given price is equal to 1/P * ∑(p last close). The SMA is the <strong>Average close price over the last P candles</strong>. As an example, the hourly SMA P30 of BTC/USDT will be the sum of the last 30 hourly candles closing price, divided by 30. Simple right ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/0*XdBjVbwlyV5By2Ho.png" /><figcaption><em>SMA of period 20 (yellow), 50 (pink) and 100 (red)</em></figcaption></figure><p>One way to look at SMA is the <em>average price over a period</em>, but another way is a <a href="https://en.wikipedia.org/wiki/Local_regression">local regression</a>. We “smooth” the price curve in a way that ignores small local price variations and only reflect the big picture. That will be very useful for the next step.</p><p>From the SMA, we can calculate the <strong>ΔSMA</strong> (delta — SMA). In any given time t, ΔSMA corresponds to the derivative of the SMA curve. In other terms, how fast is the SMA increasing or decreasing. We can calculate simply ΔSMA(t) = SMA(t) / SMA(t-1) - 1.</p><p>This new analytic is very simple to read :</p><ul><li>If ΔSMA is <em>positive</em>, SMA <em>increases</em> and the price is in a <em>bullish</em> phase.</li><li>If ΔSMA is <em>negative</em>, SMA <em>decreases</em> and the price is in a <em>bearish</em> phase.</li></ul><p>While it is efficient to read big scale trends, it’s important to note that ΔSMA is always <em>slightly late</em> in reading a variation. The higher the period, the later the analytic is going to react to a new shift in trend. However, the lower the period is, the more likely it is that the ΔSMA will react to false trends (bear traps/bull traps).</p><p>Here is a very basic ΔSMA calculation function :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97ebe353eaa366fd8088cbc6e0ee2aa6/href">https://medium.com/media/97ebe353eaa366fd8088cbc6e0ee2aa6/href</a></iframe><p>As always, tread with caution and abuse of <a href="https://thecryptocraftsman.com/blog/2">historical analysis</a>.</p><h3>Implementation</h3><p>In order to assert of the quality of our ΔSMA based strategy, we will conduct a simple historical analysis on some high-volume XXX/USDT crypto pairs on Binance, such as BTC/USDT or ETH/USDT. The main goal of this analysis is not only to assert of their rentability on various timeframes, but also to compare the revenue of ΔSMA strategies versus coin holding on the same periods.</p><p>Here is the simulation code — feel free to skip straight to the result if you want.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c37c660c4458830cfd3a0c32a77a02a/href">https://medium.com/media/6c37c660c4458830cfd3a0c32a77a02a/href</a></iframe><p>And here is the result of a run on Tue, 20 Sep 2022 :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d5c0c40707cd69b6c0536e2ebe7cf38/href">https://medium.com/media/4d5c0c40707cd69b6c0536e2ebe7cf38/href</a></iframe><p>During those 100 days, Bitcoin fell -15.87% from 22487.41 to 18992.34 (at 4:45pm CET). During the exact same schedule, a ΔSMA bot with a period of 30 days executed a total of 3 transactions - +0.5%, +9.1% and -6.5% for a total of +2.54%. This increase might seem quite small, but if you compare it to holding it is a difference of <strong>more than 18% gain!</strong></p><p>Here is a visual representation of the transactions operated, along with the SMA30 curve :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GOGSuB-QdBTgkztR.png" /><figcaption><em>BINANCE:BTC/USDT:1d — from July 16 to August 26, 2022</em></figcaption></figure><p>The first position here illustrates a false positive sell signal. The entry was good though, and we end up with a small benefit.</p><ul><li>The second position show optimal entry and exit.</li><li>The third entry illustrates a false positive. Because the period or the lag were too little, the bot fell for a bear trap. It sold instantly after it entered it though.</li><li>Outside this screenshot, BTC/USDT was mostly bearish, the SMA was decreasing, and the bot did not make any transaction. Sparing us of a 15% dip.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5TN422H7Qx61m5mQ.png" /><figcaption><em>BINANCE:BTC/USDT:1d — from June 13 to September 20, 2022</em></figcaption></figure><p>Note : if we had started one day earlier, the difference would have been even stronger. The price is dipping, but the SMA stays descending and the ΔSMA is negative. The 101-days gain difference between ΔSMA and holding is +29.87%, the 102-days one is +34.54% and the 103-days one is +35.91%.</p><p>Quite interesting, isn’t it?</p><h3>How good is this ΔSMA strategy really ?</h3><p>While not perfect, our ΔSMA strategy seems to hop in bullish trends and hop off bearish trends. Now, let’s try to assert if it can consistently overcome the market by comparing its performance on many length and different symbols. We will keep the other parameters steady (period, lag, …)</p><p>Let’s try on a handful of high-volume XXX/USDT crypto pairs and the last 100, 300 and 900 days for each one of them.</p><p>Here is our result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CwcBBpZidYH_SVWLMR9lbQ.png" /></figure><p>Feel free to play with the simulator inputting different time lapses and different symbols, you might consistently get close to those results.</p><p>As it is a <a href="https://thecryptocraftsman.com/blog/3">momentum strategy</a>, this ΔSMA strategy is :</p><ul><li>Weak in horizontal markets, if wrongly configured it might buy at the top resistance and sell at the bottom one.</li><li>Strong in bullish markets. It will be slightly less performant than holding, but will automatically hop in and off at reasonable signals.</li><li>Neutral in bearish markets. It will edge its losses and mostly not take a position at all. On future markets, this algorithm can be cumulated with a reverse one that will short stocks when ΔSMA is negative (more on that in a later article?)</li></ul><p>That being said, any crypto market is mostly ups and downs. The ability to consistently take the ups and not the downs is enough to make a profit in most situations on the long run.</p><blockquote><strong><em>ΔSMA</em></strong><em> almost always beats holding on long intervals of time — and as it is so easy to understand and to code, there is virtually no reason not to implement it when playing long term on your crypto wallet.</em></blockquote><p>So… Yeah. You should maybe consider it.</p><p><em>If you liked this article, you will find it and many others directly on </em><a href="https://thecryptocraftsman.com/"><em>The crypto craftsman blog</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a835a7ee741" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How good really is Candlestick Pattern Analysis?]]></title>
            <link>https://medium.com/@the-crypto-craftsman/how-good-really-is-candlestick-pattern-analysis-d4a34b3d3188?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4a34b3d3188</guid>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[binance]]></category>
            <category><![CDATA[candlesticks]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[trading]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Mon, 12 Sep 2022 09:28:05 GMT</pubDate>
            <atom:updated>2022-09-12T09:28:05.589Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Answering with code and math</em></p><blockquote><em>Disclaimer: The information available in this article and all connected resource is for </em><strong><em>educational purposes only</em></strong><em>. Crypto trading engages your capital, and it will never be safe. Only ever invest what you are prepared to lose and do your own research.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*pT2A2ockwgO566-T0yCueQ.png" /></figure><h3>What are Candlestick Patterns?</h3><p>Have you ever heard of <a href="https://www.investopedia.com/terms/e/eveningstar.asp">bearish evening star</a>, <a href="https://thecryptocraftsman.com/content/investopedia.com/terms/b/bullishharami.asp">bullish harami</a> or <a href="https://www.investopedia.com/terms/f/falling-three-methods.asp">bearish falling three</a>? Maybe are you even using them yourself for your day trading strategies?</p><p>Behind those romantic name lie <strong>candlestick patterns</strong>. They are names given to specific recognisable dispositions of price candles that are classified as <em>bullish</em> or <em>bearish</em>, and are supposed to give indications about potential price evolution in the short term.</p><p>I met many traders heavily taking them into consideration when picking stocks, entry and exit points. In this article we will do a <a href="https://thecryptocraftsman.com/blog/2">historical analysis</a> to measure their actual performance and reliability.</p><h3>Our methodology</h3><p>While there are potentially hundreds of candlestick patterns out there, we will focus on all the ones available on the NPM package <a href="https://www.npmjs.com/package/technicalindicators"><em>technicalindicators</em></a>. Most of them are quite renowned and got their own dedicated Investopedia article.</p><p>As for measuring their performance, we will focus on evaluating their efficiency in what they are usually used for : predicting a bullish or bearish short term trend in the market. Our metric will be <em>the chance of winning or losing an OCO of 1%, 2%, 3%, 4% and 5% within 6 hours</em>.</p><p>Now, instead of just evaluating gains objectively, we will actually calculate the <a href="https://en.wikipedia.org/wiki/Financial_correlation">correlation</a> between candles matching one of those patterns, and candles with an OCO completion rate. The higher it is, the more it means that a candlestick pattern is a good indicator of performance. I will use <a href="https://www.npmjs.com/package/node-correlation">this NPM package</a> to do the math.</p><p>Last, pricing data. I’ll use the Binance API to extract various XXX/USDT 1h candle charts from 10 high/volume crypto such as BTC and ETH.</p><h3>Let’s code</h3><p>Let’s implement our correlation tester. I won’t detail this part more than necessary — if you do trust me with the implementation, you can skip the code and go straight to the result and interpretation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb56c6c8ef92b8f09b85ca9a1f9744df/href">https://medium.com/media/fb56c6c8ef92b8f09b85ca9a1f9744df/href</a></iframe><h3>Results and insights</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6092a86fa90d25891ea9787295401d40/href">https://medium.com/media/6092a86fa90d25891ea9787295401d40/href</a></iframe><p>In the context of an OCO strategy, we are mostly looking for a bullish indicator that would provide a strong difference between bullish result and bearish result over the same percentage gap — bonus point if it is paired with a bearish indicator with the opposite effect that we can look out to for additional precision.</p><p>Straight away, there are a few really great insights we can extract from this:</p><p>First, none of those gaps can be considered significant. Some indicators light the <strong>bullish/bearish marubozu</strong> are lightly correlated with bullish/bearish result, but it never exceeds a couple percent. We would need to do some in-depth historical analysis to assert of their relevance for any strategy, and it is very likely that it won’t be of any significant use on its own. It might provide some confirmation if paired with another analytic.</p><p>Then, most of those patterns range from neutral to even counter-effective. The <strong>three white soldiers / three black crows</strong> pair, traditionally interpreted as bearish/bullish, is a perfect example. The bearish index is actually a better predictor of bullish outcomes than the bullish one.</p><p>Now, please take this analysis with a grain of salt. There are dozens and dozens of candlestick patterns that you can use, and each of them provide different information that might be of use in your bot crafting journey. My point is mostly that you should not take a bullish indicator face value, as it is not simply a reliable precursor of a bullish trend.</p><p>And I intend to prove my point further by answering the following question:</p><h3>And what if we used them all at the same time?</h3><p>That’s a good idea, let’s do it. Luckily, our <em>technicalindicators</em> NPM package already includes this feature. We can use very simply indicators.bullish and indicators.bearish, and add them to our pattern list.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea3e3695a55b54cbd12edb4990db62d0/href">https://medium.com/media/ea3e3695a55b54cbd12edb4990db62d0/href</a></iframe><p>As you can see, I am afraid it just does not work. There is no usable correlation difference between bullish and bearish aggregated indicators that allows us to anticipate the result of any OCO on the dataset’s prices.</p><h3>Next steps</h3><p>Now that we have a framework for quickly judging of the efficiency of any analytic, with any evaluation criteria and any data set, there are a few directions we could take.</p><ul><li>Focus on one of the most performant analytic we could find for our strategy, and do further research to attest of its efficiency.</li><li>Adapt the analytics to our strategy, and look for other information treatment that correlate with our target.</li><li>Adapt our evaluation criteria to match the insights provided by an analytic. Something that is heavily correlated with OCO might have a negligible impact on grid trading.</li><li>Adapt our data set. Here again, some analytics and candlestick patterns will work better within some specific market conditions.</li></ul><p>Ultimately, always remember that any analytic is in fact, just an analytic. It does not hold actual information on future prices, but can merely attest of a historical correlation.</p><p><em>If you liked this article, you will find it and many others directly on </em><a href="https://thecryptocraftsman.com/"><em>The crypto craftsman blog</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4a34b3d3188" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OCO and LEOCO trading — the safest and most efficient semi-automatic trading strategy]]></title>
            <link>https://medium.com/@the-crypto-craftsman/oco-and-leoco-trading-the-safest-and-most-efficient-semi-automatic-trading-strategy-d44c19c23808?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d44c19c23808</guid>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[binance]]></category>
            <category><![CDATA[leoco]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[bots]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Mon, 05 Sep 2022 11:30:30 GMT</pubDate>
            <atom:updated>2022-09-05T11:30:30.632Z</atom:updated>
            <content:encoded><![CDATA[<h3>OCO and LEOCO trading — the safest and most efficient semi-automatic trading strategy</h3><p><em>Introducing OCO and LEOCO trading — you might never trade manually again</em></p><blockquote><em>Disclaimer: The information available in this article and all connected resource is for </em><strong><em>educational purposes only</em></strong><em>. Crypto trading engages your capital, and it will never be safe. Only ever invest what you are prepared to lose and do your own research.</em></blockquote><h3>What is OCO trading ?</h3><p>OCO trading, or <em>“One Cancels the Other”</em>, is a method of trading cryptocurrencies which is very adapted to converting bullish insights into a safe and no-worry order. The idea is to buy an asset at market price, and to place at the same time a <strong>Take Profit</strong> and a <strong>Stop Loss</strong>. Making a price sandwich if you like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l0caY-nNcX3JK6WU.png" /><figcaption><em>OCO explanation graph from Binance.com</em></figcaption></figure><ul><li>If the price raises above the take profit, a sell order will be triggered — thus making a predictable profit</li><li>If the price falls below the stop loss, a safety sell order will be triggered, cancelling the previous take profit and making a predictable loss.</li><li>If the price stays within the interval, you can either wait for it to evolve or cancel the OCO at any time.</li></ul><p>This trading strategy has many perks, but the most important one by far in my opinion is <strong>peace of mind</strong>. Once your OCO is set up, there is no reason to obsess over reading the chart every hour of the day, FOMO (fear of missing out) and panic sell are not a thing here.</p><p>OCO’s <strong>fire and forget</strong> approach allows you to make a time-boxed decision and wait for the result without having to monitor anything.</p><h3>An example of OCO trading</h3><p>As I’m writing those lines, Binance places the pair XMR/BTC at 0.007357. Let&#39;s pretend that I believe that the chart is bullish, I could choose to :</p><ul><li>Buy XMR at market price — 0.007357</li><li>Place a take profit at +5% - 0.007730</li><li>Place a stop loss at -5% - 0.006990</li></ul><p>In essence, this OCO represents this position :</p><ul><li>I believe that the price of XMR/BTC will increase 5% in the next hours, before it decreases of 5%</li><li>If I am right, I’ll make a profit of 5% minus trading fees (0.075% * 2)</li><li>If I am wrong, I’ll limit my losses to 5% plus trading fees</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*WoAUwbqvlj-pl4Jh.png" /><figcaption><em>BINANCE:XMR/BTC:1h — On August 29, 2022</em></figcaption></figure><h3>How to OCO trade on Binance</h3><p>Quite easily using their interface. Here is how to do the example OCO we just studied.</p><p>First go to Binance spot XMR/BTC pair (<a href="https://www.binance.com/en/trade/XMR_BTC?theme=dark&amp;type=spot">here</a>) and purchase some XMR at market price. Then go to &quot;OCO&quot;, under &quot;stop limit&quot;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/0*MogvzYT5FitLMyx4.png" /><figcaption><em>Placing a +5/-5 OCO order on Binance:XMR/BTC</em></figcaption></figure><p>We are limiting our scope to SELL OCO today, so we will only look at the right column.</p><ul><li>Price: this is your Take Profit. buy price * (1 + 5%) = 0.007357 * 1.05 = 0.007730</li><li>Stop: this is your Stop Loss. buy price * (1 - 5%) = 0.007357 * 0.95 = 0.006990</li><li>Limit: this is also your stop loss. This is how Binance works: if the <em>Stop</em> value is reached, Binance will cancel the <em>Take Profit</em> and create a <em>Limit sell</em> on the <em>Limit</em> value. You always want to have it slightly lower than your Stop input to make sure it is triggered in the event of a sharp drop of the price</li><li>Amount: The amount of XMR you wish to sell</li><li>Total: The revenue in BTC if the take profit is hit</li></ul><p><a href="https://www.binance.com/en/support/faq/360032605831">More information on Binance help</a></p><h3>Going further with trading bots</h3><p>If you know me, you know I won’t limit myself at what Binance’s trading interface offers. It is possible to create an OCO order directly from Binance REST API, and this is made very easy for instance by the <a href="https://www.npmjs.com/package/binance-api-node#orderoco">binance-api-node NPM package</a>.</p><p>Using a bot to create your OCO orders has two major benefits:</p><ul><li>You can use any analytics and automated metrics to completely skip the part where you manually choose when to buy and where to set your limits. We will develop this a lot in upcoming articles as we discuss analytics and trading strategies.</li><li>If you do identify a potential resistance which is lower than the current price, you can do what I like to call a <strong>“LEOCO” — Limit Entry OCO</strong></li></ul><p>LEOCO orders are very simple to understand and to set up, but Binance does provide this feature in its interface. You need to code it. Very simply put, a LEOCO can be described as a limit entry price + an OCO, such as if the limit entry price is reached, a position will be entered and an OCO will be setup.</p><p>Considering our previous example, it might be a good idea to instead of entering at market price 0.007357, wait for the price to reach a resistance around 0.007000 and thus - if it is hit - increasing our potential return by around 1%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/0*Pdo6MPuUMffpqxsp.png" /><figcaption><em>BINANCE:XMR/BTC:1h — LEOCO vs OCO</em></figcaption></figure><p>In this example, I kind of lucked out hitting the bottom with this 0.007 guess. I choose it by having a look at <strong>depth data</strong> which I will elaborate in another article. But please note that:</p><ul><li>If this value had not been hit, no order would have been passed and my net loss would be zero</li><li>If this value had be passed by a lot, buying at 0.007 is still better than 0.007357 and this LEOCO is still preferable to a basic OCO by one percent.</li></ul><p>In short, there is absolutely no reason not to go for LEOCO when trading OCO unless you are absolutely sure that the local dip has been reached for your symbol.</p><h3>Let’s code a LEOCO</h3><p>We are obviously not about to wait in front of our screen 24/7 watching the graph and waiting for the perfect entry point. We are going to code.</p><p>Ready to get our hands dirty ? Here’s a very simple LEOCO waiting script on Binance API</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4bf3ac3d62b7794f62a38c2c1673dc6/href">https://medium.com/media/c4bf3ac3d62b7794f62a38c2c1673dc6/href</a></iframe><p>Hard to think of anything more simple right? At this point there are in my humble opinion no reason to <em>not</em> use this when trading OCO.</p><p>This script assumes that you have already manually opened a limit order on XMR/BTC with an entry point of your choice and a volume of at least 10 XMR unconcerned by any active order. At each run it will check if it was executed by looking at the available XMR on your account. If it is at least 10, the script will trigger an OCO.</p><p>Because they use limit orders and only concern one asset at the time, LEOCO orders can safely be stacked, scaled and cancelled at any time. And because they are always equipped with take profits and stop losses, they have predictable incomes and capped losses. Those assets make LEOCO very efficient in converting your insights and <a href="https://thecryptocraftsman.com/blog/4">graph reading skills</a> into no-stress and efficient positions. As a bonus, their low code complexity make them an excellent starting point in your crypto bot crafting journey.</p><p><em>Edit</em>: Oh! By the way, the LEOCO in this example was a win for me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aRze04vkr14G24IC.png" /><figcaption><em>BINANCE:XMR/BTC:1h — On September 4th, 2022</em></figcaption></figure><p><em>If you liked this article, you will find it and many others directly on </em><a href="https://thecryptocraftsman.com/"><em>The crypto craftsman blog</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d44c19c23808" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CandleGuessr : how good are you really at reading price graphs?]]></title>
            <link>https://medium.com/@the-crypto-craftsman/candleguessr-how-good-are-you-really-at-reading-price-graphs-39bdec67dcb?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/39bdec67dcb</guid>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[binance]]></category>
            <category><![CDATA[charts]]></category>
            <category><![CDATA[crypto]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Tue, 30 Aug 2022 09:25:23 GMT</pubDate>
            <atom:updated>2022-09-05T11:27:09.306Z</atom:updated>
            <content:encoded><![CDATA[<h3>CandleGuessr : how good are you really at reading price graphs?</h3><p><em>Introducing </em><a href="https://candleguessr.herokuapp.com/"><em>CandleGuessr</em></a><em>, an educative game to challenge and train your chart reading skills</em></p><blockquote><em>Disclaimer: The information available in this article and all connected resource is for </em><strong><em>educational purposes only</em></strong><em>. Crypto trading engages your capital, and it will never be safe. Only ever invest what you are prepared to lose and do your own research.</em></blockquote><h3>About chart reading</h3><p>One of the most common criticism you will face as a crypto trading bot craftsman is <em>“A bot will never be as smart as the human who made it”</em>. While I could start by arguing that it does not have to be, and 24/7 availability is already a strong enough argument to never do anything manually ever again, I would also agree that having good insights about pricing data is a very good starting point in elaborating a winning strategy.</p><p>Like any skill, graph reading can be trained via <strong>mindful repetition</strong> with a <strong>clear and instant feedback</strong>. In short, you will improve if you try carefully reading prices and picking stocks again and again, and if you see the measurable consequences of your actions as fast and clearly as possible.</p><p>For that purpose, I created <a href="https://candleguessr.herokuapp.com/">CandleGuessr</a> ! CandleGuessr is an educative game challenging its players to read real historical crypto graphs and quickly simulate placing an <strong>OCO</strong> (“One Cancels the Other” — a stop loss + a take profit) and instantly seeing the results.</p><p>CandleGuessr is 100% free and <a href="https://github.com/NoctalIvan/candleguessr">open source</a>.</p><h3>How does it work</h3><p>Just go on <a href="https://candleguessr.herokuapp.com/">https://candleguessr.herokuapp.com</a> and click on the “start” button to get started right away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T_UvQ9DrWzP4pmm7.png" /><figcaption><em>Playing 0.9–0.99 on a bullish-looking graph on CandleGuessr</em></figcaption></figure><p>Here is an explanation of what you can see on the gaming interface :</p><ul><li>The candles correspond any past 30 hours of a randomly chosen XXX/USDT crypto pair on Binance. All prices are divided by the first candle&#39;s open price, so you only see relative values compared to day zero.</li><li>You can see the last close, that is your potential <strong>buy price</strong> (0.9614). The goal is to set a <strong>take profit</strong> (0.99), the green horizontal dashed line on the graph, and a <strong>stop loss</strong> (0.90) for the incoming 24 hours.</li><li>If the stop loss is hit before the take profit, you will lose (here, -6.39%)</li><li>If the take profit is hit before the stop loss, you will win (here, +2.97%)</li><li>If none of them is hit, the algorithm will sell at closing price, which will be somewhere between those two values</li></ul><p>Let’s then click on “Check result” to see if my prediction was correct. Alternatively, if you don’t want to play on this graph you can hit “Skip” to get to the next one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dOVe5RCi9VaxzJ9M.png" /><figcaption><em>It’s a win ! The take profit hits and we get 3%</em></figcaption></figure><p>And we win ! After only 7 hours, the price rises as high as 1.04, passing the 0.99 take profit and making us a profit of 3%. We can then hit &quot;Next chart&quot; to continue to the next round.</p><p>Here are two more examples of potential losses and ties :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Arf7SqNAsMGpMaJe.png" /><figcaption><em>It’s a loss ! The stop loss hits and we lose 3%</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*74bf6ZJ8CtNjznwc.png" /><figcaption><em>It’s a tie ! The price did not hit the stop loss nor the take profit. We end up with a price differential of -1.14%</em></figcaption></figure><h4>Applicability to the real market — OCO trading</h4><p>Technically speaking, if you were to open any hourly pair candle chart on binance at any time, you would be in a situation which is very similar to the one provided with this game. You could buy at market price, set a stop loss and a take profit, and hopefully make a profit in the following few hours. So any skill you learn playing can be directly transferred into actual trading with OCO limits.</p><p>OCO is a great way to do manual trading as it provides a limited and predictable risk, and a <strong>fire and forget</strong> approach — you can set up your position once, and then stop monitoring it until it is done. In my humble opinion, peace of mind is one of the most undervalued criteria that you do need to factor in your trading strategies.</p><p>I will be delighted to talk more about OCO strategies in my next article, about their perks and how they can blend in with trading bots and self-computed analytics. In the meantime, have fun with <a href="https://candleguessr.herokuapp.com/">CandleGuessr</a> !</p><p><em>If you liked this article, you will find it and many others directly on </em><a href="https://thecryptocraftsman.com/"><em>The crypto craftsman blog</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39bdec67dcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Position trading vs Swing trading]]></title>
            <link>https://medium.com/@the-crypto-craftsman/position-trading-vs-swing-trading-55b19b8be453?source=rss-ec172928addd------2</link>
            <guid isPermaLink="false">https://medium.com/p/55b19b8be453</guid>
            <category><![CDATA[software-craftsmanship]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[binance]]></category>
            <category><![CDATA[bots]]></category>
            <dc:creator><![CDATA[The crypto craftsman]]></dc:creator>
            <pubDate>Wed, 17 Aug 2022 21:13:49 GMT</pubDate>
            <atom:updated>2022-08-17T21:13:49.722Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Should you trust momentum or mean reversal? A comparative analysis.</em></p><blockquote><em>Disclaimer: The information available in this article and all connected resource is for </em><strong><em>educational purposes only</em></strong><em>. Crypto trading engages your capital, and it will never be safe. Only ever invest what you are prepared to lose and do your own research.</em></blockquote><p>The goal of any trading strategy — at least on spot trading — is to buy low and sell high. Although this is undeniably true for both position trading and swing trading, both will have a very opposed and sometimes contradictory way to pick stocks, entry points and exits.</p><h3>Momentum trading</h3><blockquote><em>“If there’s a large move on significant news, either favorable or unfavorable, the stock will usually continue to move in that direction.” — Richard Driehaus</em></blockquote><p>Simply put, <strong>the most probable outcome in the near future of any market is always a continuation of the trend it has been following so far</strong>. Bullish pairs tend to go up and bearish pairs tend to go down.</p><p>Momentum trading, also called trend trading or long trading aims to target the fastest growing pairs, enter with a long position, and exit later when the momentum starts to decrease or to reverse, hopefully with a profit.</p><p>A simple example of a momentum algorithm would be to have a look on ΔSMA(50), the derivative of the Simple Moving Average computed over the 50 last candles. If it is sensibly high, the price is increasing. If it is negative or sensibly low, the price is decreasing. Let&#39;s try a strategy like this :</p><ul><li>BUY IF <strong>ΔSMA(50) &gt; 0</strong></li><li>SELL IF <strong>ΔSMA(50) &lt; 0</strong></li></ul><p>Easy enough right? Here is a JavaScript implementation — you can find the entire back-testing JavaScript file <a href="https://gist.github.com/NoctalIvan/90958baebdefe9313357a2731d6d90ca">here</a> and learn more about back testing in <a href="http://localhost:8080/blog/2">this dedicated article</a>.</p><pre>const sma = supPrices.slice(-50).map(x =&gt; +x.close).reduce((a, b) =&gt; a + b, 0) / 50</pre><pre>const prevSma = supPrices.slice(-51, -1).map(x =&gt; +x.close).reduce((a, b) =&gt; a + b, 0) / 50</pre><pre>const deltaSma = sma / prevSma - 1<br>const shouldBuy = deltaSma &gt; 0<br>const shouldSell = deltaSma &lt; 0</pre><p>And here is the result of a run over 1000 hourly candles of Binance BTC/USDT symbol on August 2nd, 2022 at 20:45 CET.</p><pre>start simulation on Fri, 24 Jun 2022 05:59:59 GMT</pre><pre>[...]</pre><pre>BUY @22554.45000000 - Wed, 27 Jul 2022 18:59:59 GMT<br>SELL @23920.65000000 - Sat, 30 Jul 2022 19:59:59 GMT<br>- gain: 0.05907341234213207</pre><pre>[...]</pre><pre>End of simulation on Tue, 02 Aug 2022 18:59:59 GMT<br>┌──────────────────┬──────────────────────┐<br>│     (index)      │        Values        │<br>├──────────────────┼──────────────────────┤<br>│      trades      │          25          │<br>│    totalGain     │ 0.17720271236391089  │<br>│   averageGain    │ 0.007088108494556436 │<br>│   elapsedTime    │  39.583333333333336  │<br>│ averageDailyGain │ 0.004476700101825117 │<br>└──────────────────┴──────────────────────┘</pre><p>The complete result file can be found <a href="https://gist.github.com/NoctalIvan/5181a380a4b2c098fd8edebbaf090b72">here</a>.</p><p>The bot operated 25 trades in ~41 days with an average net revenue of 0.7% and a total revenue of 17.72%. Or 13.41% per month. Here is as an example an illustration of one of trades that was executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AGNuIRFGKFEmwaPfKNXFCg.png" /><figcaption><em>BINANCE:BTC/USDT:1h — from July 27, 2022 20:00 UTC to August 01, 2022 21:00 UTC</em></figcaption></figure><ul><li>Bought at 22554.45 on 2022/07/27 and sold at 23920.65 on 2022/07/30</li><li>6.06% profit, 5.91% after trading fees</li></ul><h3>Swing trading</h3><blockquote><em>“A correction is a wonderful opportunity to buy your favorite companies at a bargain price.” — Peter Lynch</em></blockquote><p>Swing trading operates by doing exactly the opposite as momentum trading. It works by picking stocks that are especially low compared to their recent price and counts on making a profit during an upward correction. While seemingly more risky, swing trading excels in horizontal markets and can actually output some benefits even in bearish markets.</p><p>A simple example of a swing algorithm would be to have a look on rel-SMA(50), the relative distance between the last closing price and the Simple Moving Average computed over the 50 last candles. If it is sensibly low, the price is a lot lower than it used to be and might be susceptible to an upward reversal to the mean. The strategy looks like this :</p><ul><li>BUY IF <strong>rel-SMA(50) &lt; -5%</strong></li><li>SELL IF <strong>rel-SMA(50) &gt; +5%</strong></li></ul><p>Here is a JavaScript implementation — you can find the entire back-testing JavaScript file <a href="https://gist.github.com/NoctalIvan/2d2fa6546c8e9ba17670c8f6668b32cc">here</a>, and learn more about back testing in <a href="http://localhost:8080/blog/2">this dedicated article</a>.</p><pre>const lastPrice = supPrices[supPrices.length - 1]</pre><pre>const sma = supPrices.slice(-50).map(x =&gt; +x.close).reduce((a, b) =&gt; a + b, 0) / 50</pre><pre>const relSma = lastPrice.close / sma - 1<br>const shouldBuy = relSma &lt; -0.05<br>const shouldSell = relSma &gt; 0.05</pre><p>And here is the result of a run over 1000 hourly candles of Binance BTC/USDT symbol on August 2nd, 2022 at 20:45 CET.</p><pre>start simulation on Fri, 24 Jun 2022 06:59:59 GMT</pre><pre>BUY @19234.06000000 - Thu, 30 Jun 2022 08:59:59 GMT<br>SELL @20395.59000000 - Tue, 05 Jul 2022 00:59:59 GMT<br>- gain: 0.05888922619561334</pre><pre>BUY @20996.90000000 - Tue, 26 Jul 2022 00:59:59 GMT<br>SELL @22554.45000000 - Wed, 27 Jul 2022 18:59:59 GMT<br>- gain: 0.07267999799970468<br>End of simulation on Tue, 02 Aug 2022 19:59:59 GMT<br>┌──────────────────┬───────────────────────┐<br>│     (index)      │        Values         │<br>├──────────────────┼───────────────────────┤<br>│      trades      │           2           │<br>│    totalGain     │  0.13156922419531802  │<br>│   averageGain    │  0.06578461209765901  │<br>│   elapsedTime    │  39.583333333333336   │<br>│ averageDailyGain │ 0.0033238540849343497 │<br>└──────────────────┴───────────────────────┘</pre><p>The complete result file can be found <a href="https://gist.github.com/NoctalIvan/9c169367ea80a2a164d20c389104592b">here</a>.</p><p>The bot operated 2 trades in ~41 days with an average net revenue of 6.58% and a total revenue of 13.16%. Or 99.71% per month. Here is as an example an illustration of one of trades that was executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j9uOoUSmVQXsZ7lCBhxhoA.png" /><figcaption><em>BINANCE:BTC/USDT:1h — from July 26, 2022 02:00 UTC to July 27, 2022 20:00 UTC</em></figcaption></figure><ul><li>Bought at 20996.90 on 2022/07/26 and sold at 22554.45 on 2022/07/27</li><li>7.42% profit, 7.27% after trading fees</li></ul><h3>Which one is for me then?</h3><p>Both are. If you are anything like me going down the path of crypto trading bot crafting, you will inevitably spend each hour working on a momentum bot thinking of swing bots and spend each hour fidgeting with swing bots daydreaming about momentum bots.</p><p>While each strategy is different and will have their own strong and weak points independently of their category, here are the main takeaways :</p><p>In <strong>Bullish markets</strong>, momentum strategies will excel by taking profit of the main market movements. Swing strategies will not hold bullish coins for long and miss most of the potential gain.</p><p>In <strong>Bearish markets</strong>, momentum strategies will beat holders by selling during the dip and won’t lose too much. Swing strategies increase in risk, but might still perform reasonably well.</p><p>In <strong>Horizontal markets</strong>, swing strategies excel by taking profit of the market’s variations around the mean. However, too sensitive momentum strategies can sometimes mistake oscillation for bullish and bearish indicators and do exactly the opposite: buy at the top and sell at the bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*uPBPHcr0xaDiOSkRWcsg-g.png" /></figure><p>At the end of the day, the best strategy is the one that you are the most comfortable running on your account. What is your risk aversion? Do you rather follow the trends of swim against them? Do you want a consistent income with low risk or do you want the adrenaline of risky strategies and three digits income percentages? It is all up to you.</p><p>On an end note, there are few better feelings in the world than a home crafted bot making a profit on its own while you sleep. Designing your strategy is only the first step of your craft, but it is also the one you will be the most proud of.</p><p><em>If you liked this article, you will find it and many others directly on </em><a href="https://thecryptocraftsman.com/"><em>The crypto craftsman blog</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55b19b8be453" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>