What are Algorithmic Trading Strategies?

Asad Dossani
In the last newsletter, we discussed the types of market movements we could predict, and the types we could not. The natural next step is to learn how to predict these movements. Over the course of the next few newsletters, I'll reveal the approach I use to predict market movements.

Have you heard the term Algorithmic trading before? It may sound fancy or complicated, but it is conceptually simple to understand. A lot of traders apply algorithmic methods to predict market movements, myself included.

What is an algorithm? An algorithm is a set of instructions or rules. You can think of it as a list of instructions you need to follow every time you make a trade. If you have traded before, you most likely have applied an algorithm to you trades, even if you didn't call it that.

Let's look a simple example of a trading algorithm, that we could apply to any tradable asset. The algorithm uses the simple moving average (SMA) as an indicator. The SMA is average of the previous days' closing prices. We can calculate the SMA using any number of days that we want. This algorithm contains 4 steps to execute a trade:

  1. Calculate the 5 day SMA
  2. Calculate the 20 day SMA
  3. Take a long position when the 5 day SMA is larger than or equal to the 20 day SMA
  4. Take a short position when the 5 day SMA is smaller than the 20 day SMA

This type of trading strategy is commonly referred to as a moving average crossover strategy. Whatever name we give to it, it is really just an algorithm. This trading strategy contains 4 steps that tell us exactly how to trade this asset.

In practice, we usually apply more complex algorithms to come up with trading strategies. These algorithms will have more steps and the calculations may be more complex than a simple moving average.

Now that we have seen an example of an algorithm, let's take a step back and understand what the exact ingredients are for an algorithmic trading strategy. For a trading strategy to be an algorithm, we need to satisfy two criteria.

The first criteria is that the set of rules must completely specify our trading strategy. There should be no ambiguity. In the above example, we are told what to do with the 5 day SMA is larger than or equal to the 20 day SMA, and what to do when the 5 day SMA is smaller than the 20 day SMA.

We have covered any possible market situation, as the 5 day SMA will always be greater than, equal to, or less than the 20 SMA. This means that our algorithm tells us exactly what to do in each situation.

The second criteria is that we must use the past history of price movements to create the algorithm. Any algorithm that we create must specify our trading strategy as a function of the price history. This means that once I provide my algorithm with the historical data, it tells me how to trade.

In our example above, we need 20 days of past price history to execute the algorithm. This is because we calculate both the 5 day and 20 day SMA. Without the relevant historical data, we can't execute the algorithm.

Algorithms may also use past history of other assets as part of the set of rules. For example, you may specify a trading rule for a particular stock, where the past history of the stock index tells me how to trade that stock.

The opposite of an algorithmic trading strategy is a discretionary trading strategy. A discretionary trading strategy involves the use of a human judgment to make trades. A discretionary strategy may use the same indicators as an algorithmic strategy, but the decision to make a trade lies with the human trader rather than a set of rules.

When it comes to deciding between using an algorithmic or discretionary trading strategy, there are pros and cons to each one. This is a separate topic that we will save for a future newsletter. I have traded using both types of strategies in the past, though my current preference is to use algorithmic strategies.

It is important to keep in mind that an algorithmic trading strategy is not a magic formula. Like any trading strategy, algorithms are risky and there is always a chance that you will lose money.

But risk is not a bad thing. In fact, there is no reward without risk. If we want to make money in the markets, we have to take risk. If you've been reading this far, I'll assume that you are comfortable with taking risk.

Now that we understand what an algorithm is, the next step is to understand why algorithms work in the first place. What are the assumptions that go into creating an algorithmic trading strategies? When do algorithms work well, and when do they fail? Understanding these nuances of algorithmic trading will help you come up with the most profitable strategies. In the next newsletter, we will start tackling these important questions.

Have you traded algorithms before? Have you traded even a simple algorithm like a moving average crossover? How did it go? Let us know.

Get Asad Dossani's Best Short Term Investment
Opportunities Delivered Straight To Your Inbox!

