Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in and Co-Creator of Algomojo (Algorithmic Trading Platform for DIY Traders)

Simple Triple Moving Average Crossover – Amibroker AFL Code

58 sec read

Here is the very simple and classical example to build a triple EMA (Exponential Moving Average Crossover system). System is quite popular if anyone (trader/investor) is a newbie to classical technical analysis. In this AFL the triple moving average buy, sell signals are coded and comes 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.
[wp_ad_camp_5]

 
However like any other trend following system this system too has its own disadvantages. Catches signals very late, sometimes at the peak. And it could withstand the noise in a sideways market to some extend avoiding multiple whipsaws compared to a double moving average crossover system.

Nifty Futures Hourly Charts with Triple EMA Crossover
Triple Moving Average Crossover

https://gist.github.com/1daa3297a1ebeeeab37a

How to Setup the Amibroker AFL

1)Download Triple Moving Average Crossover – Amibroker AFL Code.
2)Unzip Triple Moving Average Crossover.afl to local folder
3)Copy Triple Moving Average Crossover.afl file to \\Program Files\\Amibroker\\Formula\\Averages\\
5)Open Amibroker and Open a Blank Chart
6)Goto Charts->Averages and apply/drag-and-drop the Triple Moving Average Crossover code over blank chart.
7)Bingo you are done. Now you will be able to see the triple moving average crossover with buy and sell indicators.

Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in and Co-Creator of Algomojo (Algorithmic Trading Platform for DIY Traders)

Plotting Day Wise Equity Curve using Amibroker

We know that Amibroker provides an equity curve for the whole strategy. Is there a way where we can build a simple Day Wise...
Rajandran R
1 min read

Simple Open Range Breakout Trading System with Exploration –…

Opening Range is very often a measure of security high and low generally monitored by breakout traders to gauge the sentiment of the market....
Rajandran R
5 min read

Range Filter – Trading Strategy – Amibroker – Better…

Range Filter is a non-ATR-based trend following strategy inspired by Tradingview Pinescript coder - DonovanWall. According to him, Range Filter is an experimental study...
Rajandran R
4 min read

15 Replies to “Simple Triple Moving Average Crossover – Amibroker AFL Code”

  1. Thanks very much.

    please confirm these indicators can be carried over for the next day also ?

  2. Rajendran,

    Can you please suggest a correct S/L for this strategy, thanks!

  3. Dear Rajandran, is there a AFL for the below mentioned strategy

    INDICATOR:

    EMA 5,20,50 Period
    VMA 5 Period
    MACD Short Period 12,Long Period 26,EMA Period 9
    RSI 10 Period
    SSTO K Period 14,D Period 3

    BUY:CROSS EMA5 & EMA20 (upward)
    EMA20>EMA50
    RSI INCREASING OR ABOVE 50
    SSTO %K>%D

    SELL:CROSS EMA5 & EMA20 (downward) OR CROSS %K & %D (downward) OR %K<%D

    kanakaraja

  4. how did u get your parameter periods in 3 Ema’s like 3, 2, 300, 1, 10 ?…do you have any parameter periods that i can use for EMA8. >SMA 20..>SMA 50..>SMA 100….so i can make also a buy signal when this 4 moving average aligned and below the price?…thanks very much sir

    1. you need to understand Amibroker AFL functions to know better. To code your own strategies you need to be familiar with AFL code.

      1. i already have the code for it …what is lacking is the parameters..for ema8, sma20,sma 50,sma 100…can u please provide it for me..or post an afl about it…thanks boss,,:)

  5. Hi Mr Rajandran. I am from Singapore. Do you have codes on Atlas Line for MT4. I tried searching the web but to no avail. Thank you very much and have a nice day ! Cheers!

  6. Hi Sir,

    If i add a line in this code that i will buy a script if it crosses 3 EMA > 13 EMA > 34 EMA. Suppose i get a list of scripts with buy signal and buy price and target price and stoploss and i want to backtest all those scripts which are given by this afl. Is there any way of backtesting these scripts automatically through any afl which would give me the profit/loss in each script for past 1 year or 2 year.

  7. can u suggest to enter into a profession of Real time data feed supply

    I am looking for data feed software

  8. sir i want 250 ema 180ema 120ema 50ema converging at one point (candle)
    if ema is above the candle then sell and if ema is below the candle buy
    i want alert output also for this
    hope you can help me

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More