Backtesting Rayner Teos 88.89% winning rate Trading strategy in Python



Hi everyone,

I backtested Rayner Teos 88.89% Winning rate Trading strategy with Python. Be kindly invited to drop me a comment if you have any questions
or want to provide feedback.
You will find a lot of python concepts here and you will need some Pandas
knowledge and a good understand of Loops. Be kindly invited to check out
the resources on my channel to better follow along.

Important note:
There is a mistake in the for loop at around 24:10. Please check my pinned comment
for a correction below!
Thank you so much to Lewis Wong for letting me know!

I would love to work on further on this strategy so if you want to participate on that journey please like the video and subscribe the channel 🙂 Thanks in advance.

Credits and a big thank to Rayner Teo for presenting such an interesting strategy and big credits to macroption providing a very straightforward
step by step approach to calculate the RSI which helped me a lot.

Link to macroption:
https://www.macroption.com/rsi-calculation/

Rayner Teos video:

0:00 – 01:55 Brief Introduction to the strategy from Rayner Teo
01:55 – 04:02 Getting S&P 500 price data with yfinance
04:02 – 05:57 Calculating the 200 day simple Moving average
05:57 – 07:03 Visualizing the strategies first condition
07:03 – 07:44 Get daily price changes
07:44 – 08:23 Get rid of error messages (chained assignments)
08:23 – 09:01 Quick Summary
09:01 – 10:41 Upmoves
10:41 – 11:43 Downmoves
11:43 – 14:18 Wilder’s Smoothing Method and Exponential Moving Average
14:18 – 15:03 Average Upmove
15:03 – 15:48 Average Downmove
15:48 – 16:28 Relative Strength (RS) Calculation
16:28 – 17:40 Relative Strength Index (RSI) Calculation
17:40 – 18:00 Quick Reminder of the strategy
18:00 – 20:29 Defining Buying Days (Yes/No)
20:29 – 26:21 Profits and Losses Calculation
26:22 – 28:06 Winning Rate Calculation

See also  Today natural gas big breaking news & trading strategy 13/07/2021 !! Natural gas trend by mcx world

#Python #Trading #RSI

source