An algorithm (“algo”) is a set of mathematical instructions or rules, programmed into computer software to produce some outcome or solve a specific problem or set of problems.

In the context of cryptography and data security, cryptographic algorithms have the job of turning readable data into a form of protected data – data that can’t be read easily by the human eye – and back to readable data.

These algorithms are directly involved in data encryption, digital signatures, and authentication.

In the context of trading, algorithms are often used in automated trading or high-frequency trading (HFT) to buy and sell securities in microseconds (one-millionth of a second).

Algorithms can be simple – just a couple of lines of computer code – or then can be complex – some algorithms are thousands of lines long.

An example of a trading algorithm is one based on mean reversion.  Mean reversion simply means that price will return to the average over time. Using mean reversion and Bollinger Bands, an algorithm could look for stocks or cryptocurrencies that sit high or low within the bands.

The algo would buy the low-priced security and sell the high-priced security. Over time, price would move back to the mean, or middle, and the algo would do the opposite of the initial orders.