Algorithmic Trading Strategy [Mean Reversion] in Python using Bollinger Bands/RSI !BEGINNER FRIENDLY

  Рет қаралды 30,015

Algovibes

Algovibes

Күн бұрын

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

Пікірлер: 60
@flydr2
@flydr2 Жыл бұрын
As usual... great info and very well explained... I really love your channel, it's extremely helpful
@Algovibes
@Algovibes Жыл бұрын
Thanks a lot Marc. Appreciate your kindness!
@sweealamak628
@sweealamak628 Жыл бұрын
Very elegant way to create the 'signal' column. 👍
@Algovibes
@Algovibes Жыл бұрын
Glad that you think so :) thanks for watching!
@kevanotrades8488
@kevanotrades8488 Жыл бұрын
Awesome analysis and great to see this all done in Python, I've only really done things in Tradingview Pine Script :)
@Algovibes
@Algovibes Жыл бұрын
Thanks mate, happy to read :-) Be invited to check out my other stuff!
@DenisBelleau
@DenisBelleau Жыл бұрын
Very interesting as always :)
@Algovibes
@Algovibes Жыл бұрын
Thanks a lot Dennis 🙂
@refaamoe
@refaamoe Жыл бұрын
I swear I love this channel 😍
@Algovibes
@Algovibes Жыл бұрын
Thank you so much! Channel loves you too ❤️
@int2str
@int2str Жыл бұрын
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.
@Algovibes
@Algovibes Жыл бұрын
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.
@toddroloff93
@toddroloff93 5 ай бұрын
Great Video. You The Man!!❤‍🔥
@Algovibes
@Algovibes 5 ай бұрын
Thx boss
@user-pi9po1vi9j
@user-pi9po1vi9j Жыл бұрын
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!
@Algovibes
@Algovibes Жыл бұрын
Thanks a lot Mansur! Did some videos on that already (e.g. VaR). Is that what you are looking for?
@ramshankarmukherjee1364
@ramshankarmukherjee1364 Жыл бұрын
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 🙏🙏🙏 .
@gianlucamessina2231
@gianlucamessina2231 Жыл бұрын
thanks for the video mate, interesting stuff!
@Algovibes
@Algovibes Жыл бұрын
Glad you think so Gianluca, thanks a ton!
@gianlucamessina2231
@gianlucamessina2231 Жыл бұрын
Seems difficult to test properly and avoid overfitting though given these strategies don't do many trades
@felipetradeenergia
@felipetradeenergia Жыл бұрын
great video, thank you very much
@Algovibes
@Algovibes Жыл бұрын
Very welcome! Thanks a lot for watching and leaving a comment :-)
@sz8558
@sz8558 Жыл бұрын
Great vid thank you...Would be cool to plot the cumulative sum of the returns to see how stable returns are and drawdowns....
@Algovibes
@Algovibes Жыл бұрын
Thanks mate. You can just take the cumulative prod (cumprod()) instead of the prod and then plot it.
@bryan-9742
@bryan-9742 Жыл бұрын
whats really helpful, and tricky, is taking your videos and turning them into Classes. so tricky sometimes.
@aricanto1764
@aricanto1764 Жыл бұрын
Facts. Surely a bunch of commenters start a git if his videos with python classes lol
@Algovibes
@Algovibes Жыл бұрын
Will do so in the next video! :-)
@gauravpainuly1800
@gauravpainuly1800 Жыл бұрын
Nice
@gianfrancosilvestri2155
@gianfrancosilvestri2155 Жыл бұрын
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?
@Algovibes
@Algovibes Жыл бұрын
Thanks a ton! Also great suggestion, thank you
@whemmakatatt5311
@whemmakatatt5311 Жыл бұрын
Ty good video
@Algovibes
@Algovibes Жыл бұрын
Thanks for watching mate
@itayhilel2168
@itayhilel2168 Жыл бұрын
nice, lets test it on crypto!!
@voravitrakwong
@voravitrakwong 7 ай бұрын
Good vdo.
@Algovibes
@Algovibes 7 ай бұрын
thanks buddy. appreciate your comment!
@easyxpress
@easyxpress Жыл бұрын
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?
@armanyaseen213
@armanyaseen213 Жыл бұрын
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
@Algovibes
@Algovibes Жыл бұрын
Hey Arman, Yes! Will exactly show how to do that in the next video :-) stay tuned
@TexasTrucker-nx8dd
@TexasTrucker-nx8dd 6 ай бұрын
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.
@wenling3487
@wenling3487 Жыл бұрын
Is there a python package which can read the raw data of ninjiatrader?
@cemsekerci6345
@cemsekerci6345 Жыл бұрын
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....".
@Algovibes
@Algovibes Жыл бұрын
Hey Cem, no in the beginning we say "if we are NOT in a position AND we have a buying signal" -> Buy!
@TheEcherriman
@TheEcherriman 7 ай бұрын
Thanks for this. I am using finta TA and the RSI differs from yours - which one are you using please ?
@Algovibes
@Algovibes 7 ай бұрын
Welcome mate! Using the RSI from the library here. Has a default lookback of 14. Cheers
@Tomydispik
@Tomydispik 7 ай бұрын
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
@bryan-9742
@bryan-9742 Жыл бұрын
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.
@its_code
@its_code Жыл бұрын
Very interesting 😍😍😊😘😘🤩💕💕❤️
@Algovibes
@Algovibes Жыл бұрын
thanks buddy
@its_code
@its_code Жыл бұрын
@@Algovibes💕💕❤️❤️❤️❤️🤩
@k2icc
@k2icc Жыл бұрын
Maybe an MA or something to filter the larger fall at the end?
@Algovibes
@Algovibes Жыл бұрын
Probably not a bad idea! Thx for watching :-)
@k2icc
@k2icc Жыл бұрын
@@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.
@emmank3710
@emmank3710 Жыл бұрын
please how do you take profit
@Algovibes
@Algovibes Жыл бұрын
You mean like instead of the Stop Loss add a Target Profit?
@traderbsas
@traderbsas Жыл бұрын
Shared code
@Algovibes
@Algovibes Жыл бұрын
Sure! You get access to the Code by becoming a Tier-2 channel member here: kzfaq.info/love/87aeHqMrlR6ED0w2SVi5nwjoin Looking forward to welcome you! :-)
@kleberpython2063
@kleberpython2063 Жыл бұрын
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
@Algovibes
@Algovibes Жыл бұрын
Yea, that's quite interesting indeed.
@wickedgummybear3104
@wickedgummybear3104 Жыл бұрын
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.
Beautiful gymnastics 😍☺️
00:15
Lexa_Merin
Рет қаралды 15 МЛН
100❤️
00:19
MY💝No War🤝
Рет қаралды 23 МЛН
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 60 МЛН
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 81 МЛН
UiPath Test Suite
16:14
UiPath Community
Рет қаралды 10
The Math Equation That Beat Wall Street | Jim Simons vs. EMH
14:11
Chaos Theory Institute
Рет қаралды 243 М.
Automated Support and Resistance Detection in PYTHON
19:25
CodeTrading
Рет қаралды 62 М.
25 Nooby Pandas Coding Mistakes You Should NEVER make.
11:30
Rob Mulla
Рет қаралды 264 М.
Trading with Python: Simple Scalping Strategy
13:47
CodeTrading
Рет қаралды 87 М.
Predict The Stock Market With Machine Learning And Python
35:55
Dataquest
Рет қаралды 654 М.
Beautiful gymnastics 😍☺️
00:15
Lexa_Merin
Рет қаралды 15 МЛН