Algorithmic Trading Course in Python (Exponential Moving Average EMA)

Published: 20 February 2024
on channel: YouDomo
673
27

#python #algorithmictrading #tradingstrategy #technicalanalysis #codingtutorial #crypto

Python Trading Algorithm using Exponential Moving Averages EMA Lines.

00:00 - 00:58 Import Lines and Open Sources

In this coding tutorial, we will leverage the open-source library yfinance to call the Yahoo Finance API and gather stock data for further technical analysis. The technical analysis in this video is Exponential Moving Average.

00:59 - 08:10 Get Data from Yahoo Finance in Python

Leverage open-source libraries to get Yahoo Finance data in Python! In this video we use yfinance; however, we create our custom python function to perform date math and fix a date issue. Check out my video on How to Get Stock Crypto Data from Yahoo Finance in Python:    • How to Get Yahoo Finance Data in Python #p...  

08:11 - 11:03 Calculating EMA Lines

An Exponential Moving Average (EMA) is a type of moving average that places more weight on recent data points, making it more responsive to changes in price trends compared to a simple moving average (SMA).

A bullish cross occurs when a smaller window EMA crosses a larger window EMA from below. In contrast, a bearish cross occurs when a smaller window EMA crosses a larger window EMA from above.

11:04 - 18:33 Buy and Sell Signal Logic

Here is the heart of the trading algorithm where we make rules for buy and sell signals. If a bullish cross occurs, then flash a buy signal. If a bearish cross occurs, then create a sell signal.

18:34 - 28:29 Matplotlib Plotting

Plot the asset close price, technical analysis, and the buy and sell signals so we can visually see the trading algorithm at work.

28:30 - 39:34 Back Testing Algorithm

Now that we have an Exponential Moving Average (EMA) inspired algorithm we need to test whether or not it is profitable. To do this, we can create our own back testing algorithm which tracks the performance of both the algorithm and the asset itself. The benchmark is the Bought and Held strategy which tracks the asset's performance. The trading algorithm must beat the bought and held strategy to be worthwhile.

39:35 - 48:51 Explore!

Let's explore our brand-new trading algorithm! Of course, historic performance does not mean future results. Intrendias is not financial advice. I hope you enjoyed coding alongside with me and found the python coding tutorial helpful! You now have a trading algorithm that leverages the Yahoo Finance API through the open source yfinance package, measure technical analysis EMA lines with pandas, and created logic to make buy and sell signals. We also created a back testing algorithm that calculates the sum of dollars final value and percent change in market value. Personally, I would prefer a stronger, more robust algorithm that tracks more data and analysis compared to this EMA algorithm, but this EMA algorithm can potentially offer good entries and serves as a great starting point in creating a super cool and effective trading algorithm. For more coding, Check out the Automated Fibonacci Retracement Tool video and the Algorithmic Trading Course in Python coding video for more python tutorials. Happy trading and happy coding.

Like and comment down below if you enjoy python, technical analysis, algorithmic trading! Be sure to subscribe to not miss out on the next episode. Thank you for coding and watching with me!

Intrendias Website: https://www.intrendias.com/
Thank you for watching and your support!:   / intrendias  
Catch me on Instagram:   / intrendias  
Catch me on Threads: https://www.threads.net/@intrendias
YouTube Channel:    / @intrendias  

*Intrendias is not financial advice.


On this page of the site you can watch the video online Algorithmic Trading Course in Python (Exponential Moving Average EMA) with a duration of hours minute second in good quality, which was uploaded by the user YouDomo 20 February 2024, share the link with friends and acquaintances, this video has already been watched 673 times on youtube and it was liked by 27 viewers. Enjoy your viewing!