Coins: 14,906
Exchanges: 1,158
Market Cap: $2.603T 1.2%
24h Vol: $84.015B
Gas: 9 GWEI
Go Ad-free
API
TABLE OF CONTENTS

5 Popular Crypto Trading Strategies & How to Backtest

4.4
| by
Jackson Henning
|
Edited by
Julia Ng
-

What is Crypto Day Trading?

Crypto day trading is the buying and selling of cryptocurrencies within the same day, to profit from short-term price fluctuations. Traders rely on technical analysis, make frequent trades, and manage risk to capitalize on market volatility. Generally, traders employ 4 hour, 1 hour, or even 15 minute time frames to inform their decisions. Utilizing higher time-frames to inform shorter time-frame moves or backtesting their trading strategies can help overcome the inherently myopic nature of day trading.

In this article, we will examine the 5 most popular crypto day trading strategies and learn how to thoroughly backtest and validate those strategies using CoinGecko’s API. Regardless of whether you are new or experienced, we hope these insights will help you navigate crypto trading with confidence.

Let’s get started!


1. Technical Analysis

The most popular crypto trading strategy is technical analysis, which can be broken down into two sections: chart analysis and technical indicators.

a) Chart Analysis

Chart analysis is the use of high time-frame chart patterns to analyze market movements and sentiment, understand trends, and inform trading decisions. This is commonly used by discretionary traders, and can be further divided into trend-following and mean-reverting strategies.

Trend-following assumes a persisting trend will break out of previously defined levels of resistance or support with sufficient momentum, and mean-reverting implies the price action is constrained by two eponymous levels, continuously reverting to some long-standing mean.

Chart analysis can involve the use of Japanese candlestick patterns. Popularized instruments include the Doji, the Mazuroba, the Spinning Top, the Hammer, amongst others. As the use of candlestick patterns is closely intertwined with market sentiment, chart analysis traders will also utilize the Fear & Greed Index to factor in volatility, volume, social media craze, surveys, Bitcoin dominance, whale activity, and Google search trends. That said, some traders exclusively rely on crypto Twitter (CT), or may use it in conjunction with chart analysis, to inform trading decisions.

b) Technical Indicators

The next prong of technical analysis is technical indicators. Like chart analysis, technical indicators also feature mean-reverting or trend-following strategies. To discern the two, one can employ the Augmented Dickey-Fuller (AFD) or Kwiatkowski–Phillips–Schmidt–Shin (KPSS) test. Both look for the existence of stationarity, allowing for traders to determine if mean-reversion is present. Both rely on the presumption that history will repeat itself, given that their inputs are historical price data.

While these tests are not necessary, it helps to explain the price action history. Traders can employ technical indicators to gain insight into the immediate future of the asset. Common indicators include:

  • Moving Averages
  • Moving Average Convergence Divergence (MACD)
  • Bollinger Bands
  • Average Directional Index (ADX)
  • Fibonacci Retracements
  • On-Balance Volume (OBV) 
  • And others

Technical indicators are used by most market participants and remain prevalent today. For example, if you aim to comprehend the direction of public interest, consider examining the Relative Strength Index (RSI). The RSI is widely recognized and utilized by retail traders for its popularity in capturing trends and market sentiment. Variations in trading success arise from a trader’s capacity to interpret the tool and deduce appropriate decisions.

2. Options

Most technical analysis tools are lagging indicators, slowing traders in their decision making and leaving them susceptible to sudden market changes. Given this gap, traders use other strategies like options trading, to mitigate risk. 

Options trading gives the owner the right to buy or sell a predetermined quantity of the underlying asset at or before a certain strike date for a specified strike price. There are 3 type of option styles:

  • American: Contracts can be exercised at any time up to and including the day of expiry.
  • European: Contracts can only be exercised on the day of expiry.
  • Bermudan: Contracts can be exercised on a fixed set of dates.

