SharmaVidhiHaresh / Backtesting-Trading-Strategies-with-Python

In this project, I had backtested the cross-over trading strategy on Google Stock from Jan 2016 to June 2020. By using historical time-series data, I had tested the Moving Average(MA) cross-over strategy and Relative Strength Index (RSI) strategy with a stop loss at a price that closes 2% or more below 10-day MA. I had plotted the equity curve with drawdowns and P&L, as well as volume, relative strength index (RSI), stock pricing chart and simple moving averages.
40 stars 13 forks source link
backtesting-trading-strategies finance python pythonforfinance trading-algorithms trading-strategies

Backtesting-Trading-Strategies-with Python

We would backtest the cross-over trading strategy on Google Stock from Jan 2016 to June 2020. By using historical data, we can test the returns and risk of the employing Moving Average(MA) cross-over strategy and Relative Strength Index (RSI) strategy under various market conditions.

Premises of the strategy

Relative Strength Index (RSI)

The relative strength index (RSI) is a momentum indicator used in technical analysis that measures the magnitude of recent price changes to evaluate overbought or oversold conditions in the price of a stock or other asset. Traditional interpretation and usage of the RSI are that values of 70 or above indicate that a security is becoming overbought or overvalued and may be primed for a trend reversal or corrective pullback in price. An RSI reading of 30 or below indicates an oversold or undervalued condition.

Moving Average (MA) Crossover

The shorter the time span used to create the average, the more sensitive it will be to price changes. The longer the time span, the less sensitive the average will be. upward momentum is confirmed with a bullish crossover, which occurs when a short-term moving average crosses above a longer-term moving average. Conversely, downward momentum is confirmed with a bearish crossover, which occurs when a short-term moving average crosses below a longer-term moving average.

Setting the stop-loss:

If the price closes 2% or more below 10-day MA, close the position, if any.

Trade Set-Up

Buy the position when: