Showing posts with label Algorithmic Trading. Show all posts
Showing posts with label Algorithmic Trading. Show all posts

A Guide to Developing Algorithmic Trading Strategies

 
A Guide to Developing Algorithmic Trading Strategies - Trading is an excellent opportunity for one to make money. In fact, since the whole idea of day trading was introduced to ordinary people, the fact is that many people have quit their jobs to become day traders. In fact, I recently held a conversation with a young Kenyan guy who is making a fortune as a day trader. In the past, this was not possible because the software to execute the trades was not available. In addition, the information was not available to retail traders.

Many people have made and lost money in equal measures. In fact, I recently heard a story of a 45 year old banker who resigned from a top job to day trade. He ran out of cash a few days after starting out. Similar stories have been told a lot in the past.

Therefore, for you as a trader, it is very important to remain vigilant and to use viable strategies to avoid making these losses. There are hundreds of strategies out there. These strategies have been tested and proven for a very long time. Therefore, as a trader, the idea is to find a few strategies and use them in different types of markets. In this article, I will introduce you to algorithmic trading and highlight a few details about how to develop your own trading strategy.

What is algorithmic trading?

Algorithmic trading is a concept where you use different codes to align your technical indicators to that. In the past, algorithmic trading was a preserve of people with a lot of coding experience and expertise. Today, anyone without all this knowledge is able to develop his algorithms and executing them using a simple drag and drop strategy. Drag and dropping strategy is one where you take previously developed tools and dragging them in order. After you have developed your algorithmic tools, you can deploy them to execute the trades when you are there and when you are not. You can also develop algorithms to automatically alert you once a particular market meets your trading expectations.

See Also: Basics of Algorithmic Trading: Concepts and Examples

Key components of trading algorithms

To develop a good algorithm to trade, a number of items are needed. One, you need indicators. The whole idea is to act when certain criteria of technical indicators are met. There are many technical indicators that you can use. However, I recommend that you combine only a few indicators that you have mastered well in your trading experience. I recommend using the following: Moving Averages, Parabolic SAR, Stichastics, Relative Strength Index, and Relative Vigour Index. By having this set of indicators, you will be at the right direction.

The next component of algorithms is the inputs. These inputs are usually assigned to the other nodes to create an algorithm. There are usually four types of inputs available which include: string, integer, Boolean, and number.

Next, we have the variables. There are usually various corresponding variables for each data type. These data types are: Boolean, number, text, and date time. These variables will tell the algorithm what to do and when.

The next important aspects are mathematical features which include: +, -, and = among others.

Last but not least, the logic are very important. They include: And, and Or. For instance, you can direct the algorithm to open a buy trade when the RSI value is 29 and the Stochastics is at 28. Here, you can use both.

Backtesting

One of the most important aspect of developing algo tools is setting the duration. For a day trader, it would be erroneous to use long-term values such as a 200 day moving average. The fact is that it won’t tell you the right thing. Therefore, you should use short term durations in developing your programs.

After you have developed your Expert Advisor (another term for algotithms), the most important thing you should do is backtesting it. If you have not done this, you can be certain that you won’t succeed. Backtesting gives you a chance to take your algo back in time and see how well it has performed. If you find that it has not done well, chances are that it won’t do that well in future. So, you should avoid it. Alternatively, you can recreate and backtest it until it works properly.

Basics of Algorithmic Trading: Concepts and Examples

 
Basics of Algorithmic Trading: Concepts and Examples - Algorithmic trading (automated trading, black-box trading, or simply algo-trading) is the process of using computers programmed to follow a defined set of instructions for placing a trade in order to generate profits at a speed and frequency that is impossible for a human trader. The defined sets of rules are based on timing, price, quantity or any mathematical model. Apart from profit opportunities for the trader, algo-trading makes markets more liquid and makes trading more systematic by ruling out emotional human impacts on trading activities.

Suppose a trader follows these simple trade criteria:

  • Buy 50 shares of a stock when its 50-day moving average goes above the 200-day moving average
  • Sell shares of the stock when its 50-day moving average goes below the 200-day moving average


Using this set of two simple instructions, it is easy to write a computer program which will automatically monitor the stock price (and the moving average indicators) and place the buy and sell orders when the defined conditions are met. The trader no longer needs to keep a watch for live prices and graphs, or put in the orders manually. The algorithmic trading system automatically does it for him, by correctly identifying the trading opportunity.

Algo-trading provides the following benefits:

  • Trades executed at the best possible prices
  • Instant and accurate trade order placement (thereby high chances of execution at desired levels)
  • Trades timed correctly and instantly, to avoid significant price changes
  • Reduced transaction costs (see the implementation shortfall example below)
  • Simultaneous automated checks on multiple market conditions
  • Reduced risk of manual errors in placing the trades
  • Backtest the algorithm, based on available historical and real time data
  • Reduced possibility of mistakes by human traders based on emotional and psychological factors
