20
Chicago NW Burbs Investment & Trading Club Computer Algorithms & Trading

Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Chicago – NW Burbs Investment & Trading Club

Computer Algorithms & Trading

Page 2: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Did You Know

• 30% of all trades are through Algorithms (High Frequency Trading) in the US. HFT accounts for about half of share volume.

• HFT accounts for closer to 25 per cent in Australia

• Algorithmic trading accounts for more than 40% of transactions in the Indian equities market. Forecast for algorithmic volumes to breach 60% by 2020.

• 40 per cent of all HFT orders exist for one second or less.

• Algorithms are buying and selling to each other within a fraction of a second

• Some algorithms looking for ~$500 profits over and over

Fastest Algorithm wins – wins more than others

Page 3: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Wall Street Journal - July 24, 2015

At 78, Scientist Is Starting a Hedge Fund. The Quant Hedge Fund would be launched later this year. http://www.wsj.com/articles/at-78-scientist-is-starting-a-hedge-fund-1437693849

2

Page 4: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Algorithmic Trading and Alerts System

1. Computers in Trading • Programming

• HFT

• Social Media

2. Algorithms • Sample Algorithm

• Sample Alert Condition

3. Who uses it and how?

4. Advantages and Disadvantages

5. Think or Swim

6. Ninja Trader

7. Trading with Alerts

Page 5: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

What is Computer Program?

• A sequence of instructions (code) for the computer to perform tasks

• Algorithms are computer programs

• Different languages for writing code – HTML, C++, C# Java, etc.

• Think or Swim uses C++, NinjaTrader uses C#

4

Tiering

11010011100010100001010101011100010100100100110101110011001100010001000100001110011000111100011000101011001010011000010110011101010100110111001001000101100101110110111010101101100100100101101010110011101010100110111001001000101100101110110111010101100110001010100101011001111001001110011010101111101010001010101000110110011101010100110111001001001

Deduplication COBOL

Cloud Computing .NET

HTML

C++

Java

C++

Page 6: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Programs & High Frequency Trading

• Trading done by powerful computers

• Complicated computer programs created by scientist, mathematician and physicist

• Institutions and Hedge Funds trade with HFT

• Rarely competes with retail traders

• Very short timeframes for establishing and liquidating positions.

• Submit a number of orders that are cancelled soon after submission.

• Maintain very few, if any, overnight positions.

Page 7: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

They Spend a Lot to Make More

• Computer servers next to those of the exchanges, cutting down the time it takes for an order to travel from their computers to the exchanges’ electronic matching engines.

• Faster pathways— fiber-optic cables, microwave towers, even laser beams— to trade more quickly between far-flung markets such as Chicago and New York.

• Pay exchanges for proprietary data feeds. These proprietary feeds are different than the public, consolidated data feed maintained by the public exchanges, called the securities information processor, or the SIP. “ – feed on cnbc tv, your broker, etc are SIP

Exchanges that have allowed HFT have benefited from an increase in trading volumes and trading fees.

revenue.

$180,000/year for faster data access: 1 millisecond faster data

Page 8: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

HFT Algorithms

• Accurately Reflect Market Changes: - HFT strategies are based on interpretation of market events and news, and rely on the correlations between

several factors such as pricing, interest rates, and different markets events.

- As a result, there is always a need to constantly upgrade algorithms as the underlying assumptions change

- Maintaining very short timeframes for establishing and liquidating positions, resulting in the frequent turnover of many small positions in one or more financial instruments.

- Submitting a number of orders that are cancelled soon after submission.

- Maintaining very few, if any, overnight positions.

• Short Life Span Due to Reverse Engineering:

- The shelf life of most algorithms remains limited as competitor firms are generally able to decipher each other’s strategies through reverse engineering.

- Once exposed, it can become extremely risky to execute and can often prove to be counterproductive.

- Firms to constantly update and upgrade their strategy in order to stay a step ahead of the competition.

7

Page 9: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

May 2010 Flash Crash by HFT

1. MAY 6 2010: 1PM In a weak market, volatility starts to increase in a few stocks.

2. 2:30PM Trading turns nervous and the Dow drops 2.5 per cent.

3. 2:32PM A program to sell $4.1 billion in futures starts up - and traders start to panic.

4. 2:41PM Falling futures prices spread to stocks, and the index goes into meltdown.

5. 2:46PM A five-second pause in futures trading - half a lifetime in this world - short-circuits the crash and the market starts to recover. But a lot of money is made and lost on the way down - and on the way up again.

