Simple EMA Scalping Trading Strategy Backtest In Python (Part 1)

  Рет қаралды 13,370

CodeTrading

CodeTrading

Күн бұрын

Simple scalping Trading strategy using 3 exponential moving averages backtested in python, the scalping strategy is explained and the python code also in Jupyter notebook. The Python notebook is
🍓 If you want to follow structured courses with more details and practice exercises check my "About" page for Discount Coupons on my Udemy courses covering: Python basics, Object Oriented Programming and Data Analysis with NumPy and Pandas, ... more courses are on the way drop me a message if you have a particular interesting topic! Good luck!
available for download from the link:
drive.google.com/file/d/1ufhD...
#TradingBot #PythonCoding #forexanalysis
00:00 Scalping Strategy Introduction
02:24 Python Code For Algorithmic Strategy
11:53 Backtesting The Scalping Strategy
13:02 Scalping Backtest Results

Пікірлер: 47
@krzysztofkubiak3578
@krzysztofkubiak3578 2 жыл бұрын
Really good job!! It is my favourite channel about AlgoTrading :-)
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thanks a lot for your supportive comment, I hope to find a winner strategy safe enough I could recommend in one of those videos
@ClearVista
@ClearVista 2 жыл бұрын
Going on a binge of you channel. Absolutely love the videos. I use IC Markets for my broker and cTrader as my platform but even though cTrader is in C#, I use Python for researching. I'm going to work on translating the code to C# and testing it there as soon as I can. I really appreciate the time you put in. You deserve a lot more than 2.6k subscribers.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thanks a lot for your support 😊 it's nice to read this and know these videos are of help. Honestly most of the strategies look promising at first sight but then when it comes to long term backtesting the real outcome is shown that's one true message behind these videos. Good luck in your research.
@ClearVista
@ClearVista 2 жыл бұрын
@@CodeTradingCafe There's a hell of a lot of randomness in the charts. I think I'll always stick to manual trading but using this to get a feel of what what could be a good starting point for strategies is fun for me.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Yes manual trading still provides less risk, I also run few bots to send alerts on my phone when some conditions are true at the same time (RSI, EMA slope and let's say price close to a strong support/resistance on the daily timeframe) this way I can log in and check if it's a real opportunity. I agree ...numerical tests are fun :)
@a.winath4024
@a.winath4024 2 жыл бұрын
Thanks again for sharing such videos!
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thank you for your support I am glad videos are of help
@souvikdey3910
@souvikdey3910 2 жыл бұрын
great sir. will be waiting for its optimized version with a flexible return.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Yes it was long and tedious to optimize, I don't like scalping I guess
@jensasp1806
@jensasp1806 2 жыл бұрын
Hi, some ideas, which maybe can be used in an update … Hull moving average (faster/more responsive), choppyness as filter, and two ways of muliple timeframe: a) trend from 1hour as filter combined with entry/exit on 15 min, and b) the 1 hour trend based on 15min data with Rolling 1h dataframe updated every 15 minute, ie the 1h trend dataframe is ‘shifted’ every 15m ? …… THX for great videos and code👍👌🙌
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thanks a lot, in fact trend on a timeframe while trading another timeframe is a good idea, I will probably make a specific video on this.
@danielpartyhead2234
@danielpartyhead2234 Жыл бұрын
@@CodeTradingCafe yeah. hull second best. firs in my oppionion is Jurik MA or JMA. in init - self.sma1 = self.I(ta.jma, pd.Series(self.data.Close), self.p1) , from import pandas_ta as ta . only problem its calculats 100 times longer :)
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you for sharing, it's ok for a function to be slow as long as the results are good in this case. I will have to try it!
@planb5386
@planb5386 2 жыл бұрын
thank you
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Good luck with your program
@sibiljas3628
@sibiljas3628 2 жыл бұрын
nice.we are luck.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thanks for watching, good luck, optimization video coming next week
@mohakaz4157
@mohakaz4157 2 жыл бұрын
Excellent. Please learning api conncet bybit for sell and buy
@santhoshdasari7
@santhoshdasari7 2 жыл бұрын
Thanks a lot for sharing…
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thank you for your support
@santhoshdasari7
@santhoshdasari7 2 жыл бұрын
R u still planning to make a video on 2 period RSI (10 and 90) and ema slapping strategy
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
@@santhoshdasari7 Yes ... It's coming, which timeframe you are interested in?
@santhoshdasari7
@santhoshdasari7 2 жыл бұрын
@@CodeTradingCafe u r the guru for this strategic…. Following u for some time u will optimize it for sure… I really like the way u explain and keep the things simple… keep up the good work…
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
@@santhoshdasari7 thanks a lot for the compliment 🙂
@thyagolukas
@thyagolukas Жыл бұрын
can you help me complete a bot in python for iq option? Based on EMA20, the bot will open an order if it is trending at minutes: 00, 15, 30 and 45; expiration in 5 min. And to make it more assertive, I would open the order if it was in a strong trend using other trend functions with tredingview or investing. the trend thermometer. and the cycle function for recovering a possible loss. By your videos, you are an excellent programmer. I await your reply. thanks in advance.God bless you.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, thank you for your support. I am not familiar with all the indicators on tradingview and I don't use the platform, I rely only on python gives me more control.
@thyagolukas
@thyagolukas Жыл бұрын
@@CodeTradingCafe OK!! Tks
@garychan2833
@garychan2833 Жыл бұрын
I am getting an error on line 2 df= pd.read_csv... which reads: ~\anaconda3\lib\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs)
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
I am not sure why is that, do you have any other error messages? try to check your pandas is properly installed (which I assume it is) or any left typos in the code, it happens. Let me know if it works.
@boamahmarcus4002
@boamahmarcus4002 Ай бұрын
Maybe use the ATR as a stop loss?
@CodeTradingCafe
@CodeTradingCafe Ай бұрын
Yes I tried it in other videos, can't remember which ones, but in the recent videos I frequently include the ATR for SL and TP levels.
@kodzuvu
@kodzuvu 2 жыл бұрын
Bob Volman strategy is the best
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thanks I will check it out, if I like it I will backtest it
@user-oq4do4kj1o
@user-oq4do4kj1o Жыл бұрын
I think in your code these numpy conditions conditions = [ ((df['EMA50'] < df['EMA100']) & (df['EMA100'] < df['EMA150']) & (df['slopeEMA50'] < 0) & (df['slopeEMA100'] < 0) & (df['slopeEMA150'] < 0)), ((df['EMA50'] > df['EMA100']) & (df['EMA100'] > df['EMA150']) & (df['slopeEMA50'] > 0) & (df['slopeEMA100'] > 0) & (df['slopeEMA150'] > 0)) ] The first condition should represent the bearish signal and second condition should represent the bullish signal right ? Because short term EMA < medium term EMA which is less that long term EMA, also slopes are negative means that is a downtrend.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
That is correct the first set of conditions are for downtrend the 2nd for uptrend. Good luck!
@Max-yz4dg
@Max-yz4dg 2 жыл бұрын
what is this software where you write your code ?
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Hi it's python jupyter notebook if you are not familiar with python check my playlists there is one where you can learn how to do financial analysis in Python
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Check this list Python Learning: kzbin.info/aero/PLwEOixRFAUxZVV0XNWlapem1yoRA4rt_O
@adinan1000
@adinan1000 5 ай бұрын
Hi, where is the file: "EURUSD_Candlestick_15_M_BID_31.01.2019-30.01.2022.csv" ?
@CodeTradingCafe
@CodeTradingCafe 4 ай бұрын
try this one it should be recent drive.google.com/file/d/1AsOqh_5xWv5hTfFnYwAUlSj-HlW_fND1/view?usp=sharing
@delhitepawan5804
@delhitepawan5804 2 жыл бұрын
learn new things for algo trading
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Hi, I am not sure I understand what you mean
@rupamgohain3890
@rupamgohain3890 2 жыл бұрын
language Hindi
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Sorry I wish I spoke Hindi, you can still download the code and figure out what it does. Good luck!
Trading with Python: Simple Scalping Strategy
13:47
CodeTrading
Рет қаралды 88 М.
Советы на всё лето 4 @postworkllc
00:23
История одного вокалиста
Рет қаралды 4,5 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 11 МЛН
Quant Strategy: Pairs Trading Algorithm (Mean Reversion)
15:00
Spencer Pao
Рет қаралды 58 М.
Martingale Trading Strategy Backtesting For Algorithmic Trading
16:06
Automated Price Break Out Detection: Algorithmic Trading In Python
16:34
The Easiest 1-Minute Scalping Strategy: 3-EMA Trading Strategy
10:02
Trading Journal
Рет қаралды 875 М.
Automated RSI Scalping Strategy Tested In Python
33:32
CodeTrading
Рет қаралды 14 М.