Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

70/1030 EMA AFL code for Amibroker

1 min read

Here is a simple logic on how to plot 70min/ 1030min 1min EMA in your Amibroker software. 70/1030 EMA crossover is a popular strategy with the yahoo 5min charts. And if you tried with amibroker with the same 70min and 1030 min you would probably end with the wrong ema plots in a 5min timeframe. However, here is a simple tactic one can follow to bring 70/1030 ema crossover 1min plot into 5min charting.

The possible logic behind the 70min and 1030 min plot in the yahoo finance chart is “Yahoo Charts computes the 70min and 1030 min EMA for the 1-minute candles. and plots the same in 5 min charts. i.e the actual EMA to be plotted in amibroker for 5 min charts are 70/5=14 EMA and 1030/5=206 EMA which plots the charts exactly as in Yahoo Finance charts.

I had plotted the same for the 5min charts for nifty with Buy/Sell Signal. Buy/Sell Signal will be produced whenever the EMA crossover happens. 

Strategy Used

used Moving Average Crossovers in Amibroker: 206 EMA & 14 EMA
Charts Used: 5 min Charts

Go Long Rules
If The faster line (red ) goes above the green – > Close shorts & immediately go long.

Go Short Rules
The faster line (red ) goes below the green – > Close longs & immediately go short.

No other Indicators Needed… Works Well Especially in Volatile Times

Stop Loss
An initial acceptable range for the stop depending on your comfort level can be put. As the Nifty moves in your direction, immediately put the stop at the purchase price + brokerage as soon as possible.

Download the 70/1030 EMA Strategy AFL code

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );



Buy = Cross((EMA(Close,range1)),(EMA(Close,range2)));
Sell = Cross(EMA(Close,range2),(EMA(Close,range1)));
Short = Sell;
Cover = Buy;

// plot expanded average

Plot(EMA( Close,range1), "70min-ema", colorRed );
Plot(EMA( Close,range2), "1030min-ema", colorGreen );

/* Plot Buy and Sell Signal Arrows */
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

[Free Course] Mini Certification on Amibroker AFL Programming

Interested in getting to know the basics of Amibroker AFL Programming then here is a free live training course to access hands-on training on...
Rajandran R
53 sec read

Intraday Straddle Execution Module – Amibroker for Upstox Users

This tutorial focus on how to automate your time-based index straddle/strangle management with intraday stop-loss levels with time-based entry and exits using Algomojo Platform...
Rajandran R
11 min read

Smart Button Trading Module – Trade Automation – Amibroker…

This Algomojo Button trading module provides 4 modes of the button to place orders with a single click directly from Amibroker using simple smart...
Rajandran R
4 min read

14 Replies to “70/1030 EMA AFL code for Amibroker”

  1. Its a nice indicator … thanks 4 that …
    Can u plz give us the afl code for Stochastic used in yahoo charts…

  2. Sir,

    i have been following MACD of yahoo 5 days. I m trading zero line cross over with very good results. but unable to write the AFL code for the same. pl help



  3. Can you add ROC indicator to your Nifty Intraday Chart?


  4. Hello Sir

    Thanks a lot for the wonderful ALF, sir, one request, can you provide any site or any link where i can download the eod data for dow jones?

    I want to download eod data for dow jones but cant find any where?

    Sir one more thing, can you create a 3min by 15 min afl for amibroker, as per this 315 i have tested with yahoo charts, gives good signals but dont know how to write afls, can you share please

    wanted to use it to scan share for delivery based.



    Keep Rocking

  5. i am new to amibroker using a trial version(5.30). is it possible to use this afl codes for trial(expired 30 days) version.pls reply

  6. sir,

    For AMI broker users your site is an excellent resource.
    I am a regular follower of your site.

    Iam using Amibroker 5.20,and iam downloading EOD using Getbhavcopy.
    I have NSE Data from 2003 onwards. My problem is when ever i format my system/ after sytem crash, i reload Amibroker and restore NSE data but the Splits, bonus etc are to be mannually adjusted for each scrip every time Symbol->Split->OK. is there any way by which ican run the split, bonus on all scrips automatically.Also iam manuually doing the mereger like colgate-> colpal etc.and is there any way to take the backup of the upto date adjusted NSE data, so that the same can be rstored later which saves lot of time.

    pls tell me how to get the Face valu and Bookvalue of the scrip in Amibroker. if iam running Market quick review i could not get the Fv and BV against the scrip.

  7. DEAR SIR,

    as u hav shown that on 70-1030 min nifty positional call can b taken and u hv also mentioned tht use it on 5 min charts than u convert 14-206 min setting will it work same . nifty positonal call can be taken on 14-206 ema or on 5 min chart 70-1030 ma has to b ploted for positional call
    looking for ur response


  8. it is working good, but …………

    i think 20ema/200sma it is also good for intraday,
    i dont know how to creat afl, any one do that

    best regards

  9. hello… i want some settings for stochastic slow in 15mins TF for amibroker…

    there parameters fast %k, Slow%k and Slow %d… fast %k is the standard formula and slow k% is sma of fast %k, slow %d is sma of the slow %k… the settings i kept is 8period fast k%, 3period slow%k and 4 period slow%d…

    i want to know is m i right with these periods… if not what should i ideally be…? thanks

  10. Hi

    Above EMAs of 1 minute chart are plotted on 5 minute charts, is it possible to place 15 minute moving averages on 5 minute chart..


  11. Hi,
    Thanks for the wonderful strategy! I wanted to check what was this indicator was pointing to on Jan 14 (before Rajan’s surprise Rate cut!)? Was it long or short? Is there any way to check this back data? Thanks in advance for the answer!

Leave a Reply

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