European options are most commonly used in crypto. An options contract has inherent leverage, as one contract may represent multiple units of the underlying asset, and the downside is restricted to the premium one pays to hold the contract (when buying a put or call).

Therefore, traders will utilize puts and calls to manage their risk profile. One example is a long straddle. A long straddle consists of one long call of a higher strike price and one long put at a lower strike price. Both have the same underlying asset and strike date. This setup allows traders to capitalize if the underlying asset increases, or decreases in price. The loss is constrained to the premium and fees paid to hold the contract. Other risk-mitigating option strategies include: 

  • Straddles
  • Butterflies
  • Married puts
  • Protective collars
  • And others

3. High-Frequency Trading

Alternatively, some traders utilize high-frequency trading – a technique that conducts many trades at once. It is a type of algorithmic trading strategy where computer programs execute a large number of trades in fractions of a second. They aim to anticipate market trends before they become apparent to other participants. 

One example is market making. High-frequency traders will submit a limit order to buy or a limit offer to sell and earn the bid-ask spread. By setting their sell order a tad above asking, and their buy order a little below the current bid, they gain the difference in price. Other examples include:

  • Event Arbitrage
  • Statistical Arbitrage
  • Latency Arbitrage
  • Index Arbitrage

4. Leading Signals

Leading indicators are measurable signals that help forecast future price action activity, giving traders more insight in the present. The previously mentioned technical indicators have all been lagging signals as they confirm the data that is already apparent. Leading signals leave room for innovation. For instance, John Ehler often employed electrical engineering concepts, such as bandpass filters, to construct new indicators like the Fisher Transformation or the Empirical Mode Decomposition (EMD) tool. 

The Fisher Transformation highlights when prices have moved to an extreme, based on recent data. It converts prices into a Gaussian Normal Distribution, highlighting peak swings and making price reversals easier to identify. This tool is an example of a leading indicator because it identifies potential price reversals before they occur. Despite most technical indicators being lagging, John Ehlers innovations stand as a testament to the possibilities of creating new leading tools for this strategy.

5. Perpetual Futures

A perpetual future is a type of crypto derivative that allows users to speculate on the price of an asset. Perpetual futures are like futures contracts, but they do not have an expiry date. Therefore, their only purpose is speculation. When a perpetual contract is opened it has a fixed value, like a futures contract, but with no expiry, allowing traders to hold it indefinitely. Rather than settling the contract, ‘perps’ use funding rates. If the perp price is above the underlying asset spot price, traders who are long pay a fee to traders who are short – this is a positive funding rate. In contrast, if the funding rate is negative, traders who are short pay the traders who are long. This mechanism keeps the perp price inline with the spot price, as it becomes more expensive for traders to hold the contract the more it diverges. 

This derivative is popular because it allows traders to utilize leverage, as some exchanges offer perps with extremely high leverage possibilities. They can be extremely risky, given their lack of regulation and potential for high significant fees.

In sum, trading encompasses the process of balancing risk with reward. To backtest trading strategies, one will require historical crypto price data. Fortunately, the process of acquiring and implementing aggregated crypto price data for trading strategies is simplified by CoinGecko API.


How to Backtest Your Crypto Trading Strategy

Backtesting is the process of applying a trading strategy over an asset's historical prices, ideally covering both bear and bull market scenarios, to evaluate its effectiveness prior to its actual implementation. Common metrics to measure effectiveness include the Sharpe ratio, the max drawdown, or the max drawdown duration.

In this guide, we’ll be using CoinGecko’s Demo API to fetch historical crypto price data via Python.

Get Crypto Price Data with CoinGecko API (Python)

An API is an application programming interface that allows two programs to talk to each other. CoinGecko’s API provides this data through RESTful JSON endpoints. REST APIs facilitate the communication over HTTP (Hypertext Transfer Protocol) between two computers. These API requests are sent and received through JSON (JavaScript Object Notation) formats. This is due to the difficulty of decoding data through previous formats like XML or HTML.

