Algorithmic Trading Strategy [Mean Reversion] in Python using Bollinger Bands/RSI !BEGINNER FRIENDLY
HTML-код
- Опубликовано: 7 июн 2024
- In this video we are building and improving an Algorithmic Trading strategy presented on LinkedIn which I consider is quite beginner friendly. Let me know if you are interested to test that on a larger scale, on cryptocurrencies or whatever you are interested in. Happy to cover!
Get the Notebook/Source code by becoming a Tier-2 Channel member:
/ @algovibes
Bryan Chens article:
/ algorithmic-trading-me...
I am refering to Bryan as "the author" in the course of this video.
Build the RSI from scratch:
• How to build a RSI Tra...
Another RSI/Bollinger Bands Trading strategy implemented in python:
• Backtesting Rayner Teo...
How returns are calculated and cumulated:
• How To Calculate Stock...
In depth Bollinger Bands:
• Algorithmic Trading in...
Be invited to check out more videos in my Python for Finance playlist and the cryptobot playlist and most importantly:
Please subscribe if you want more of this content! Thx :-)
Disclaimer: This video is not an investment advice and is for educational and entertainment purposes only!
00:00 - 01:18 Introduction / Disclaimer
01:18 - 05:16 Pulling prices / technical indicator calculation
05:16 - 07:24 Numpy select for multiple conditions (must watch!)
07:24 - 07:58 Check signal column
07:58 - 09:52 Shifting signal logic / buyprice
09:52 - 14:06 Checking signals iteratively using iterrows
14:06 - 15:34 Vizualisation
15:34 - 16:24 Comparison with the authors signals (new data)
16:24 - 18:18 Profit calculation / comparison
18:18 - 21:55 Improving the strategy: Adding Stop Loss
21:55 - 23:46 Other stocks / potential upcoming videos!
#Python #Trading #Strategy #BollingerBands #RSI
Very elegant way to create the 'signal' column. 👍
Glad that you think so :) thanks for watching!
As usual... great info and very well explained... I really love your channel, it's extremely helpful
Thanks a lot Marc. Appreciate your kindness!
Awesome analysis and great to see this all done in Python, I've only really done things in Tradingview Pine Script :)
Thanks mate, happy to read :-) Be invited to check out my other stuff!
I swear I love this channel 😍
Thank you so much! Channel loves you too ❤️
Great Video. You The Man!!❤🔥
Thx boss
I think if you add sma20 like above in buy and below in sell the result will be better as it will follow trend . Thanks for sharing knowledge 🙏🙏🙏 .
Thanks for sharing! Nice job! I like the way you do experiments. Could you make videos on risk management of assets when, for example, they cointegrate? Or other types when we need to care about risks. Thank you and good luck!
Thanks a lot Mansur! Did some videos on that already (e.g. VaR). Is that what you are looking for?
Very interesting as always :)
Thanks a lot Dennis 🙂
When the trading is restricted to one active trade at a time, the algorithm becomes extremely starting point sensitive. Basically you'll select which shares to buy simply based on when you set the starting date for the algorithm. I think that basically makes it random.
Would be great to see a video where you code up a way to take an algorithm like this and programmatically check starting point sensitivity.
Thanks a lot for sharing your thoughts Andre. I have already covered to tackle that "problem" by e.g. splitting in some previous videos but will also cover that in future videos.
thanks for the video mate, interesting stuff!
Glad you think so Gianluca, thanks a ton!
Seems difficult to test properly and avoid overfitting though given these strategies don't do many trades
great video, thank you very much
Very welcome! Thanks a lot for watching and leaving a comment :-)
Simple and effective as usual. Bravo! A humble proposal : what about to use a correlated couple of futures, such as ES and NQ and to trade their spread ? Instead of a single equity?
Thanks a ton! Also great suggestion, thank you
Great vid thank you...Would be cool to plot the cumulative sum of the returns to see how stable returns are and drawdowns....
Thanks mate. You can just take the cumulative prod (cumprod()) instead of the prod and then plot it.
whats really helpful, and tricky, is taking your videos and turning them into Classes. so tricky sometimes.
Facts. Surely a bunch of commenters start a git if his videos with python classes lol
Will do so in the next video! :-)
Ty good video
Thanks for watching mate
Nice
When using the panda.ta (instead of ta) for the RSI, there are only 4 buy dates instead of 10+ as in the video. I am not sure why there is the discrephencies. Any idea?
Mean reversion and trend following are two opposing trading methodologies. You need to separate the trending market from the range bound market. Only then will you be able to make this better.
nice, lets test it on crypto!!
Why don't you just make the stop losses part of the selling conditions? I'm having trouble understanding why you would put them in the loop? I could only understand that in my mind if they were trailin stop losses.
Your thoughts are appreciated.
Thanks for this. I am using finta TA and the RSI differs from yours - which one are you using please ?
Welcome mate! Using the RSI from the library here. Has a default lookback of 14. Cheers
Good vdo.
thanks buddy. appreciate your comment!
Is there a python package which can read the raw data of ninjiatrader?
He might have shifted to the second day close to account for a position draw down. There were buy signal clusters and if you look at the close of first to second you have a large draw down. Look at first to third signal you have an even larger draw down. You would be stopped out with a major loss entering the first two signals
Is there any way to set the symbol with a variable so that i can just change the symbol on the top once and it hut run and runs everything for that new symbol
Hey Arman,
Yes! Will exactly show how to do that in the next video :-) stay tuned
I couldn't understand the part where the position variable set equal to False and in the loop after that we use "if not position" argument which actually turns the argument to true. So in the beginning of the loop we say "if we are in a position and signal is buy....".
Hey Cem,
no in the beginning we say "if we are NOT in a position AND we have a buying signal" -> Buy!
Very interesting 😍😍😊😘😘🤩💕💕❤️
thanks buddy
@@Algovibes💕💕❤️❤️❤️❤️🤩
Maybe an MA or something to filter the larger fall at the end?
Probably not a bad idea! Thx for watching :-)
@@Algovibes Well, I was using the Pinbar rejection indicator from TradingView, which is almost an identical plot as the Bollinger Bands middle line, and it catches that big downside move on the chart. Tanks.
Shared code
Sure! You get access to the Code by becoming a Tier-2 channel member here:
ruclips.net/channel/UC87aeHqMrlR6ED0w2SVi5nwjoin
Looking forward to welcome you! :-)
I am surprised to see GME yielding a 126% return if you start the strategy from beginning of this year. I used a 5% stop loss
Yea, that's quite interesting indeed.
please how do you take profit
You mean like instead of the Stop Loss add a Target Profit?
All strategies perform nice to very nice when there's a bull market. Unless you can start accounting for/predicting the market bull-bear-wise, all strategies will always fail.