Stably Blog

How to Build a Simple Bitcoin Trading Algorithm with Kory Hoang (Part 1/2)

Written by Kory Hoang, CEO & Founder of Stably. Disclaimer: I do not provide personal investment advice and I am not a licensed investment advisor. All information found here, including any ideas, opinions, views, predictions, forecasts, commentaries, or suggestions expressed or implied herein, are for informational, entertainment or educational purposes only and should not be construed as personal investment advice. While the information provided is believed to be accurate, it may include errors or inaccuracies. I will not and cannot be held liable for any actions you take as a result of anything you read here. Always DYOR, thank you!


A lot of times, many crypto traders (and stock traders) place their trades based solely on out-of-context technical analysis, hearsay from others, gut feelings or — even worse — emotions, which would often result in unprofitable trades. Creating a robust rules-based strategy that is supported by backtest data — whether fundamental or technical (or both) — can help traders generate more consistent results and eliminate emotions to make better trading decisions with extra confidence. This article will show you how to do just that with “BitMoon,” a simple Bitcoin trading algorithm I created back in 2017 (i.e. a rules-based strategy that could be automated to execute live trades).

About Me

My name is Khoi Hoang, or “Kory.” I am the CEO and Founder of Stably, a venture capital-backed FinTech startup from Seattle I co-founded in 2018. Stably is the creator of USDS, the world’s 7th largest US Dollar-backed stablecoin featured on major exchanges like Binance, Binance DEX and Bittrex. In addition to fiat, we will soon release a gold-backed stablecoin in partnership with a major enterprise client as well. Stably also offers tailor-made stablecoin-as-a-service solutions for similar clients who are looking to issue their own stablecoin brands. Our ultimate goal, however, is to connect a wide range of fragmented financial institutions together and combine their open products/services under a single unified API that can process both traditional and digital assets as well as instantly settle transactions across the world in stablecoins.

My co-founders and I in Seattle #TeamStably

I am a first generation Vietnamese-American who immigrated to the US with my parents in the early 2000s when I was still in middle school. I eventually went to college and graduated with a finance and marketing degree from the University of Washington-Bothell in 2014. Soon after college, I started working in the banking and investment management industries. Before founding Stably in 2018, I was actually a Private Equity Data Analyst for PitchBook, a private equity and venture capital data firm in Seattle. While I was crunching numbers on spreadsheets for PitchBook by day, I was also busy building trading algorithms for stocks and cryptocurrencies at night. Trading has always been one of my top passions ever since I started betting on technology and pharmaceutical stocks during college.

Introduction to Trading (2013–2015)

I first traded stocks in late 2013 which was also around the same time I started trading BTC with a couple of thousand dollars (shout-out to my college buddy Andy Chemis for introducing me to BTC and crypto-anarchism). However, I was more of a gambling beginner as opposed to a serious trader during this time. The few lucky trades that gave me a lot of enthusiastic momentum initially soon gave way to bad losses that resulted from using unverified trading strategies and failing to control my expectations as well as emotions properly.

The BTC crash of 2014 made me quit trading crypto all the way until late 2016, when BTC finally picked back up again (should have just HODL, to be honest). I continued to struggle trading stocks manually in 2014 and early 2015. It was then that I decided to do something different and started reading about quantitative trading. Inspired by the likes of Jim Simons from Renaissance Technologies and Ernie Chan from QTS Capital Management, I set out to learn as much as I can about quantitative and algorithmic trading.

Becoming a Garage Quant (2016)

In late 2015, I decided to learn programming (Python) which is a fundamental skill for any serious algorithmic trader. Luckily for me, I discovered Quantopian, an algorithmic trading platform for stocks with plenty of online lectures in addition to a friendly community that quickly helped me whenever I needed anything. Within a year and a half, I taught myself how to program and build automated trading strategies using tools like Python, TradeStation and TradingView. I also published many trading algorithms on Quantopian and TradingView during this period.

What Quantopian looks like

In 2016, I started to algorithmically trade stocks and BTC which, coincidentally, was the same year my high school friend Garrett Jackson and I straddled the EUR/USD pair during Brexit on 1broker. 1broker was an unregulated BTC-settled CFD trading platform we used to gamble on that got shut down by the FBI in 2018. If I recall correctly, Garrett and I each made over +40% profit that summer night when the Brexit vote was being tallied up. We both maxed out leverage and he went short EUR/USD in his account while I went long EUR/USD in my account with the same amount of money. Within 30 minutes of the announcement, his position made +160% in profit and my position got auto stopped out at -80% loss. In total, however, his position + mine = +80% net profit, which was +40% per person.

2016 was also when I first discovered about the different types of price anomalies exhibited by financial assets across various time frames and time intervals based on my research into the Hurst exponent (shout-out to Dr. Kaufman from Parallax Financial Research for guiding me along the way). Thanks to these discoveries, I was able to devise an effective set of principles for building trading strategies that helped me spawn incredibly robust and simple algorithms to detect and trade assets with either very high momentum or mean-reversion anomalies in their prices. I found a lot of success in using this new system with VIX ETNs, index ETFs and especially with cryptocurrencies. Some of the strategies I created were published here and here. I also discussed my system in-depth during a Chat with Traders interview with Aaron Fifield in 2017.