Installing CoinGecko’s API with python can be done by typing “pip install pycoingecko” into your computer’s terminal or command line. This opens up our python virtual environment. In this guide, I will be using Jupyter Notebook.

For our python program, we will install numpy, matplotlib, and pandas, which will allow us to manipulate, visualize, and picture our data.

Get Crypto Price Data with CoinGecko API (Python)

From the pycoingecko library we will call CoinGecko’s API to get various crypto price data based on specified parameter inputs, including the coin, the currency to compare it to, and the time frame of the data. For example, to get historical price, volume, and market cap data, type coinGecko.get_coin_market_chart_by_id(). Insert ‘bitcoin’, ’usd’, ‘365’ within the brackets. The granularity of these calls vary depending on the number of days specified in our query:

  • 1-day from current time produces data in 5-minute intervals (as in 5-minutes before the present, 5-minutes before that, etc.)
  • 2-90 days from current time produces hourly data
  • above 90 days returns daily data

We will also be using the OHLC endpoint, of which the granularity is automatic:

  • 1-2 days from current time results in 30-minute intervals of data
  • 3-30 days returns 4-hourly data
  • above 31 days shows 4-daily data

Tip: You can unlock a daily candle interval parameter by subscribing to CoinGecko’s paid API.

20-day SMA Strategy

Let’s imagine we are constructing a strategy surrounding Ethereum for the past year. To return OHLC data we will send a request to the CoinGeckoAPI to get_coin_ohlc_by_id, with inputs of ‘ethereum’, ‘usd’, and ‘365’.

For improved readability we can reconstruct the resultant data into a pandas dataframe, titling each column and setting the index to the date (after converting it into datetime structure). To_datetime converts our scalar, series, or array-like data into a pandas datetime object.

Tip: Specify unit=“ms” which will translate the date and time to milliseconds (ms) for improved readability. 

Now, we can visualize our newly constructed dataframe by plotting it through matplotpyplot. Let’s construct a simple strategy surrounding a 20-day simple moving average (SMA). As the API returns data on 4-day intervals, our lookback period will be 5, constructing a 20-day SMA.

Backtesting Your Crypto Day Trading Strategy

Backtest Your Crypto Day Trading Strategy

For this crypto trading strategy, we’ll assume a bullish signal is generated every time the price action crosses from below to above the 20-day SMA. Conversely a bearish signal is generated once the price action crosses from above to below the 20-day SMA. For this long-only strategy, we have just identified both entry and exit points.

To reiterate, we will generate our signals by adding a new ‘Signal’ series to our dataframe, where 1 implies a long signal and -1 a short.

Visualizing our dataframe can help confirm the accuracy of our code so far. Notice how a long signal (1) is generated and sustained in the ‘Signal’ series until a sell signal (-1) is indicated, causing the series to return to ‘0’.

Generating Results

Our percentage returns can be calculated by taking the percentage change in the ‘close’ series and multiplying it by the shifted ‘Signal’ series. This is to align the signal generated with the corresponding close price. The cumulative returns are merely the cumulative product of the ‘Returns’ series.

As shown above, traders can scrutinize an assortment of metrics based on their own strategy – that said, max drawdown and max drawdown duration are two of the most common ways to assess a strategy using technical indicators. The maximum drawdown (MDD) is the difference between the local maximum and local minimum of the equity curve, following the occurrence of the local maximum; it is the greatest observed loss between a peak and trough of the equity curve over a time period. The maximum drawdown duration is the longest it has taken for the equity curve to recover losses. The equity curve is simply a plot of the cumulative returns.

The cummax() pandas function sifts through each series, returning only the max value displayed up until that point. The drawdown is calculated by dividing the difference between the cumulative return at that point and the peak by the peak value. Max drawdown duration is established through a running total of the duration variable (duration += 1), returning the variable to 0 if the drawdown is equal to zero and if the duration is greater than zero. Meaning, the duration count has been recorded before returning it to 0, to count the next running total in an effort to determine the longest drawdown stint.

