Wednesday, June 11, 2014

Learn AFL code : EMA cross over system part 1

In our last post we learned about basic structure of AFL coding, and I said that, you can make your own buy and sell signal logic and can use it. So lets make some sample buy and sell signal.
I am taking a very simple trading logic, that is "EMA cross over system". We all know that is any "EMA cross over system we a higher time frame EMA and one smaller. Once the smaller EMA crosee higher a buy signal is generated and revrse is true from sell signal.

May be you have EMA/MA cross over system that uses EMA20 and EMA50. I am writing the code for it,


Buy= Cross(EMA( C, 20 ), EMA( C, 50 ));

Sell= Cross(EMA( C, 50 ), EMA( C, 20 ));

Now here replace 20 and 50 with your desired value. This will generate nice signal for your 20/50 EMA cross over system. Go long when EMA(20) crosses EMA(50). and sell in opposite. Go to part two for complete chart.

Debarghya Mukherjee
Mobile: (+91)-9038787021
Email: debarghya_mkr@yahoo.com

No comments:

Post a Comment