See Also: Algorithmic Trading Strategies

The greatest portion of present day algo-trading is high frequency trading (HFT), which attempts to capitalize on placing a large number of orders at very fast speeds across multiple markets and multiple decision parameters, based on pre-programmed instructions. (For more on high frequency trading, see: Strategies and Secrets of High Frequency Trading (HFT) Firms)

Algo-trading is used in many forms of trading and investment activities, including:

  • Mid to long term investors or buy side firms (pension funds, mutual funds, insurance companies) who purchase in stocks in large quantities but do not want to influence stocks prices with discrete, large-volume investments.
  • Short term traders and sell side participants (market makers, speculators, and arbitrageurs) benefit from automated trade execution; in addition, algo-trading aids in creating sufficient liquidity for sellers in the market.
  • Systematic traders (trend followers, pairs traders, hedge funds, etc.) find it much more efficient to program their trading rules and let the program trade automatically.
Algorithmic trading provides a more systematic approach to active trading than methods based on a human trader's intuition or instinct.

Algorithmic Trading Strategies

Any strategy for algorithmic trading requires an identified opportunity which is profitable in terms of improved earnings or cost reduction. The following are common trading strategies used in algo-trading:

Trend Following Strategies: The most common algorithmic trading strategies follow trends in moving averages, channel breakouts, price level movements and related technical indicators. These are the easiest and simplest strategies to implement through algorithmic trading because these strategies do not involve making any predictions or price forecasts. Trades are initiated based on the occurrence of desirable trends, which are easy and straightforward to implement through algorithms without getting into the complexity of predictive analysis. The above mentioned example of 50 and 200 day moving average is a popular trend following strategy.

Arbitrage Opportunities: Buying a dual listed stock at a lower price in one market and simultaneously selling it at a higher price in another market offers the price differential as risk-free profit or arbitrage. The same operation can be replicated for stocks versus futures instruments, as price differentials do exists from time to time. Implementing an algorithm to identify such price differentials and placing the orders allows profitable opportunities in efficient manner.

Index Fund Rebalancing: Index funds have defined periods of rebalancing to bring their holdings to par with their respective benchmark indices. This creates profitable opportunities for algorithmic traders, who capitalize on expected trades that offer 20-80 basis points profits depending upon the number of stocks in the index fund, just prior to index fund rebalancing. Such trades are initiated via algorithmic trading systems for timely execution and best prices.

Mathematical Model Based Strategies: A lot of proven mathematical models, like the delta-neutral trading strategy, which allow trading on combination of options and its underlying security, where trades are placed to offset positive and negative deltas so that the portfolio delta is maintained at zero.

Trading Range (Mean Reversion): Mean reversion strategy is based on the idea that the high and low prices of an asset are a temporary phenomenon that revert to their mean value periodically. Identifying and defining a price range and implementing algorithm based on that allows trades to be placed automatically when price of asset breaks in and out of its defined range.

Volume Weighted Average Price (VWAP): Volume weighted average price strategy breaks up a large order and releases dynamically determined smaller chunks of the order to the market using stock specific historical volume profiles. The aim is to execute the order close to the Volume Weighted Average Price (VWAP), thereby benefiting on average price.

Time Weighted Average Price (TWAP): Time weighted average price strategy breaks up a large order and releases dynamically determined smaller chunks of the order to the market using evenly divided time slots between a start and end time. The aim is to execute the order close to the average price between the start and end times, thereby minimizing market impact.

Percentage of Volume (POV): Until the trade order is fully filled, this algorithm continues sending partial orders, according to the defined participation ratio and according to the volume traded in the markets. The related "steps strategy" sends orders at a user-defined percentage of market volumes and increases or decreases this participation rate when the stock price reaches user-defined levels.

Implementation Shortfall: The implementation shortfall strategy aims at minimizing the execution cost of an order by trading off the real-time market, thereby saving on the cost of the order and benefiting from the opportunity cost of delayed execution. The strategy will increase the targeted participation rate when the stock price moves favorably and decrease it when the stock price moves adversely.

Beyond the Usual Trading Algorithms: There are a few special classes of algorithms that attempt to identify “happenings” on the other side. These "sniffing algorithms," used, for example, by a sell side market maker have the in-built intelligence to identify the existence of any algorithms on the buy side of a large order. Such detection through algorithms will help the market maker identify large order opportunities and enable him to benefit by filling the orders at a higher price. This is sometimes identified as high-tech front-running.

Technical Requirements for Algorithmic Trading