The Sharpe ratio is calculated by taking the expected return and dividing it by the standard deviation of the excess returns. The expected return is simply the mean of our excess returns, which is the difference between the assets return and a risk-free asset. In this instance, we will disregard the risk-free rate. Our excess returns is a list, where each value is generated from our long and short signals. We will consider a long signal created when the ‘cross_up’ series is true because our ‘Signal’ series features a number of ‘1’s, due to them repeating until a short signal materializes. Only the first instance of each 1 constitutes an entry signal, not each successive ‘1’. Each successive ‘1’ simply shows that we are still in a long position. Therefore, we use this alternative method as shown below.

Analyzing Strategy Results

Defining a strategy_result function amalgamates all previously discussed data to generate a signal output of consolidated figures. Similarly to our excess return function, we will define a long or ‘buy’ signal as the point where the ‘cross_up’ series is true, and the short or ‘sell’ signal where the ‘Signal’ series is equal to -1. Then we can determine our profit, number of trades, and number of wins based on the discrepancy between the generated entry and exit prices.

To display our data we can employ ‘f strings’. F-strings are string literals that begin with an ‘f’ and contain curly braces to signify expressions that will be replaced by values. This is conducive to our results being legible. The ‘5.2f’ or ‘.2f’ splattered throughout the below code specifies the width, number of decimals, and type of figure produced. ‘5.2f’ indicates a width up to ‘5’ characters, and a ‘float’ value up to ‘2’ decimal points.

Then we can print all of the above variables, as shown below. The reason for separating them is for improved code readability, as opposed to having the code rife with intermixed green ‘print’ and red ‘f-string’ letters we can simply disconnect them. 

As demonstrated in our subsequent output below, our SMA crossover strategy for Ethereum over the past year generated negative results. This is epitomized by the large loss, low win rate, and negative sharpe ratio, suggesting this strategy would have been worse than a risk-free US Treasury Bill.

Lastly, to conceptualize our max drawdown and MDD, we can use the below code to plot the equity curve. 

As shown above, this 20-day SMA crossover strategy ultimately yielded negative returns over the course of a year.

Conclusion

Crypto day trading can involve various methods like chart analysis, technical indicators, sentiment analysis, and High-Frequency Trading. Given the crypto market’s unpredictability and volatility, backtesting trading strategies on historical data, before using them, can reinforce solid ideas and weed out weak ones.

All information and examples in this article are provided for informational purposes only, and should not be taken as financial advice.


Get Historical Crypto Prices with CoinGecko API

CoinGecko API is the best crypto API for historical prices, as it includes price, market cap, 24hr trading volume for over 10k cryptocurrencies, spanning 10 years worth of historical price data since April 2013.

While the Demo API is generally sufficient for traders, pro traders may consider subscribing to CoinGecko’s Analyst API to enjoy 60+ Pro endpoints – including:

  • Historical market data of NFT collections (includes floor price, market cap and 24hr trading volume)
  • Historical trading volume data of exchanges
  • Get OHLC data of any cryptocurrency, where the candle interval is of daily data granularity

If you’re looking for a custom solution, get in touch with our Business Development team via the form below:

CoinGecko's Content Editorial Guidelines
CoinGecko’s content aims to demystify the crypto industry. While certain posts you see may be sponsored, we strive to uphold the highest standards of editorial quality and integrity, and do not publish any content that has not been vetted by our editors.
Learn more
Want to be the first to know about upcoming airdrops?
Subscribe to the CoinGecko Daily Newsletter!
Join 600,000+ crypto enthusiasts, traders, and degens in getting the latest crypto news, articles, videos, and reports by subscribing to our FREE newsletter.
Tell us how much you like this article!
Vote count: 16
Jackson Henning
Jackson Henning
Jackson Henning has a background in economics and has spent 3 years in crypto, primarily ensconced in NFTs and DeFi. He is especially intrigued by the perpetual ingenuity common to crypto trading, along with the employment of technical analysis and the ability of DeFi to push the bounds of traditional finance. Follow the author on Twitter @Henninng

