The Joys of Algorithmic Trading and Backtesting

  1. Pick a Strategy. By strategy, we mean something that makes buying or selling decisions. This could be a market-making one, some directional one, a spread trade as we’ve discussed before, or a mixture of all.
  2. Parameterize It. Figure out the moving parts that can be changed in order to change performance. Then, make them configurable with a variable. Some common ones present in most strategies are the size of the orders we send out, adjustments to our order prices (e.g. the lean we talked about in market making), and thresholds for our signals (or what triggers us to send orders out) like we showed in the last article.
  3. Run Strategy on Different Settings. We then create different settings for each parameter and “play” each configured version of the strategy through our historical data.
  4. Score Their Performance. Measure performance of each run. Though this could solely be P&L, we may consider other factors like stability of the profits or volume traded by the strategy with that setting.
  5. Select the Best Performing Configuration. Based on our performance scoring, we’ll be able to pick the best settings.

Momentum Trading

  1. Pick a Strategy. Let’s have a strategy that uses a crossover MA signal that we check at the beginning of our trading day. If a fast one crosses a slower one, we take that direction (buy if the fast one is moving up, sell if the fast one is moving down).
  2. Parameterize It. In the example above, we pegged the fast MA to 1 week and the slow to 8 weeks. We also said that as long as the fast crosses the slow, we’ll treat that as a trading signal. We’ll keep it simple and parameterize just these. One variable to configure is the number of weeks for the fast MA. The second is for the number of weeks for the slow MA. A third is the percentage that the fast has to cross the slow before we take it as a signal. For example, should the fast MA price be 0% (i.e. just having crossed), 0.5%, or 1% above the slow one before our strategy tries to buy into the market and take a long position?
  3. Run Strategy on Different Settings. We have three parameters here. Three example settings we may run are {1 week, 8 weeks, 0%}, {1 week, 4 weeks, 0.5%}, {2 weeks, 26 weeks, 3%}. Note that for the 26 week one, we’ll need much more historical data. Also, we would need something that calculates the daily past MAs for the given weekly settings above.

Market Making

  1. Pick a Strategy. Here, we’ll go with the market making strategy we discussed before. We’ll again use a moving average, this time for the reference price. For the offsets, we’ll make it symmetrical so that the buy offset is the same as the sell. Finally, let’s skip the lean for this exercise.
  2. Parameterize It. We’ll do two here. Let’s do the window size of the reference price MA in terms of minutes. And, let’s have the offset in terms of a percentage off either side of the reference price.
  3. Run Strategy on Different Settings. Again, this can be any multitude of settings, but here are three examples: {15-minute price window, 0.25% off the reference price}, {30 minutes, 0.5%}, and {120 minutes, 2%}
Typically, algorithmic traders are found in sandboxes.




Building new ways to access cryptocurrency markets.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What is Binance Coin

9 trading strategies for newbies

Asva Labs forges strategic partnership with DCI


AMA Recap —  Umbrella Network Community Hosts UniFarm

Binance Tutorial For Beginners

A Love Letter: Insights for Manual Cryptocurrency Trading

Body of Water Across Forest. Credit:

“Sam” Bankman-fried with a homerun for Crypto!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Building new ways to access cryptocurrency markets.

More from Medium

Crypto Trading Nuances: How to Optimise Your Margin

Normalization of Oscillating Indicators to Create Dynamic Overbought and Oversold Levels

Momentum vs mean reversion in crypto. Attempt #2

Crowd-Sourced Automatic Trading Strategies: Are They Any Good?