Algo Trading using Triple Exponential Moving Average Crossover Strategy
Algo Trading using Triple Exponential Moving Average Crossover Strategy
Triple Moving Average Crossover
In this episode, we will build a simple triple EMA (Exponential Moving Average Crossover system). This system is quite popular with traders who are new to technical analysis. In this triple moving average AFL buy, sell signals are coded along with Scanning and Exploration functionality.
It is a simple trend following system where the system shows buy signal if
3 EMA > 13 EMA > 34 EMA and shows a sell signal if 3 EMA < 13 EMA < 34 EMA.
It works good in a trending market. When a stock/index is not trending (when it’s going sideways) the moving averages will intermingle and repeatedly crisscross each other especially during the consolidation phase.
A Trader can take advantage during this phase and can use this indicator to trade the next move or avoid an unnecessary trade.
However like any other trend following system this system too has its own disadvantages. EMA generally catches signals very late, sometimes at the peak.
On the bright side, it could withstand the noise in a sideways market to some extend by avoiding multiple whipsaws compared to a double moving average crossover system.
So we might get very less number of signals but the signals hold lot of weightage and the efficiency of the system is extremely high.
Moving on the script:
First, we are plotting the price candles.
And in the next set of lines, we are setting up 3 MAs and then we are plotting the 3 Mas in the charts in 3 different colors.
Then in the next 2 lines of code, we will be generating the buy and sell signals.
We will go long or buy if, 3 EMA > 13 EMA > 34 EMA
and we will go short or sell if 3 EMA < 13 EMA < 34 EMA.
Then we will remove the excess signals
Lasting we will plot the symbols for the different trading signals.
Now, let’s move to backtesting. We can run backtest of this strategy in multiple TFs.
For example, for the 15 min, long side trades, we will be getting 32% returns with 23% drawdown.
To know more, checkout:
Related
Getting started with algo-trading basics how to backtest a trading strategy? how to do algo trading in india? how to do algo trading in Zerodha? how to start with algo trading in india? how to use amibroker afl for algo trading? how to use pine script for algo trading? how to write algo trading scripts? Pine script tutorial videos step-by-step approach to start with algo-trading in India