Returning to Cryptoland (2017)

In summer 2017, I increasingly started trading BTC as well as other crypto like ETH and LTC thanks to the bull market’s return. This was also when I created the first iteration of my momentum trading algorithm for crypto, “BitMoon.” BitMoon performed exceptionally well versus my other algorithms for VIX ETNs and stocks which weren’t just as “exciting” as crypto that year. To be more specific, BTC and most crypto exhibited very strong levels of momentum anomalies in 2017, much stronger than those found in stocks and commodities, including mean-reversion anomalies. During 4Q 2017, I was making an easy $5,000–7,000 per month on the side from BitMoon with half of my portfolio while the other half was quietly sitting in index ETFs and trading VIX ETNs.

BitMoon screenshot on TradingView in November 2017

To be fair, though, the VIX algorithms did pretty well, too. I even started a “trading for charity” project with Garrett using my VIX algorithms to buy artificial limbs for children victims of unexploded ordnance (UXO). The project was able to generate +16% within a year from trading VIX ETNs and we got 32 new limbs created for “Step Up for Laos,” a non-profit organization created by a University of Washington professor to help UXO victims in Laos who are mostly children under 18 (shout-out again to Andy for letting me know about this amazing organization).

My Trading for Charity project’s performance in 2017

By the end of 2017, my job at PitchBook was starting to get boring at this point so I decided to resign in December 2017 and started fundraising for Stably. I wanted to create a more transparent and trustworthy stablecoin than Tether (USDT) with Stably and I knew there was going to be a huge market for stablecoins sooner or later. USDT was literally the only usable stablecoin I could get my hands on in 2017 and it wasn’t exactly my favorite neither due to all the controversies and fraud allegations surrounding Tether. In short, I realized that there was a big hole in the market and I wanted to take part in filling it since I knew it was only a matter of time before other larger players would jump in (and sure enough, TUSD, USDC, PAX, and GUSD all came out in 2018 along with our USDS to compete with USDT).

Starting Stably (2018-Present)

Although BitMoon didn’t perform as well as HODL in 2017 (as is the case with most trend-following strategies), it was the crypto market crash during the following year that truly demonstrated the power of momentum strategies when applied to a highly volatile and trend-persistent asset class. BitMoon successfully avoided most of the carnage in BTC as well as ETH and LTC during early 2018 while I comfortably sat in USDT to weather out the storm. I also flew to Southeast Asia during this time to meet with venture capitalists and fundraise for Stably’s seed round.

Due to a lack of time and my desire to focus more attention on Stably, I stopped trading actively in April 2018 after successfully raising a $500,000 seed round for our company. Although I no longer traded, I’ve been actively monitoring my BitMoon algorithms ever since to this day in “paper trading” mode. I also published an enhanced variation of BitMoon called “Super BitMoon” here in December 2018. They have all performed very well ever since I stopped trading actively and even managed to dodge the recent September 2019 BTC dump from $10,000 to $8,000.

Super BitMoon (upper left) and BitMoon (upper right) with BitMoon’s backtest (bottom)

Honestly, sometimes I low-key wish we started a hedge fund with that $500,000 and BitMoon instead because we probably would have made a lot more money by now than building a new startup from scratch. On the other hand, hindsight is 20/20 so I digress. Stably has been working out pretty nicely for us, too, so definitely no complaints here, neither! :)


Stay tuned for Part 2 of this article to learn how “BitMoon” actually works and how you can easily build similar crypto trading algorithms using TradingView + AutoView!


Sign up for our newsletter to receive recent news & updates, and follow us on social media:

Website | Twitter | Linkedin | Facebook | Telegram




Exchanges or Market Makers:


Investors: Kory Hoang, CEO —


Subscribe to the Staby Newsletter for all the latest updates!


Copyright © 2019-2020 Stably Corporation. All Rights Reserved 

Social Icon-04-stably.png
Social Icon-03-stably.png
Social Icon-02-stably.png
Social Icon-01-stably.png
Social Icon-05-stably.png
Social Icon-06-stably.png

Like being first? Subscribe to the Stably Newsletter!







All asset custody, funds processing, convertible virtual currency administration, trustee and fiduciary services are provided by Prime Trust, a Nevada chartered financial institution and licensed trust company. Digital assets are held in secure cold storage and USD funds are held in FDIC-insured bank accounts by Prime Trust. Stably is not a licensed financial institution and Stably does not manage nor take custody of client funds. Prime Trust neither endorses nor guarantees any of the information, recommendations, optional programs, products, or services advertised, offered by, or made available through the external website ("Products and Services") and disclaims any liability for any failure of the Products and Services.