Python Backtest: Profitable Scalping Strategy with VWAP, Bollinger Bands and RSI Indicators

preview_player
Показать описание
This video shows a profitable scalping strategy fully backtested in python, this strategy uses the VWAP, Bollinger Bands and the RSI indicators for confirmation. The backtest shows profitable returns over 3 years of data with increasing equity. The algorithm was built in python and can be improved changing some of the parameters. Algorithmic scalping can be fit into an automated trading bot for automated profitability. Good luck, I hope you will enjoy this one!

💲 Discount Coupon for My Udemy course on Algorithmic Trading:

The python code download link:

the data file:
Рекомендации по теме
Комментарии
Автор

I appreciate a lot your content. The snippet that evaluate uptrend or downtrend is very slow, I've refactorized it removing loops and now is very fast. I share my update. Thanks for your effort and strategies. Alex.
df['Max_Open_Close'] = np.maximum(df['Open'], df['Close'])
df['Min_Open_Close'] = np.minimum(df['Open'], df['Close'])
df['upt'] = 1
df['dnt'] = 1
df.loc[(df['Max_Open_Close'] >= df['VWAP']), 'dnt'] = 0
df.loc[(df['Min_Open_Close'] <= df['VWAP']), 'upt'] = 0
df['sig_dnt'] = df['dnt'].rolling(backcandles + 1, min_periods=1).min()
df['sig_upt'] = df['upt'].rolling(backcandles + 1, min_periods=1).min()
df['VWAPSignal2'] = 0
df.loc[(df['sig_upt'] == 1) & (df['sig_dnt'] == 1), 'VWAPSignal2'] = 3
df.loc[(df['sig_upt'] == 1) & (df['sig_dnt'] == 0), 'VWAPSignal2'] = 2
df.loc[(df['sig_upt'] == 0) & (df['sig_dnt'] == 1), 'VWAPSignal2'] = 1

tradingbotconale
Автор

i have no words how to express my gratitude for this channel . Really your every video is making a change in my journey of algo trading .

rupindersingh
Автор

I was able to archive 3000% in return with this algorithm and some improvements in the parameters for Bitcoin 5m chart data, backtested from Jan 2022 until today.

lennard
Автор

Thank you for this video ! I began algo trading 1 year ago and your video helped me a lot. Seeing a scalping video on your Chanel is very cool, because there are no big ressources on scalping strategies that are reliable on YouTube and the internet in my opinion, so thank you !

davidhuber
Автор

First of all let me congratulate you for such amasing explanation and presentation. You explain very complex concepts of financial indicators and programming in only 15 minutes, that is spectacular. It will be very interesting to add some market sentiment analysis using Python to find news that impact stock price.

Maximus.
Автор

Hey! You can optimize parameters with methods like differential evolution. I'm not sure if that will do better but you can give it a try. Great video as always.

kro
Автор

Great video mate, thanks.
I am not a coder, but I try, with what I have learnt, to get an Algo that works. I am now a follower and look forward to learning more.

warwick
Автор

Great content! Perfectly synchronised with my current experiment

horexas
Автор

Before testing other parameters, try m1 candles to m30 and see which one yields the most win rate, very good content btw, cant wait for an update

sadootaqoo
Автор

at minute 10:37,

To verify that entry below the VWAP, perhaps you could calculate the difference between the VWAP and the Bollinger line, and from there if it passes a percentage it is taken as valid.

And maybe a bit more complicated to verify the sail in major or minor frames, and see a confirmation there...

Or adding more indicators like the MACD, EMA, or volume.

In addition, support or resistance could be taken into account (later video), or Wickokff accumulation zones, distribution zones, doing nothing at market openings (a lot of volatility), perhaps it could improve performance

fernando
Автор

I'm just getting into algo trading, no algorithm deployed yet but thats such a great video thank you! There is not much information available regarding scalping so thankful your channel exists!

Nico-uuyk
Автор

This is very good. Please bring more scalping and intrday strategy backtest. Can you please add a initial capital, so that we can see how much a particular amount will grow.

epiktrader
Автор

Fist at all thank for all your content, super great, Keep it up!!.

I checked Microsoft (5 min), doesn't look good:
Start 2022-07-15 09:30:00
End 2022-10-12 15:55:00
Duration 89 days 06:25:00
Exposure Time [%] 1.750102
Equity Final [$] 80.747453
Equity Peak [$] 102.614197
Return [%] -19.252547
Buy & Hold Return [%] -12.418022
Return (Ann.) [%] -57.487629
Volatility (Ann.) [%] 28.451232
Max. Drawdown [%] -31.08406
Avg. Drawdown [%] -31.08406
Max. Drawdown Duration 84 days 03:00:00
Avg. Drawdown Duration 84 days 03:00:00
# Trades 17

jorgecasas
Автор

Your videos are incredible, I'm going to review them all, I'm new, I just saw the first video today, sorry if I don't write very well, it's that I speak Spanish and English is not precisely my strong language and you could use a weighted moving average of 150 and 300 to see trends.

JohnQuezadaHuayamave
Автор

Was watching some of your videos today on detecting triangle and channel patterns so nice to see videos on this topics. Maybe you could also do a future video on harmonic pattern detection.

tmyersf
Автор

thx bro for this great video as usual, can i understand more the purpose of close trades when RSI >= 90 or RSI < =10.
if len(self.trades)>0:
if self.trades[-1].is_long and self.data.RSI[-1]>=90:
self.trades[-1].close()
elif self.trades[-1].is_short and self.data.RSI[-1]<=10:
self.trades[-1].close()

leobike-
Автор

Great content! Btw you can do the "VWAP Signal" calculation vectorized instead of iteratively so that it takes less than a second instead of the few minutes that takes in your code:

downtrend = df[["Open", < df.VWAP, # if the highest candle body is below vwap then all candles in the rolling window are below vwap

uptrend = df[["Open", > df.VWAP # if the lowest candle body is above vwap then all candles in the rolling window are above vwap

lautaa
Автор

Great content as usual. Definitely expand more on the strategy. Question: have you integrated your Python code with some trading platform? I mean, the code shows whether to buy or sell, but how the actual act of buying/selling is happening? Is it automated and Python does it for you or you do it manually based on the results of your code?

ЭльмарИдрисов-гэ
Автор

Thank you so much for sharing, may I ask what is the platform/broker you use to actually go live with these strategies? Aain thank you very much.

peterwestermann
Автор

Hi, thanks a lot for sharing this profitable strategy and I have a question about Max Drawdown Duration, it is 280 days right? I think it is actually 280 canldes which means in 5M time frame it is about one day, and because the default of backtesting module is 1Day time frame it calculate each candle as a day. Am I think correctly or not?

sajjadnaghshineh