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
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.
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
Tested with 2 lots of Nifty and with per leg brokerage/slippage of Rs100 included.
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
16 Replies to “ZLEMA ATR Long Only Trading System – AFL code”
hi nice work
Why this strategy is long onl?. Can’t we use the same for short and cover also?
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.
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?
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.
Nice back test, can you please send same formula code for MT4
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.
is there any zerolag EMA exist ? https://www.bigmiketrading.com/easylanguage-programming/8028-zerolagtema-zerolagdema.html
Yes Zero Lag EMA Exists try here
Thanks a lot for the system. One question is, if we use higher time frames like 4 hour, if the trend changes signal in the later part of the day, the new signal appears in next day morning by the time the market would have moved considerably, can we change the code to generate the signal at the closing time to take any trades..
Example: System is buy mode and the market went down considerably by end of 3:30 PM, the sell signal will appear tomorrow and say a possible gap down with getting on late trades. Say, if we get the get the sell signal say close to 3:30, we can initiate the trade on the same day itself..
Kindly request you to tell the modification of code..
The other way to solve such issues is you can always have a ATR based intial (intraday stop) to control such extreme movements.
Thanks for taking the time to give your inputs. I am a novice when it comes to programming and still learning TA, not really sure how to implement your suggestion.
Also, i think i failed to explain my question properly. Say, the system is in Buy mode for the couple of days, say for 4 hr time frame
Candle 1 (morning)–>Buy Mode | February 1st
Candle 2 (noon)–> Buy Mode Continuation | February 1st
Candle 3 (morning)–> Buy Mode Continuation | February 2nd
Candle 4 (Noon)–> February 2nd| The market started going down (candle still forming) and during market closing hours it has crossed the stop loss. Now the market has closed.
Next day morning when the market opened; immediately within a fraction of a second sell signal is appearing on Candle 4. & Candle 5 started forming… (Morning)–> February 3rd
I mean the sell signal on candle 4 has no relation with candle 5 & so instead of the signal appearing during the next day morning i.e. february 3rd morning, is there a possibility of the sell signal appearing during the market closing time of february 2nd..
I hope i was able to convey my thoughts clearly….
In the recent blog post ” Autocorrelation and Stochastic Mean Reversion Trading”,
a similar scenario was discussed.. Under Comments section, one viewer by the name
“Thanveer” asked “Action needed only at market opening?”
“”” Yes the system is designed accordingly since it is a EOD based strategy. You can either choose the days closing or at the next day open for your entry or exit. You can set the trade delay in the AFL code to 0,0,0,0 if you want to enter on the same day close to the market close.””
My doubt is similar, how can we change the code to enter the trade on the same day or close to the market close.
Your inputs are highly appreciated..
You can give a delay to the signals and can take a 1 or 2 bar of delay. But prepone the signals are not possible. It is like detecting/predicting the signals one bar earlier which is simply not possible.
Thanks for the inputs. Still with your permission, i want to probe further.. I will keep this simple,
Say we are observing a 3 hr candle forming from 12:30 PM to 3:30 PM & the signal has been buy since past week.
The 3 hr candle that is forming has is showing is continuously falling down and showing a big downtrend.
Market Close at 3:30 P.M. & 3 hr candle also completed at 3:30 P.M
Even though the candle is complete there is no Sell signal on this candle.. Only after the market opens next day, the Sell Signal is appearing on yesterday’s 3 hour candle.
I mean, fundamentally nothing is changing on next day market opening because we already have a completed candle..
Put another way, can we shave off the last few 2~3 minutes of the candle to say generate the signal at around 3:28 PM within the same day?
Sorry that i am asking so many questions.. just trying to take your help..
ZLEMA ATR Long only , is best for Bullish market conditions. Can we have in the same way ZLEMA ATR Short only, another AFL, for Bearish Market conditions.
Creating a strategy based on short only are really touch with math models. Once we did it will keep you posted here. As of now we havent done short only models. May be you can expect in the near term.