Buy-Sell Signals:
Exponential Moving Average(EMA)
The project creates buy and sell signals using 3 different EMA periods. The strategy is as follows:
Open Long position if:
- Fast and mid EMA's are above Slow EMA and fast EMA crosses above mid EMA
Open Short position if:
-Fast and mid EMA's are below slow EMA and fast EMA crosses below mid EMA
Close Long position if:
-Fast EMA crosses below mid EMA
Close Short position if:
-Fast EMA crosses above mid EMA
where;
Fast EMA is the shortest period and Slow EMA is the longest period.
Importing required libraries:

Getting historical data and calculating EMA's:

Defining the conditions for long positions:

Defining conditions for short positions:

Defining a function to plot the chart:

Final output where buy and sell signals are plotted along with the price chart
Tickers, timeframe, time interval and EMA periods could be changed as desired.
