Algorithmic Trading with Python: Simple Moving Average
Since I’m passionate about algorithmic trading (and it is a funny way to improve my Python skills), I’m going to start sharing Python codes to backtest different strategies. The following code illustrates how to implement a simple moving average (SMA) strategy in Python and how to backtest it on a given asset obtaining some useful information such as annual returns, net gain/loss, sharpe ratio, etc.