Dow Jones to plummet by almost 1,000 points, losing 9 per cent of its total value. By the end of the day, it had recovered most of the losses - hence the term "flash" Consulting firm Accenture, for example, saw its share price collapse from more than $40 to as low as one cent.

8

Page 10: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Social Media & Trading

• In April Twitter earning released

prematurely by social media

• A fake tweet from a hacked

Associated Press Twitter account

knocked 140 points off the Dow in

2013

• When Carl Icahn used Twitter to

disclose his position in Apple, the

tech group's market cap jumped

by $US12.5 billion

What to Do?

1. Follow market leaders on social media

2. Look up stock chatter using $Symbol and #stocks

Page 11: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Smart & Social Algorithms

• Algorithms are scanning messages for key

phrases such as "rise", "fall" and "warn" and

grade the news on whether it is neutral,

positive or negative. That information can be

integrated into high-speed trading programs

that place rapid-fire trades.

• By 2017, 40% of enterprise contact

information will have leaked into Facebook

via employee mobile device collaboration

applications

Algorithms read “The Internet” to get an edge in trading

Twitter

Press Release

Wall St Journal

Page 12: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

11

Advantages & Disadvantages of HFT

Positive impacts Negative impacts

• Increased Liquidity: It is believed that the high number of trades typically entered by HFT traders results in greater liquidity in the markets. HFT firms contribute to over 50% of the equity turnover by volume in some major markets

• Narrowing Spreads: The use of algorithms and computers in trading has resulted in the prices of securities being updated more frequently and more accurately

• Improved Market Efficiency: In more efficient markets, prices reflect market information more quickly and accurately. HFT enables this to happen by ensuring accurate pricing at smaller time intervals. Also, HFT has enabled smaller spreads and lower trading costs

• Increased Fees for Exchanges: HFT has led to a significant increase in the trading volumes

• Emotion Less Trading

• Impact on Institutional Investors: Some institutional investors allege that certain HFT strategies look for repetitive trading patterns and front run the institution by detecting an incoming order flow, after which the HFT system buys the same security and then turns around and sells it to the institution at a slightly higher price.

• Increased Volatility: Since HFT involves rapid intraday trading with positions generally held only for minutes—or even just seconds—it can give rise to price fluctuations and short term volatility.

• Disadvantages to the Smaller Investors: HFT firms leverage special services such as co-location facilities and raw data feeds, which are typically not accessible for smaller firms and retail investors as they are not able to make the required investments. This places these smaller firms and investors at a disadvantage.

Page 13: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

12

Think Like a HFT Trader: Drink Your Own Champagne

• Rely on trading platforms to give you signals.

• Strictly execute those trades with the recommended entry and exit

OR • Automate your trading with algorithms

- Buy 100 shares of a stock when Stochastic and MACD cross, and 50 MA crosses 200 MA; then…

- Sell 100 shares of the stock at 4% profit or 2% loss

• Computer program will automatically monitor the stock price and place the buy/sell order when the conditions are meet.

http://www.investopedia.com/articles/active-trading/101014/basics-algorithmic-trading-concepts-and-examples.asp

Page 14: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Think or Swim Program

13

Page 15: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Ninja Trader Program

14

Page 16: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Algorithm Example

15

1. avg daily Volume (30 days) GREATER THAN factor1 * avg daily volume (250 days) AND

2. daily volume today GREATER THAN factor2 * avg daily volume (30 days) AND

3. price of stock is BETWEEN (avg. daily price (250 days) + factor3 * standard deviation AND avg. daily price (250 days) – factor4 * standard deviation)

Algorithm to filter Stocks

if ((dVol > (Dvtmulti * VOLMA(BarsArray[1], Days1)[0]))

&& (VOLMA(BarsArray[1], Days1)[0] > (Advmulti * VOLMA(BarsArray[1], Days2)[0]))

&& (Close[0] > (SMA(Closes[1], Days1)[0] - (1.5 * StdDev(3)[0])))

&& (Close[0] < (SMA(Closes[1], Days1)[0] + (1.5 * StdDev(3)[0]))) )

Program in C# for NinjaTrader

Page 17: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

16

Embrace Hybrid Trading Model

Personas Drive Manual Trading Scenarios Drive Algorithm

Hybrid Model Drive Profit

Page 18: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Trading Platforms and Alert System

17

Think or Swim

Ninja Trader

Stock Picks and Alert System

https://www.estockpicks.com

Page 19: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

18

Page 20: Computer Algorithms & Trading - Meetupfiles.meetup.com/1621769/Computer Algorithms for Trading.pdf · 2015. 7. 25. · Did You Know • 30% of all trades are through Algorithms (High

Chicago - NW burbs Trading and Investing Club

Thank You