Creating your own Algos at PL : The Basic Guide

Did you know that more than 80% of trades in NYSE, 60% in LSE and 40% in NSE are being executed using algorithmic trading? Why this fancy? The answer is simple – Algos bring about a lot of discipline and predictability that humans (read emotions!) can simply not aim to replicate!

What can Algos Do that Humans cant (effectively)?

If you have a trading strategy that you like, then at any given point in time your mind has to be able to process the following at super speed : Visual inspection of charts, processing of formulas , building the signals, communicating the trades to a terminal and then managing the order book dynamically to ensure stoplosses. Trailing stop losses etc are accurate.

Unless you are a multiverse autobot, its very likely that you have made many a mistake in the past – as humans can simply not aim to replicate the speed of a machine. And need not either. After all that’s why machines were invented, weren’t they!

Welcome to the world of Algorithmic Trading

Algorithmic trading is a trader outsourcing all predetermined and mechanical tasks to a machine so that the human mind can focus on what a machine cannot – learning and optimizing and creating better outcomes!

Without emotions, your strategy gets a fair chance to perform and be tested against the jungle out there – apart from bringing in accuracy. Given the vast amount of computing power available, one can run multiple strategies across hundreds of signals for trade opportunities, all simultaneously!

So if you know what you want, working with an Algo may be the best way to trade!

The Pre-requisites for Algo Creation:

Step 1: Trading Strategy
The very first step would be to make a checklist of the parameters based on which you take your Trading decisions. These parameters should be something that can be formulated into an Algorithm and based on combinations you think are relevant – example, variables like price, volume , timeframes, technical analysis or options data could be combined to identify unique trade opportunities.

The strategy should also incorporate money management – like your investment amount for each trade, timeframe for trading, your stoploss and targets, asset classes and decisions like scaling up or scaling down positions in profit.

It is ideal if you have formulated your plan and have validated it against a bunch of instruments to see if it really works.

Step 2: Creating the Algorithm

Next, you should start writing a program for your trading plan. A program is nothing but a bunch of instructions which tell the computer how to process market data and convert it to a Buy/Sell/Hold/Trail situation.

There are multiple programming languages available for this purpose, some of them are R, Python, C++ etc. Whichever language you choose, you do need to make sure that your algorithm is communicated properly to the computer and covers all possible events that a market can throw.

If you are an excel fanatic and know it well enough, you could use that to generate signals that can be sent to a terminal as well. Quite a few people however prefer to use something like Amibroker, which has a relatively simple formula base called the Amibroker Formula Language (AFL) for writing Trading Algorithms. It’s a high-level programming language and very easy to understand if you start from basics. Even a person from non-programming background can learn AFL and avoid spending unnecessary on expensive ready-made AFL’s. Alternatively, you could talk to our Algo Desk who can refer code writers to you who charge you very basic fees for writing your programmes.

Step 3: Backtesting the Algorithm

Backtesting is a process to validate the performance of your Algorithm on Historical Data. While you may have done this visually or on excel earlier, using a software based backtest engine can do this in seconds and throw up results much more revealingly!.

Presenting Blitz Trader

Prabhudas Lilladher has tied up with Symphony, a leader in Algo Trading to present our clients and partners with Algorithmic trading facilities using Excel as well as Amibroker. Blitz is capable of talking to any of your programmes as well as communicate instructions to most trading terminals available in India.

Since Excel is not exactly the best program for automated trading, you may use any of the platforms out there like Amibroker, Metastock, Ninjatrader , Spider etc. All these platforms are both for backtesting and automation.

Because of certain ease however, people normally prefer Amibroker (AB). The reasons include wide support for coding on open source, a lightning fast optimization feature, Easy to test strategies on a portfolio level, and pretty cheap at about Rs 20,000 per year.

In addition, it has powerful visual Charting, comes with the most popular in-built indicators and supports multiple time frames.

With AmiBroker, you can backtest your strategy automatically which then produces a performance report for the number of Buy/Sell trading signals generated over a period, the strategy’s win/loss ratio etc to give you an idea of the performance of your system.

Why AmiBroker with Blitz

a) Position Management
This combination offers a very powerful Position Management System, with in-built intelligence to track each and every trade of yours and manage them on its own.

b) Virtual Paper Trading
More and more traders are practicing this nowadays to backtest the desired strategy with the help of virtual money. Run your strategy on live market, but do not trade with real money.

c) Guidance of AFL language
Symphony teams offer guidance on writing code as well as implementation on paper trading and live market situations

d) Direct Exchange/Broker Connectivity
Blitz can connect to to 63 Moons ODIN OMS/RMS as well as Omnesys trading terminals via APIs

e) Prepacked Trading Strategies

In case you don’t want to create any of your own proprietary strategies, you can also choose from the readily available off the shelf strategies from Symphony including

  • Multi Leg Strategy
  • Options 2 Leg
  • Master Scalping
  • Trend Trader
  • MS-Excel Automation
  • Candle Breakout
  • Cash to futures
  • Calendar Spread
  • Cover Order
  • Jobex : Amibroker Charting Automation
  • Smart Executor : : Amibroker Charting Automation
  • Order Slicer and Order Slicer Plus
  • Ice Berg
  • Call Executor
  • VWAP
  • TWAP
  • Bracket Order

Summary

Increasingly, the need to act fast and plan accurately has increased as returns from strategies and stocks diminish. Also, the necessity to “think” rather than “execute” is higher today and will continue to move higher as complexity in financial markets as well as interlinkages increase.

Using computerized algos to do the mechanical work for you, with multiple strategies for multiple kinds of portfolios, may just be the solution you require – as an investor, portfolio advisor or a Progress Partner.

Talk to us at tea@plindia.com to help us help you bring the future here and now!

Leave a Reply