ZLEMA ATR Long Only Trading System – AFL code

ZLEMA ATR Long only trading system is a mechanical strategy for higher time-frames. The trailing stop loss is quite adaptive and adjustible in the down trends to revise it stoploss downwards on its own and the buy or sell decision is taken only at the end of the candle. visit here to know more about Zero Lag EMA indicator

Nifty Spot Hourly Charts
Nifty Spot

1)The green line indicates trailing stop for longs
2)The Red line indicates trailing stop for shorts
3)The Green Arrow indicates longs
4)The Red Arrow indicates shorts

1)Trailing Stoploss Lines
2)Buy/Sell Signal Added
3)Magnified Market Price at the right top corner
4)Timeleft counter to idenfity the end of the candle
5)Non Repainting – Arrows will form only after the end of the candle. No arrows will disappear once the signal formed.

Recommended Timeframes
Preferably higher timeframes like 30min,hourly.etc. Perfectly suits for positional traders who intersted in Long and Exit strategies. And moreover it is a carryforward strategy and not a intra-day strategy though. But work pretty good in high volatile environment.

Backtest Results for Nifty Spot Since March 2009 to May 2014
Backtest Results
Tested with 2 lots of Nifty and with per leg brokerage/slippage of Rs100 included.

Equity Curve
Equity Curve


Profit Table
Profit Table

Steps to Install
1)Download ZLEMA ATR AFL code
2)Unzip ZLEMA ATR Trading System to local folder
3)Copy ZLEMA ATR.afl file to \program files\amibroker\formula\basic folder
5)Open Amibroker and Open a New Blank Chart
6)Goto Charts->Basic Charts and apply/drag-and-drop the ZLEMA ATR Trading System code into the blank chart
7)Bingo you are done. Now you will be able to see the ZLEMA ATR Trading System indicator with Buy and Sell signals.

Amibroker 5.5 and above

Related Readings and Observations

  • Zero Lag EMA 15min Strategy for Nifty and Bank Nifty Today we are going to discuss about Zero Lag EMA 15min strategy for Nifty and Bank Nifty and how effective it is in terms of generating returns and smoothing your equity curve. Almost all […]
  • How to do Portfolio Backtesting in Amibroker Portfolio Trading (Trading with Multiple Stocks/Instruments) is the next big step in a traders life once he understand that he want to reduce the volatility in his trading strategy. And […]
  • N Bar High-Low Dots – Amibroker AFL code Here is a simple strategy that alerts by plotting dots over the candle whenever a new N bar high-low is made. The below chart shows Nifty future EOD charts and the Yellow dots in this […]
  • William VIX FIX Indicator – Amibroker AFL Code We know that VIX most of the time reflects the investor/traders sentiment. When VIX is higher it means lot of fear in the market and lower VIX indicates lack of fear in the market. The […]


  1. Kourla Ravi Shanker Reddy says

    Why this strategy is long onl?. Can’t we use the same for short and cover also?

    • says

      Yes you can use for shorting too. But if you are combining both long and shorts all together the risk is gonna increase a little bit. And shorts are not much favorable for this strategy as it makes 1/5th of the profits generated by shorts compared to the longs. All you are wasting your efforts, money, time to generate a little money by increasing your risk.

      • Kourla Ravi Shanker Reddy says

        Thanks rajendran. Got it.
        one more question. How is this strategy is different from original zl ema? Did u only added support for stop loss and other features around the base zl ema?

        • says

          ZL EMA is nothing but a just crossover between EMA and ZL-EMA whereas here ZLEMA ATR is a ATR based trailingstop included rest the coding explains better.

    • says

      Hi currently dont do freelancing for users requirements. I do code my own strategies. You can get it down with lots of freelancers available worldwide for converting a AFL code in MT4 code.

Leave a Reply

Your email address will not be published. Required fields are marked *