Implementing the algorithm using a computer program is the last part, clubbed with backtesting. The challenge is to transform the identified strategy into an integrated computerized process that has access to a trading account for placing orders. The following are needed:

  • Computer programming knowledge to program the required trading strategy, hired programmers or pre-made trading software
  • Network connectivity and access to trading platforms for placing the orders
  • Access to market data feeds that will be monitored by the algorithm for opportunities to place orders
  • The ability and infrastructure to backtest the system once built, before it goes live on real markets
  • Available historical data for backtesting, depending upon the complexity of rules implemented in algorithm


Here is a comprehensive example: Royal Dutch Shell (RDS) is listed on Amsterdam Stock Exchange (AEX) and London Stock Exchange (LSE). Let’s build an algorithm to identify arbitrage opportunities. Here are few interesting observations:

  • AEX trades in Euros, while LSE trades in Sterling Pounds
  • Due to the one hour time difference, AEX opens an hour earlier than LSE, followed by both exchanges trading simultaneously for next few hours and then trading only in LSE during the last hour as AEX closes


Can we explore the possibility of arbitrage trading on the Royal Dutch Shell stock listed on these two markets in two different currencies?

Requirements:

  • A computer program that can read current market prices
  • Price feeds from both LSE and AEX
  • A forex rate feed for GBP-EUR exchange rate
  • Order placing capability which can route the order to the correct exchange
  • Back-testing capability on historical price feeds


The computer program should perform the following:

  • Read the incoming price feed of RDS stock from both exchanges
  • Using the available foreign exchange rates, convert the price of one currency to other
  • If there exists a large enough price discrepancy (discounting the brokerage costs) leading to a profitable opportunity, then place the buy order on lower priced exchange and sell order on higher priced exchange
  • If the orders are executed as desired, the arbitrage profit will follow


Simple and Easy! However, the practice of algorithmic trading is not that simple to maintain and execute. Remember, if you can place an algo-generated trade, so can the other market participants. Consequently, prices fluctuate in milli- and even microseconds. In the above example, what happens if your buy trade gets executed, but sell trade doesn’t as the sell prices change by the time your order hits the market? You will end up sitting with an open position, making your arbitrage strategy worthless.

There are additional risks and challenges: for example, system failure risks, network connectivity errors, time-lags between trade orders and execution, and, most important of all, imperfect algorithms. The more complex an algorithm, the more stringent backtesting is needed before it is put into action.

The Bottom Line

Quantitative analysis of an algorithm’s performance plays an important role and should be examined critically. It’s exciting to go for automation aided by computers with a notion to make money effortlessly. But one must make sure the system is thoroughly tested and required limits are set. Analytical traders should consider learning programming and building systems on their own, to be confident about implementing the right strategies in foolproof manner. Cautious use and thorough testing of algo-trading can create profitable opportunities.

Algorithmic Trading Strategies

 
Algorithmic Trading Strategies - The stock market is the most volatile investment portfolio so much so that every investor should think twice before entering. With that said, it is also the most lucrative way to increase one's investment as one can earn triple their invested capital minus any administrative fee and other fees. Mastering the stock market however would require patience as well as understanding how the market works. With many of us interested in the stock market but not inclined to quitting our daily jobs, online investing is one viable option to consider. Algorithmic trading is a popular strategy that many online investment companies make use of to make trading decisions.

Algorithmic Trading

Algorithmic trading involves the use of computer software that utilizes algorithmic programmes to identify potential purchases. Many online investment companies make use of algorithmic trading software and strategies to do trading. Basic arbitrage is just one of the strategies that make use of data such as interest rates to check for any market inefficiency. Another strategy is the use of transaction cost reduction, benchmarking, gaming and icebergs.

High Frequency Trading

One of the popular algorithmic trading methods is the high-frequency trading or HFT that is employed by many popular trading companies. The platform makes use of computer algorithms to move in and out of positions in the stock market in just few seconds thus earning high returns of the companies that employ it. The HFT makes use of several arbitrage including market making, ticker taper trading, events, statistical, news-based and low latency.

Benefits of Algorithmic Trading

One of the benefits of algorithmic trading is that it saves time and provides convenience for the trader. As the financial market is bombarded with millions of information, processing all the information would require time which prevents one from making any decisions and losing opportunities. With the platform, the computer software uses several algorithmic processes that eliminate and filter out unnecessary information and focus on the important ones. As this takes a few seconds or minutes to process, traders can easily identify and spot opportunities and make better trading decisions.

See Also: Binary Options Trading and Bitcoin

Another benefit is that the emotional impact is eliminated in the process. As human emotions play havoc with a trader's decisions, fear of loss of capital or greed can directly impact the outcome of the trading decision. With the use of the trading platform, decisions are made from factual basis and allow the traders to reap profits instead of losses. It also provides traders with an edge against other traders especially those who rely on old market strategies.