Sign Up For Profit Hunter Today... It's Free!
We hate spam as much as you do. Check out our Privacy Policy and Terms Of Use
We request your view! Post a comment on "What are Algorithmic Trading Strategies?". Click here!
58 Responses to "What are Algorithmic Trading Strategies?"
Lakshman K
01 Aug, 2015
It is interesting for a person like me who wants to know the intricacies in trading strategy. I am not sure of 'long position' and 'short position', could you please elaborate on this 2 views...Like (1)
R Vijendra Rao
26 Jun, 2015
Informative. For a beginner, it is quite valuable info. Like 
30 Apr, 2015
Dear Asad I appreciate your algorithmic 5 ,7 or 20 days simple moving averages. These technical jargons are very nice listen to and pronounce but are these really effective in a volatile market when FII'S are running away on account of indecisive a nature of policy making. I have been associated with the market for more than two decades. Thanking you for this opportunity rgrds Like 
15 Oct, 2014
sir please update algorithmic method calculation in simplified system can i able to asses up or down, particular script in intra day trading Like (3)
15 Oct, 2014
sir please update algorithmic method calculation in simplified system can i able to asses up or down, particular script in intra day trading Like (1)
Vaidyanathan Jagannathan
03 Sep, 2014
If one can make profit by using only algorithm trading, then every one with a computer can make money. It is not simple as it looksLike 
04 Aug, 2014
Trading with technicals is like catching an elephant with a mosquito net. Sometimes u may feel u catched the elephant - then u will realize urself caught inside the net. Whether you follow fundamental or technical - there's is no foolproof method to protect one's capital. 5 vs 20, 3 vs 10, 1 vs 20, 1 vs 50 - we can follow anything with consistansy. At few place they can fail but overall if you take for longterm they will help a lot. Like (3)
03 Aug, 2014
i have used many algo , but loosing money, so i am confuged on AlgoLike 
16 Jul, 2014
What are algorithmic strategics?? Like (2)
07 Jul, 2014
Kindly explain in simple language with Photographs & Charts.Like (1)
06 Jul, 2014
Dear Assad, to calculate 5day SMA and 20 Day SMA which price should be taken ? the high. low or close price ? as rightly said by some investors, it will be good if u explain with examples as it will help layman like me to understand better. are these details available readily in any site where we can see these 5day & 20 day SMA ? Above all, it will be of great help if u show the answers for the queries of all investors, so that we can clarify all our doubts and there will be no need to repeat the same doubts Like (1)
sunil kabadi
04 Jul, 2014
basic trading informationLike (1)
01 Jul, 2014
Dear Assad, Thank you for sharing this great initiative. Please advise, in the 5 day and 20 day SMAs, which daily prices we have to take, opening, closing, low or high? What is the reason for specifically selecting the 5 and 20 day SMAs. Thanks,Like 
Gajaria Gokal
29 Jun, 2014
What is percentage correct strike rate in year when you this Strategy? Can we use other total days moving average?Like 
27 Jun, 2014
Congrats for this great initiative ! How can we identify crossovers for 5d & 20 day SMAs, that will give some appreciable change. Also how can we be sure that when 5day SMA & 20 day SMA are equal, this is always for Long position & not for short position! Thanks & RegardsLike 
Riyaz gilani
27 Jun, 2014
Pls explain with the photo graphs of sma or chartsLike 
Amuthan Iyer
24 Jun, 2014
I have seen that META STOCK gives a graph of 50 and 200 DMA. It is recommended to buy a share if the graph goes above the 50 DMA and sell when it is goes below 50 DMA. The strategy is supposed to be a defensive one to maximize the chances of protecting your capital.Like (1)
24 Jun, 2014
dear asad,really your 5&20day formula is very good for dradding call.pl.advice other good picks for term i.e.2years and more and also short term position.thanks .yours B.N.JHALike 
24 Jun, 2014
Hi Asad, really appreciate your & Equitymaster's knowledge sharing initiative. What I am not clear how these figures of 5 & 20 days are taken up? Is this a standard formula applied universally ? And also how this formula differs for a long term(> 3yr) and a short term position. Thanks. VaibhavLike 
24 Jun, 2014
Hi Asad, really appreciate your & Equitymaster's knowledge sharing initiative. What I am not clear how these figures of 5 & 20 days are taken up? Is this a standard formula applied universally ? And also how this formula differs for a long term(> 3yr) and a short term position. Thanks. VaibhavLike 
Mokhtar Ahmad
23 Jun, 2014
Dear Sir, I want to know about algorithmic trading strategies. I am new in this field , But I made some short term trading. Thanks & Regard, Mokhtar AhmadLike 
23 Jun, 2014
Dear sir. Well attemt to teach algorithms in simple words. My question is after applying strategy suppose we found long position is the result, for how long we wait??? Any specific time??? Please teach us with exampleLike 
suresh gujarati
23 Jun, 2014
dear Sirs, I have read your stock select , where you have explain with example. please do the same here. This big description difficult to understand. and give feeling lost the track. with regards Suresh Gujarati Like 
23 Jun, 2014
Hi I do the trading using moving average cross over , but many times we get false signaks that is 5 day average crosses the 20 day average several times and the number of points it moves is very low many times.Can you guide us how to spot a big move with this indicators ? mohanLike 
Joseph John
23 Jun, 2014
Sir Its very interested. I m waiting for the next.After getting the whole picture i ll definitely apply in the market. thanks. Like 
23 Jun, 2014
At The outset let me register my thanks for your sincere and selfless(!?) knowledge shearing with the retail investors like us.We want to be on the up collectively on the UP at the end of the day.I am dealing in stocks using my discretion and have ended in profits of a few thousands only,particularly luck driven-fresh stocks on public issues-allotement and sale immediately to see minimal profits for the past 15 years or so.From what I have undetrstood indian market does no work on principles. Please comment and guide.Like 
Mahagaonkar R.P.
23 Jun, 2014
Dear sir, Thanks for Algorithmic Trading Strategies Explanation. Sir, I need some more details on this strategis working with more examples on actual market values. Thanks & Regards, Mahagaonkar.Like 
B H Upadhyay
22 Jun, 2014
1. The example given here, is for casting the future based on the past. I need more clarification on : 1. The price movement depends on future market trends and other conditions like stable and forward looking government ( in our case) 2. International situation and its impact on the market. 3. Impact of government policy / change in policy. Above factors are enumerated for example. How algorithmic tecnic takes care of these factors. Please elaborate.Like 
D Roy
22 Jun, 2014
Thanks for enlightening such a nice article. Though I understand it is a very basic layout and the first step in algorithmic trading. In the last but one para you mentioned your future course of actions and I'd be eagerly looking forward to read it. On the top of that, I've one more request - you wrote, "we usually apply more complex algorithms to come up with trading strategies". Could you please illustrate the required formulas sequentially in an algorithmic format ? And also it'd be very helpful if you explain the practical problems/case studies where this formulas get used. You may not be able to cover everything in one go but in few newsletters hopefully you could be able to cover it.Like 
Rupesh Chendvankar
22 Jun, 2014
I use Algorithms in only to predict the fundamental impact whether positive or negative and fundamentals for me is sector behavior and its impact on the stock Like 
Sammir Naik
22 Jun, 2014
I am a long term Investor - 5 - 8 years. Does this apply to a long term Investor and if yes,would appreciate if you could please explain the same.Like 
Ramnik Malde
22 Jun, 2014
kindly tell us about tradingLike 
22 Jun, 2014
Hello Sir, I have already a portfolio.would I take any suggetion or benefit through it?Like 
22 Jun, 2014
The fundamental of trading is explained clearly. I would like to know more information before asking any questions/ clarifications as you your self may be expalining it in your future letters. Thank you very much for the effort.Like 
Mervyn Fernandes
22 Jun, 2014
Algorithmic Trading Strategies are base on the formula based on the Algorithmic set of rules. However which part of the 5 day SMA is used within the 20 day SMA to work out the Algo Stratergies. Is it the beginning or the end or a small sample within the 20 day SMALike 
gajendra patil
22 Jun, 2014
how to calculate (sma) for 1 days simple moving average ? pl clarify sir any stock Like 
22 Jun, 2014
Dear Shri. Asad The article is useful.However, u have not explained the reason for going long or short based on 20 day and 5 day SMA. Further, is there any software availble to work out this 5 day or 20 day average. regards CherianLike 
Nafiz Hakim
22 Jun, 2014
kindly illustrate in a simple way to understand. Like 
22 Jun, 2014
This partic.ular trading stragey or for that matter any strategy works in cases where turnover are very high . for example in large cap stocks. is my understating right?Like 
22 Jun, 2014
Hi, Can you please explain what is meant by long position or short position !!Like 
Vinay Agarwal
22 Jun, 2014
Never tried algorithm trading before. Will try and see how it goes.Like 
22 Jun, 2014
Very informative in simple terms for new investors, further what do you mean by long and short position. ? On TV 's experts mean Long mean buy and shot mean sell , Do you mean the sameLike 
Abdul Lathif
21 Jun, 2014
Ashwin Shah
21 Jun, 2014
It would be very helpful if example of specific stock.Like 
21 Jun, 2014
hi i have been using ema 3 and ema 13 crossover along with rsi and macd on 3 months chart for nifty index and it has given good result. i prefer trading either nifty index or banknifty . sometimes it gives false signal and then reverse.Like 
Lakshman Kumar
21 Jun, 2014
What do you mean by long position and short position?Like (1)
d d kochar
20 Jun, 2014
Pl cfm if 5 day closing rate /20 day closing rate is to be averaged out to decide on long stand or short stand. Letter elucidates the basic principle of trading which i have understood for the first time. Thanks & regards d d kocharLike 
Milan Mitra
20 Jun, 2014
It would be great help if an example by taking any stock is explained or shown for Algorithmic trading strategies.Like 
Muthuswamy Rajasekar
20 Jun, 2014
I don't know SMA is termed as ALGORITHMIC TRADING. I have recently tried taking 5 periods close and 20 periods high and 20 periods low to see the trend and pattern of price movements. I still need to know and be firm as to which crossover in candlestick of these SMA trendlline gives the sure upside or downside to take position.Like 
20 Jun, 2014
Complex things explained in a simple to understand way.Like 
Raj Dhillon
20 Jun, 2014
To overcome the hassles you encountered at the first hurdle - where you took a loss on your first trade - you gained gyan through books/matter etc. Could you suggest a few to introduce a novice to the world of trading with focus on risk management and foresight through TA / FA. If any sites where one could interact with others of the same ilk, are there, it would even be better. When I come across those who are attempting to reach for the stars, I've a yen to wipe the slate clean or send my mandala blowing in the wind just to start making a new one once again.Like 
20 Jun, 2014
i have not traded using an algorithm. I am familiar with moving averages though as i am a maths post graduate. i trade using advice from analysts. i make money 0n some transactions and lose most of it on others. Like 
GK Bhattacharya
20 Jun, 2014
Hello, Never traded based on any algorithm. Logic seems to be fine if there isn't any need of biasing based on any specific news on the stock. Studied the price movement of some of the stocks. There is a high and a low, on which the trend reversal is observed. The highs and lows also have a pattern, at times, over a period of time. Regards, GKLike 
vishnu agarwal
20 Jun, 2014
I hv indulged in discretionary trading in shares for a couple of years & had always wondered what is algo trading. Kudos for ur news letter, it really explains in such a simple way what algo trading actually means. Thanks hellova lot. RegardsLike 
20 Jun, 2014
Is this strategy applicable to long term investors also?Like (1)
madhav ranade
20 Jun, 2014
is this article relevant for retail investor ? ? ? pl tell us name of the broker who allows algorithmic trading for retail clients ? yr reply is eagerly awaited. madhav ranadeLike 
Vinod Saini
20 Jun, 2014
Nicely explained.Like 
20 Jun, 2014
Thank you for revealing a strategy on trading. In the given example 5 and 20 day SMA have been taken as a base. I would like to know if this will apply for day trade or short term positional trade or both. Also I would like to know what are the SMA combinations we need to consider for different types of trading (day as well as short term) Regards JaishankarLike (1)
We request your view! Post a comment on "What are Algorithmic Trading Strategies?". Click here!