Related Articles

Select Currency
Suggested Currencies
USD
US Dollar
IDR
Indonesian Rupiah
TWD
New Taiwan Dollar
EUR
Euro
KRW
South Korean Won
JPY
Japanese Yen
RUB
Russian Ruble
CNY
Chinese Yuan
Fiat Currencies
AED
United Arab Emirates Dirham
ARS
Argentine Peso
AUD
Australian Dollar
BDT
Bangladeshi Taka
BHD
Bahraini Dinar
BMD
Bermudian Dollar
BRL
Brazil Real
CAD
Canadian Dollar
CHF
Swiss Franc
CLP
Chilean Peso
CZK
Czech Koruna
DKK
Danish Krone
GBP
British Pound Sterling
GEL
Georgian Lari
HKD
Hong Kong Dollar
HUF
Hungarian Forint
ILS
Israeli New Shekel
INR
Indian Rupee
KWD
Kuwaiti Dinar
LKR
Sri Lankan Rupee
MMK
Burmese Kyat
MXN
Mexican Peso
MYR
Malaysian Ringgit
NGN
Nigerian Naira
NOK
Norwegian Krone
NZD
New Zealand Dollar
PHP
Philippine Peso
PKR
Pakistani Rupee
PLN
Polish Zloty
SAR
Saudi Riyal
SEK
Swedish Krona
SGD
Singapore Dollar
THB
Thai Baht
TRY
Turkish Lira
UAH
Ukrainian hryvnia
VEF
Venezuelan bolívar fuerte
VND
Vietnamese đồng
ZAR
South African Rand
XDR
IMF Special Drawing Rights
Cryptocurrencies
BTC
Bitcoin
ETH
Ether
LTC
Litecoin
BCH
Bitcoin Cash
BNB
Binance Coin
EOS
EOS
XRP
XRP
XLM
Lumens
LINK
Chainlink
DOT
Polkadot
YFI
Yearn.finance
Bitcoin Units
BITS
Bits
SATS
Satoshi
Commodities
XAG
Silver - Troy Ounce
XAU
Gold - Troy Ounce
Select Language
Popular Languages
EN
English
RU
Русский
DE
Deutsch
PL
język polski
ES
Español
VI
Tiếng việt
FR
Français
PT
Português
All Languages
AR
العربية
BG
български
CS
čeština
DA
dansk
EL
Ελληνικά
FI
suomen kieli
HE
עִבְרִית
HI
हिंदी
HR
hrvatski
HU
Magyar nyelv
ID
Bahasa Indonesia
IT
Italiano
JA
日本語
KO
한국어
LT
lietuvių kalba
NL
Nederlands
NO
norsk
RO
Limba română
SK
slovenský jazyk
SL
slovenski jezik
SV
Svenska
TH
ภาษาไทย
TR
Türkçe
UK
украї́нська мо́ва
ZH
简体中文
ZH-TW
繁體中文
Login to track your favorite coin easily 🚀
By continuing, you agree to CoinGecko Terms of Service and acknowledge you’ve read our Privacy Policy
or
Forgot your password?
Didn't receive confirmation instructions?
Resend confirmation instructions
IT'S FREE! Track your favorite coin easily with CoinGecko 🚀
By continuing, you agree to CoinGecko Terms of Service and acknowledge you’ve read our Privacy Policy
or
Password must contain at least 8 characters including 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character
Didn't receive confirmation instructions?
Resend confirmation instructions
Forgot your password?
You will receive an email with instructions on how to reset your password in a few minutes.
Resend confirmation instructions
You will receive an email with instructions for how to confirm your email address in a few minutes.
Get the CoinGecko app.
Scan this QR code to download the app now App QR Code Or check it out in the app stores
coingecko
Continue in app
Track prices in real-time
Open App