Вы находитесь на странице: 1из 282

5th May, 2018

www.algoji.com
Coding Cases

Saurabh Lohiya
Founder, AlgoJi
Example:
Amibroker ATS
Charting/Strategy • Real-Time
Software Market Data

Amibroker

Trading Logic/ • BackTesting


Alpha Strategy Databse

AFL

Execution • Risk
Strategy Management In-house CTCL/
NEST/NOW/ODIN
Example: Example: Example:
Amibroker ATS Python ATS Amibroker ATS

Amibroker Database FoxTrader

AFL Python Strategy

In-house CTCL/ In-house CTCL/ In-house CTCL/


NEST/NOW/ODIN NEST/NOW/ODIN NEST/NOW/ODIN
Our Random World
(depicted via PnL charts)
Mobile Algo Trading App
Python |
Amibroker |
Manual
1 Charting 2
Secure Mobile App
Application +
Backend
Analytics Engine

3
Broker Admin
Panel 5
Client Mobile App

4 Transaction
Facilitator
(Broker end)
Copyright AlgoJi Enterprises, all rights reserved
Thank You
saurabh@algoji.com
www.algoji.com
Data Science and Trading
Dr. Hari, PhD. IISc Bangalore
Nitish Mukherjee, Director, IIQF
Date : 5th May 2018
Overview and Content
• Overview on python
• Installing Python
• Data Science Application to Algo Trading
Algo Trading
• Algo trading in India and US
• US market replication to Indian market
• Last few years it has picked momentum in Indian market
Magic of Compounding
Compounding
• As Albert Einstein said, 'compounding is something one who
understands earns it and one who doesn't understand pays it'.
• Compounding works best with equity asset.
• Reason why world's richest men list include people who have created
wealth by taking advantage of compounding with their equity
investment.
Quantitative Research and Data Science
• Compounded annual growth on different percent
• 7% growth through fixed deposit or
• 10% growth though mutual fund, SIP
• 15% growth though quantitative investment in equity
• 30% growth though quantitative investment and trading in equity
• Risk and Reward management (Data Science and Machine learning)
Learning and courses:

• Algo Trading
• Common studies and Terminology
• Process of strategy Design
• Python
• Programming concepts
• Machine Learning, Data Science in trading
Scientific Trading

• Trading Premise: Data, observations, Ideas about instruments and


markets that can make money
• Creating strategy: Trading premise are used to create relationship in
the form of Buy-Sell rules. A complete set of trade entry and trade
exist rules make a strategy
• Back testing strategy: Back testing is the process of testing a strategy
on historical data set to estimate its profitability in live trading
• Live Execution: Sending orders to the broker/exchange, managing
orders and their latency is a daunting task
Miniconda
• Conda is a package management and environment management
system
• Miniconda is smaller in size compare to Anaconda.
• We still need to install all the packages which are not included in
Anaconda
PyCharm
• PyCharm is an integrated Development Environment useful to
manage code and data files.
• It makes building trading models very easy.
Python Libraries
• Numpy: Numerical computations
• Scipy: Scientific computation
• Sci-kit Learn: Machine learning models
• Pandas: panel data
• Matplotlib: plotting tools
Conda
• $conda install numpy
• $conda create -n myenv python
• Conda version (the number of the version installed)
• conda --version
• Update conda (Conda compares versions and then displays what is
available to install)
• If a newer version of conda is available, type y to update
• conda update conda
• List of environments (The active environment is the one with an asterisk
(*))
Conda
• conda info --envs
• Activate Environment
• activate myenv
• Deactivate Environment ( When the environment is deactivated, its
name is no longer shown in your prompt, and the asterisk (*) returns
to base)
• deactivate
Jupyter notebook
• Notebook provide Interactive Platform
• Server-client application that allows editing and running notebook
documents via a web browser
• Jupyter notebook app can be executed on a local desktop requiring
no internet access.
Data Science Application to Algo Trading

• Statistical Arbitrage
• Linear regression
• Time Series Models
• CVAR (Cointegrated vector auto regression)
• Limit order submission
• Probabilistic models
• Hidden Markov Models
• Classification and Regression models
www.algoji.com
Technical Analysis
Dr. Hari, PhD. IISc Bangalore
Nitish Mukherjee, Director, IIQF
Date : 5th May 2018
Overview and content
• ROC
• MACD
• RSI
• Machine Learning
ROC
• The Rate-of-Change (ROC) indicator is a pure momentum oscillator
that measures the percent change in price from one period to the
next.
• The ROC calculation compares the current price with the price ‘n’
periods ago.
• ROC signals include centerline crossovers, divergences and
overbought-oversold reading.
ROC Calculation
• ROC = [(Close - Close n periods ago) / (Close n periods ago)] * 100
• In general, prices are rising as long as the Rate-of-Change remains
positive. Conversely, prices are falling when the Rate-of-Change is
negative.
Moving Average Crossover
• extremely well-known simplistic momentum strategy.
• Create two separate simple moving average filters, with varying
lookback periods
• Signals to purchase the asset when the shorter lookback moving
average exceeds the longer lookback moving average
MACD
• Moving Average Convergence Divergence: A Market timing Indicator
• Short term moving window
• Long term moving window
• Short term exponential moving average
• Long term exponential moving average
MACD
• MACD = SMA – LMA
• SMA = short term moving average
• LMA = Long term movie average
• Trend improving, SMA will rise quickly than LMA. MACD line turn up
• Trends losing strength, SMA tend to flatten, ultimately falling below
LMA.
MACD
• During price movement, SMA will move apart (diverge) and move
together (converge) with LMA, hence, the name “Moving Average
Convergence Divergence”
Length of moving averages
• As a general rule, the longer term moving average will be two to three
times the length of the shorter term average
• The shorter the short term average, the more sensitive will MACD be
to short term market fluctuations.
Signal line
• The signal line is an exponential average of MACD levels, not of the
price of the investment.
• Signal lines are usually created employing 3-day to 9-day exponential
averages of MACD lines.
• The shorter the average the more sensitive will be the signal line.
Buy and Cell signal
• Changes in MACD direction (from down to up and vice versa) and
crossing of MACD lines above and below 0 carry significance.
• Crosses of MACD from below to above its signal line and from above
to below its signal line carry additional significance of their own.
MACD
• As a general rule, crossing of MACD from below to above its signal
line may be taken as confirmation of buy signals orignally indicated
when changes in direction have taken places in MACD from down to
up.
• Signal line crossing take place after MACD lines change direction
Length of moving averages
• As a general rule, the longer term moving average will be two to three
times the length of the shorter term average
• The shorter the short term average, the more sensitive will MACD be
to short term market fluctuations.
Relative Strength Index
• RSI is one of the most popular momentum indicator in Technical
Analysis.
• RSI value fluctuates between 0 to 100 and indicates the strength and
velocity of price move
RSI
• When the RSI move above 50, the average gains outweigh the
average losses; this is regarded as bullish.
• When the RSI falls below 50, the average losses outweigh the average
gains; this is regarded as bearish.
RSI
• RSI indicator is mostly calculated on 14 period timeframe and any
value above 70 indicates over-brought level and value below
30 indicates over-sold level.
• There are many variations of this indicator and the manner in which
the RSI levels are interpreted varies with your trading style
RSI Calculation
• It is a technical indicator used in analysis of financial markets.
• RSI = 100 – 100/(1+RS*)
• RS * =Avg of x days’ up closes/Avg of x days’ down closes
Combine Trading Signals
• Machine Learning Methods
• Classification Methods
• Ensemble Methods
• Deep Learning Neural Network
• LSTM (Long Short Term Memory)
Thanks
www.algoji.com
ML for Trading
Dr. Hari, PhD. IISc Bangalore
Nitish Mukherjee, Director, IIQF
Date : 5th May 2018
Overview and content
• Machine Learning (ML)
• ML application to trading
• Statistical Arbitrage
• Linear Regression
• Limit Order Submission
• Hidden Markov Model
• Market Order submission
• Classification and Regression Methods
Sample ML problem setup
What are you trying to predict?
ML frame for predicting future price
Split Data into Training and Test Data
Split Data into Training, Validation and Test Data
Supervised v/s unsupervised learning
Regression v/s classification
ML Algorithms
• Supervised
• Linear Regression
• Logistic Regression
• Unsupervised
• Clustering Algorithm
• Semi-Supervised
Regression and Classification
• Linear Regression
• Logistic Regression
• Decision Tree classification and Regression
• SVM Regression and Classification
• Deep Neural Network for Regression and Classification
Train and Optimize your model using Training and
Validation Datasets
Backtest performance on (yet untouched) Test Dataset
Rolling Validation
Ensemble Learning
Bagging
Boosting
ML for Statistical Arbitrage
• Developed in the 1980’s by a group of Quants at Morgan Stanley, who
reportedly made over $50 million profit for the firm in 1987
• A contrarian strategy that tries to profit from the principles of mean-
reversion processes
• In theory, one could expand the strategy to include a basket of more
than a pair of related stocks
Main Idea
• Choose a pair of stocks that move together very closely, based on a
certain criteria (i.e. Coke & Pepsi)
• Wait until the prices diverge beyond a certain threshold, then short
the “winner” and buy the “loser”
• Reverse your positions when the two prices converge --> Profit from
the reversal in trend
Example of a Pairs Trade
Investor Decisions
• Pair Selection Criteria
• Correlation (Parametric & Non-Parametric Spearman’s Rho)
• Dickey-Fuller Test Statistic (Cointegration)
• Trading Threshold (areas of consideration)
• Volatility of the Market
• Historical returns
• Cost of each transaction
Chevron & Exxon
Formation Period Corr=0.93
Trading Period Corr=0.96
Optimal Threshold=1.25*sd’s
# Transactions=10
Returns=15%
Win.
Electronic Arts & GAP
◼ Formation Corr=0.12
◼ Trading Corr=0.56
◼ Optimal Threshold=1 sd
◼ # Transactions=0 (Open a
position, but spread never
returns to 0)
◼ Return= -0.04
◼ Lose.
Nike & McDonald’s
 Formation Corr=0.87
 Trading Corr=0.02
 #Transactions=1
 Return= -0.05
 Lose.
 Correlation is imperfect
criteria for selecting pairs.
Cointegration
• If there exists a relationship between two non-stationary
I(1) series, Y and X , such that the residuals of the
regression
Yt =  0 + 1 X t + ut
are stationary, then the variables in question are said to be
cointegrated 55
X Y
50
Note: X and Y here are 45
clearly not stationary, 40
but they seem to move 35
together. In fact, they 30

are cointegrated --> 25

(Y- β1X-β0 )should be 20

stationary 15

10

0 10 20 30 40 50 60 70 80 90 100
Application to Pairs Trading
• If we have two stocks, X & Y, that are cointegrated in their price movements, then
any divergence in the spread from 0 should be temporary and mean-reverting.

Spread

time

• The important issues here are: 1) how to test for cointegration between prices
and 2) estimating the constant
Testing For Cointegration
• Many Methods – most of them focus on testing whether the residuals
of Yt = are stationary processes
0 + 1 X t + ut

• We use the Cointegrating Regression Dickey-Fuller Test, which


essentially operates the following regression:
Δut = φ ut-1 + et

• H0: φ = 0 => no cointegration*


• Ha: φ < 0 => cointegration*
• To obtain the cointegration factor estimates, we must regress the de-
trended Yt on the de-trended Xt

* We must use critical values different from Gaussian ones due to


non-symmetric properties of the Dickey-Fuller distribution
Trading Period Comparison

Normalized LUV&PLL spread VS Cointegrated LUV&PLL spread


Auto-Regressive Time Series
• Cointegration is an ideal construct for pairs trading
• But Dickey-Fuller Hypothesis Test is inconclusive
• Instead we can fit a time series to the spread data
• AR(1): Yt = β Yt-1 + εt
• Looking for a spread that produces an AR(1) with |β| < 1, so that
will be stationary.
Alternative Strategies
• Conditional correlation or some other measure of “relatedness”, such
as Copulas
• Modeling the spread as GARCH processes
Goog/MSFT Pair Trading
MMM/CSCO Pair Trading
CMCSA/CSCO Pair Trading
ETF Arbitrage
• ETFs (Exchange Traded Funds) consist of a basket of stocks
• If a trader has the correct amount of stocks, he can actually go to the ETF
manager and exchange his stocks for an ETF. Likewise, if you own an ETF, you can
go to the fund manager and redeem your ETF for the underlying stocks
• The arbitrage opportunity occurs when there is a price discrepancy between the
price of the ETF and the price of the underlying
ETF Arbitrage
• Market making firms like Jane Street Capital dedicate significant
resources to developing the most sophisticated hardware to exploit
the tiny arbitrage opportunities that exist in this space.
ML for Limit Order Submission
Bid-Ask Spread
• The order book is made up of two sides, Asks (also called offers), and
Bids. Asks are people willing to sell, and bids are people willing to buy.
• The best ask, the lowest price that someone is willing to sell at, is
larger than the best bid, the highest price that someone is willing to
buy at.
• If this was not the case, a trade between these two parties would not
have already happened.
• The difference between the best ask and best bid is called the spread.
Market Order
• Market orders will go into market to execute at the best available
price, however the execution and the price is not guaranteed.
• Market orders cannot be accepted outside of market hours or when
trading in a particular stock is halted or suspended.
• Market orders cannot be amended or cancelled online during market
hours.
Limit Order
• Limit orders allow you to set a maximum purchase price for your buy
order, or a minimum sale price for your sell orders
• If the market doesn't reach your limit price, your order will not be
executed.
• Limit orders can be amended or cancelled provided the order has not
already been executed.
Limit Order Submission
• Highly quantitative in nature
• Limit orders are submitted by market makers
• Opportunity from bid-ask spread
• Probabilistic models
• Hidden Markov models
Time Series Pattern Recognition
• Stock data are time series data
• Regression based methods like ARIMA, ARCH, GARCH models
• DNN models like RNN and LSTM models for price series prediction or
trend prediction
• Ensemble learning like Bagging, Boosting for price or trend prediction
Thanks
Indian Institute of Quantitative Finance
Post Graduate Program in Algorithmic Trading (PGPAT)
• A comprehensive course covering all aspects of Algorithmic Trading:
• Learn to develop advanced trading strategies
• Developing advanced trading strategies using Technical Analysis, Machine
Learning, Quantitative Techniques
• Comprehensive Back-testing
• Parameterization
• Optimization
• Coding Algorithmic Trading strategies in Python
• Learn Money Management and Risk Management
• Learn to set-up Algorithmic Trading infrastructure
• Learn to develop and integrate your strategies with industry leading platform
Omnesys NEST
• Learn from the experts: Unparallel Expert Faculty Panel
• Learn from expert faculty panel consisting of head of prop desks, pioneers of
quantitative modelling in India, Ph.D’s from leading institutes like IISC Bangalore
• Duration: 6 Months
• Schedule: Saturdays and Sundays
• Fee: INR 85,000/- (All Inclusive)
Email id: info@iiqf.org Phone No: +91-9769860151
www.algoji.com
Mean Reversion Trading
Systems
Presented by : Vishal Mehta , CMT
Million Dollar Question ?
Why Mean Reversion Trading Systems

❑Lasts for few hour to few weeks.


❑You Buy Low and Sell High (Comfortable for Traders)
❑Low Capital Deployment.
❑High Win to Loss Ratio .
❑Smooth equity curve.
❑Low drawdown.
Mean Reversion Trading Systems
Mean Reversion Trading Systems
Market Regime

Bear Phase Bull Phase Bear Phase Bull Phase

Sept’ 09- Dec ‘11 Jan ‘11 – Feb’15 Mar’15- Feb’16 March’16 – Jan’18
(Bear Phase) (Bull Phase) (Bear Phase) (Bull Phase)
NIFTY 5476 - 4626 4650 - 8986 9006 - 7014 7236 - 11138
Point -850 Points +4336 Points -1992 Points +3902
Drop/Gain
% -15% 93% -22% 53%
Drop/Gain
RSI System
RSI System Performance Report

Nifty Sept’09 – Jan ’18 5476 – 11138 = 5,662 Points

RSI System +1228 Points

% Win 66%

% Time in Market 663 Days out of 3075 Day (21%)


Can I better this system ?
RSI System
RSI System

Nifty Sept’09 – Jan ’18 5476 – 11138 = 5,662 Points

RSI System +4497 Points

% Win 72%

% Time in Market 942 Days out of 3075 Day (31%)


Can I better this system even more?
RSI System
RSI System Performance

Nifty Sept’09 – Jan ’18 5476 – 11138 = 5,662 Points

RSI System 2 +5654 Points

Win 73%

% Time in Market 1087 Days out of 3075 Day (35%)


Too Much Drawdown ?
RSI System
RSI System

Nifty Sept’09 – Jan ’18 5476 – 11138 = 5,662 Points

RSI System +4034 Points

Win 83%

% Time in Market 491 Days out of 3075 Day (15%)


FAQ

Q : If the strategy is so good why are you disclosing it ?

Q: What about Stop Loss ? Hedge – Options ?

Q: What should I do while there are no trades ?

Q: You have not taken slippage, impact cost, Rollover cost etc.. ?

Q: Do I need to have Algo to execute the same ?

Q: Can I open the trade next day morning rather then closing ?
Thank You

Email : mastertrader21@gmail.com
Twitter : @vishalmehta29
Linkedin : Vishal Mehta, CMT
www.algoji.com
Strictly Private and Confidential

Strategy Development
Snehal Soni
Product Head- Algo
Edelweiss Broking Limited
Introduction: Popular Approaches

 Fundamental Analysis
➢ Top Down approach (EIC framework)
➢ Bottom Up approach (Stock Specific)
 Technical Approach: Traditional Approach
➢ Trend Analysis: Trending & Non Trending
➢ Chart Analysis / Price Patterns
➢ Technical Indicators
 Quantitative Approach
➢ Rule Based
➢ Statistical driven
➢ Mechanical Trading System

May 13, 2018 120


Financial Markets: Efficient Market Hypothesis

 Are variations in prices are just random noise ??

 Do they represent profitable trading opportunities ??

 What categories of information are valuable to a trader ??

The various Levels

 Strongly efficient : Even Insider is discounted by Prices

 Semi – Strong Efficient: Public Information / Fundamentals etc

 Weakly Efficient : Historical Prices & Volume Information

“I’d be a bum with a tin cup in the street if the markets were
efficient”…. Warren Buffet

May 13, 2018 121


Financial Markets: Overview

 Financial markets are non-stationary time series / Auto


correlated / Fat tails etc

 Designed to recognize, exploit patterns that precede profitable


trading opportunities

 As trader develop and trade models, inefficiencies that model


identify are removed from the market they trade

 Characteristics of market change over time in part because


trading system makes them more efficient

 Trading System that once worked will fail

May 13, 2018 122


Strategy Development: Data

 Data

 Clean and Reliable: Basic level Check

 Issue with Cash Data: Adjusted for bonus, stock-splits etc

 Issues with Derivative Data : Expiry date

 Duration: Intraday or EOD

 Free Sites like : finance.google.com, finance.yahoo.com

 Division of Data into in-sample and out-of-sample data

 In-sample date: Optimization

 Out-sample Data: Validation

May 13, 2018 123


Trading System Overview

Trading system should jell with your psychology

 First Step: Design a template of a trading System that


includes the most important and relevant features

Three Step Approach

 First Step

 Define Objective Function: Single Score

 Trading Frequency: High, Medium or Low

 Order Style: MOO, MOC, Limit Vs Market Order

May 13, 2018 124


Trading System Overview

Second Step

 Trading account : Starting Balance Size

 Type of Position: Long only ; Short only ; or Both

 Issues Selection: Equity, Commodities, FO etc

 Leverage

 No of position which will be open simultaneously

 Margin usage

 Risk Assessment: % of trading capital on any single position

May 13, 2018 125


Trading System Overview

Third Stage

 Entry & Exit Conditions (Profit / Stop Loss)

 Backtesting : In-sample data & Out Sample Data

 Optimization : Brute Force Optimization

 Validity Test using Run Test

Post Validity, Go live on Pilot basis before going full fledged live

May 13, 2018 126


Risk Management

Risk Management…

Is the risk worth taking ???...in the long run ??

Hit Rate = 35 % , 25%

Loss Rate= 65% , 75%

Risk : Reward = 1 : 3

Expectancy (1) = 3 X 0.35 -1 X 0.65 = 1.05-0.65 = 0.40

Expectancy (2) = 3 X 0.25 -1 X 0.75 = 0.75-0.75 = 0.00

 KEY IS RISK MANAGEMENT & not HIT RATE

May 13, 2018 127


Money Management
How much money you want to risk per trade ??

……..in one’s trading a/c ?? in one day ??

Simply put.. How do you trade that minimizes your loses..

Thru …Hard Stops…Rolling Stop Loss.. Position sizing


Hit Rate = 35 %
Loss Rate= 65%
Risk Capital per Trade: 1 %
Total No of trades : 100
Probability= (0.65)^100 =1.9X10^-19
 Probability has a multiplicative effect not additive

 Easy to say….Difficult to implement

May 13, 2018 128


Money Management: Paradox…

 The more you have …

…....the less risk you take

Everyone knows its importance..

……few actually implement it

This time its different…

…..this is a big one…

May 13, 2018 129


Money Management: Approach..

 It is all about Taking small loses …but large profits

 Capital Preservation Vs Capital Appreciation

 Lose battles ….but Win war

 Live today to trade the next day..

 Never overleverage

 Loose only that much you are comfortable with…

 Plan your Trade and trade your Plan

 Never make plans on the fly…No Impulsive trading

May 13, 2018 130


Risk & Money Management….

Simply Speaking…
Risk Management is everything you do before
you take a trade

Money Management is Everything you do after


you take a trade

May 13, 2018 131


Trading System: Quantitative Approach

Set of well defined Rules / condition which generate Buy / Sell


Signals. It include
1. Entry Rules (Limit / Market / MOO/ MOC)

2. Exit Rules (Bullet / Bar-bell )

3. Stop Loss Rules (Hard Stop Loss / Trailing Stop Loss)

4. Money Management Rules (Risk Capital Per Trade)

5. Risk Management Rules

6. Contingent Variables / Filters etc

May 13, 2018 132


Trading System: Signal Generation

Price of any tradable instrument at any given time can be


categorized into

 Trending

 Trading Range
Accordingly, we have two types of trading systems
1. Trend Following Systems

2. Mean Reverting Systems

May 13, 2018 133


Trading System : Trending Following System : Inertia

Based on premise that prices continue to move in one direction for


a long period of time; one can recognize that trend has begin; take
a position in the direction of trend to profit from it

Advantage : Have Build in Stop-Loss Feature

Example of Trend following systems:-

 Moving Average Cross-Over System

 Breakout System

 Adaptive Moving Average System

May 13, 2018 134


Moving Average Crossover System

Takes position when the fast moving average crosses


Slow Moving Average from below or top

Buy Condition: Fast MA cuts from below and rises


above Slow MA

Sell Condition: Fast MA cuts from above and


penetrates Slow MA

Always in the market Strategy wherein Buy and Sell


automatically liquidates previous position and takes
fresh position

May 13, 2018


Adaptive Moving Average System

Concept: Noisy market requires a slower trend than a


quite trend.

Moving Average should lag further behind a noisy


market to avoid whipsaws

Approach: Use Fast MA in trending market and Slow


MA in noisy / congesting market

Example: KAMA (Kaufmann Adaptive Moving


Average System)

May 13, 2018 136


Break-Out System

1. Model 1 :

 Buy the close if close is higher than open

 Sell the close if close is lower than open

2. Model 2: Bollinger Band

 Buy as the Price rises through the upper Bollinger band

 Exit when the Price drops into the Bollinger Band

May 13, 2018 137


Break-Out System

3. Model 3:

 Buy when high rises above previous high of 20 (n)


days

 Sell when low drops below the previous low of 10 (n)


days

 Set a maximum loss stop based on Volatility (possible


using ATR)

May 13, 2018 138


Mean Reverting System (MRS)

 MRS are based on premise that price tends to oscillate


above and below (market determined) a level of
equilibrium with some degree of regularity

 Fails badly when in trend as the system is designed to take


position against the trend

May 13, 2018 139


Mean Reversting System (MRS)

 Reversion trading does not mean buying when price rallies


or selling when it drops;

 One needs to wait for a confirmed shift in price and only


when clear signals that the balance between bulls and
bears has shifted ,one enters the traders

 Patience is a big part of being a mean reversion trader and


one has to be on the sidelines most of the time

May 13, 2018 140


Mean Reversion System (MRS)

 Must have a filter to identify whether the market is


Trending or Non Trending Mode

Models 1: Anticipating Mean Reversion

 Buy after three down days

 Sell after three up Days

May 13, 2018 141


Mean Reversion System (MRS)

Use following types of tools

 Oscillators

 Mean Reverting Indictors

 Overbought/Oversold Indicators

 Sentiment

May 13, 2018 142


Adaptive Trading Models: Best of Both..

Use following types of tools

 Stand-alone Trend Following Models

 Stand-alone Mean Reverting Model

 Strength of Trend composite to determine whether


market is trending or churning sideways

 Diffusion Models based on signals from ADX,


Efficiency Ratio, R2 and Bandpass filter Indicators

May 13, 2018 143


Adaptive Trading Models

May 13, 2018 144


Adaptive Trading Models : Popular Tools

 Wells Wilder’s ADX

 Perry Kaufman’s Efficiency Ratio’s*

 Linear Regression:

Correlation coefficient value (r2) is the result of


measuring the residuals of a linear regression. Linear
regression fit is strong, r2 will be near 1, indicating a
trending market.

Linear regression fit is weak, r2 will be near 0,


indicating a directionless market.

May 13, 2018 145


Adaptive Trading Models : Popular Tools

 Wells Wilder’s ADX: The Trend Strength Indicator

 ADX is used to quantify trend strength and is non -


directional.

 ADX calculations are based on a moving average of


price range expansion over a given period of time.

May 13, 2018 146


Adaptive Trading Models : Popular Tools

 Low values is usually a sign of accumulation or


distribution

 Period of Low ADX leads to various price patterns

May 13, 2018 147


Adaptive Trading Models : Popular Tools

 Perry Kaufman’s Efficiency Ratio’s:

 Measures the ratio of the relative market speed in


relation to the volatility.

 Used as a filter to help avoid trading when the market is


“choppy” or flat ranging markets.

 Use to identify smoother market trends.

 Value oscillates between 0 and 1, where higher values


represents trending market

May 13, 2018 148


Potential Model Enhancements

 Use of Filters

 Multiple time frame

 AD Ratio

 Volume Filters, buy or sell only

 Improve optimization techniques to choose strength of


Trend Indicators

 Look for additional indicators to help determine market


environment (Janus Factor, Performance of Quant
Factors)

May 13, 2018 149


Points to Ponder !

 Avoid working with point difference rather work with


ratios or percentages

 Aware of structural changes

 Manual Vs Program Trading

 Greater no of shares being traded today– AD no’s


cannot be compared

 Normalize the data using ratios

 Deviation from Trend

May 13, 2018 150


Thank You

Contact for more details:


Snehal Soni
Edelweiss Broking Limited,
First Floor, Tower -3, Kohinoor,
Kurla (W), Mumbai-
Email: snehalsonie@gmail.com
www.algoji.com
Fixed income Trading strategies
global markets
Chintan thakkar – 5th may 2018
Global exchanges
bonds
• Fixed Income Instruments • Term to Maturity
• Principal
• Bond Auctions
• Coupon Rate
• Bond Pricing – Present Value of it’s cash • Coupon Frequency
flows
• Measuring Risk
• Macaulay Duration
• Modified Duration

• Key Characteristics
• Type of Issuer
Yield curve
Cme group interest rate products
3.50%

Eurodollars 0-10 Years Ultra


Long Bond
3.00%
Classic
Long Bond 30-Year MAC
2.50%
Ultra 10-Year 20-Year MAC
T-note
2.00%
10-Year 10-Year MAC
T-note

1.50% 5-Year
7-Year MAC
T-note

2-Year
1.00% T-note 5-Year MAC
CME Group Interest Rate futures
include Fed Funds, Eurodollars,
2-Year MAC US Treasury, and Swap based products.
0.50%

30-Day Fed Funds; 0-3 Years

0.00%
0 2 5 7 10 20 30
Treasury futures – contract specifications
2-Year T-Note Futures 5-Year T-Note Futures 10-Year T-Note Futures Ultra 10 Futures T- Bond Futures Ultra T-Bond Futures

Face Amount $200,000 $100,000 $100,000 $100,000 $100,000 $100,000

Deliverable Maturities 1 3/4 to 2 years 4 1/6 to 5 1/4 years 6 1/2 to 10 years 9 5/12 to 10 Years 15 years up to 25 years 25 years to 30 years

Contract Months March quarterly cycle: March, June, September, and December

Trading Hours Monday - Friday; Electronic: 5:00 pm - 4:00 pm, Sunday - Friday (Central Times)

Last business day of contract month; delivery


Last Trading & Delivery Day prior to last seven (7) business days of contract month; delivery may occur on any day of
may occur on any day of contract month up to
Day contract month up to and including last business day of month
and including last business day of month

In percent of par to In percent of par to one In percent of par to In percent of par to


In percent of par to In percent of par to
Minimum Tick one-quarter of 1/32nd quarter of 1/32nd of one-half of 1/32nd of one-half of 1/32nd of
1/32nd of 1% of par 1/32nd of 1% of par
of 1% of par 1% of par 1% of par 1% of par

Minimum Tick Value $15.625 $7.8125 $15.625 $15.625 $31.25 $31.25


Yield curve trading strategies
• 2 Year – 5 Year Spread
• 5 Year – 10 Year Spread
• 2 Year – 5 Year – 10 Year Butterfly
• 5 Year – 10 Year – 30 Year Butterfly
• And many more Spread and Butterfly Combinations
Constructing a yield curve trade
• Note: The DV01 or Duration of a Longer dated bond is higher than a shorter
dated bond

• I.e. The dollar value change for a 1% change in interest rate change is higher for a
10 Yr bond than a 5 Yr bond

• Yield Curve Trade requires DV01 to be equalized (or close to equalized)

• How do we calculate the appropriate hedge ratio?


Treasury futures analytics tool
Calculating 2 Year – 10 year spread
• The shorter maturity bond is usually taken as the first leg of the trade and longer
maturity bond is the second leg

• Price calculation formula = 2 Year T-Note x 208 x 2 minus 10 Year T-Note x 100

• = 107-217 x 208 x 2 – 124-270 x 100

• Note: 2 Year T-Note is multiplied with 2 since the underlying for this contract is
$200,000 which is twice that of a 10 Year T-Note which is $100,000
Treasury futures analytics tool
Calculating 2 Year – 5 year – 10 year butterfly

2 Yr T-Note 5 Yr T-Note 10 Yr T-Note


• In a butterfly trade, a trader buys or sells the near
126 100 2s5s Spread
163 100 5s10s Spread spread i.e. 2s5s and does the opposite to the far
15 24 8 Matching 5 Yr Leg spread i.e. 5s10s. Assume that trader buys the 2s5s
2 3 1 Smaller Ratio spread

• (+ 2 Year T-Note – 5 Yr T-Note) – (5 Yr T-Note – 10 Yr T-


Note)

• 2 Yr T-Note x 2 x 2 – 3 x 5 Yr T-Note + 10 Yr T-Note

• 107225 x 2 x 2 – 117060 x 3 + 124300 x 1


Advantages of trading spreads and butterflies

Multiple
Low risk per
Intraday
trade
opportunities
Relatively
lower margins
and greater
capital
efficiency
No direct Trades in an
exposure to identifiable
interest rates range
What can move these strategies?

Federal
Geopolitical FOMC Rate
Reserve
events Decisions
Meetings

GDP & Jobs Report


Retail Sales
Inflation (NFP)
Thank you
CHINTAN THAKKAR

chintanthakkar@hotmail.co.uk
info@tradinginstitute.org
www.algoji.com
Experiences

Deepak Pundir
Algo Head, FinDoc
Automated Algorithm / HFT/Quant Rule Based Algo / AI Based Algo
(C,C++,C#, R, Python, AFL)
Types of
market
strategies

Statistical Intraday Positional


Arbitrage Algos Algos
Statistical Arbitrage
This type of strategies are basic arbitrage strategies such as cash to
future, Inter-exchange & triangular international arbitrage.
A). Future-Future
B). Conversion – Reversion
C). Delta Hedging strategies(IV, IV Spread)
D). Cash – Future
E). Butterfly, Pair Scalping, Option Ratio etc.

PRACTICAL ISSUES
A). Rapid Strategy Implementation
B). Need best Infrastructure
C). Internal Order Matching
D). New guide line from exchange.
Intraday Algos
This type of strategies involve the Market Making, HFT , LFT, Quant
based algo ,AI , ML and other momentum play for intra day churning
most of the strategies in this segment involve fund for very less time.
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.

PRACTICAL ISSUES
A). The coding and flow of strategies.
B). Need best Infrastructure
C). Data Crunching for best trading parameters.
Positional Algos
These system has great advantage of being able to take the emotions
of greed and fear out of trading and ensure profitability over time in
different market conditions. This is a High Risk and High Return
Strategy.
These type of strategies involve long term period investment based on
the indicator derived from a algo that generates signals and execute
them automatically.
Base of all models are Mathematical Model, Statistical Analysis,
Optimization Techniques, Technical Analysis, AI,ML.

PRACTICAL ISSUES
A). Proper back testing.
B). Proper money management system according to algo.
C). Reliable Trading Infra.
various returns over the period of
last 5 year.
Annualized
Types Of Algo Return
Max Drawdown Infra cost

Step 1:
Statistical 20- 25%(approx) NILL(approx) Higher Infra Cost
Arbitrage

Step 2:
HFT/LFT/Quant
Based 40-45%(approx) 5-10%(approx) Higher Infra Cost

Step 3:
50-60%(approx) 15-20%(approx) Less Infra cost
Positional Algos
deeppundir16@gmail.com
www.algoji.com
Algorithmic Trading
Crypto-currencies

Garv Khurana
Institute and Faculty of Actuaries
Cryptocurrency Features
(Trading Perspective)

• Similar to Forex markets


• crypto-fiat, crypto-crypto pairs
• Less trade regulations
• Markets are weak—form
inefficient
• Highly volatile
• Ease of transfer
• Transparent risks
• Increasing market cap
• Growing market places ( New-age
platforms)
Exhibit 1- One Pair Arbitrage
Exhibit 2 - Three Pair Arbitrage
www.algoji.com
INDIAN TURTLES
Presented By
Mayur Sampat

Mumbai Algo Traders Conference


5th May 2018
Mayur Kishore Sampat, am full time Trader,
Coach & Mentor, I am not a former market maker
or specialist or a licensed professional in the
financial industry, yes, I have done Technical
Trading courses form BSE Institute to start with,
then became a Online Trading Academy Grad.,
NISM Certified Forex, Capital Market & Derivative
& Investor Advisor level 1.

However to remind you that I am too a Retail Investor just


like you, who found a way to be successful and profitable
trading stocks like a real 'business; from my home office.

By profession Computer Engineer, PDCME, DBM was into Computer Hardware


Business for almost 20 plus years, before I accidently took trading stock market as a
new Business.
ONE QUESTION YOU ASK YOURSELF

ARE
WE
TAKING
MONEY
HOME ?
Quarterly Results

• Maruti with Profits


went down 2.18%

• Axis Bank with


Losses went up by 9.21%

ALGO Based trading helps removes emotions


DO YOU HAVE A TRADE PLAN

THAT’S WHERE THE ALGO BASED TRADING HELPs


MARKET IS ONLY ABOUT
RISK N RISK MANAGEMENT

S u c c e s s f u l Tr a d e r s F o c u s o n R i s k

Algo based trading helps in risk management


EVERY DAY WE ARE IN MARKET

YOU CAN NOT BE


WHAT YOU WANT


TO BE’
IF YOU KEEP
REPEATING THE
SAME THING
EVERYDAY
&
“NOT LEARNING
FROM YOUR PAST
MISTAKES”
Carry home points
❑ REMEMBER EVEN IF YOU ARE NOT THERE
THE MARKET REMAINS

❑ YOU CAN ONLY REMAIN ALIVE IN MARKET


BY PROTECTING YOUR CAPITAL

❑ DO NOT OVER TRADE

❑ DO NOT BE GREED & BLAMES OTHERS

❑ DO NOT DEVIATE FROM YOUR PLAN OF ACTION


(TRADE PLAN)

❑ TAKE BABY STEPS INITIALLY AND WORK YOUR WAY TO TOP


Winning Attitude Requires
CLARITY
FOCUS
DEDICATION
TARGET
THANK YOU
MAYUR SAMPAT
indianturtles.mumbai@gmail.com
www.algoji.com
Santosh Kumar Pasi
santoshpasi.blogspot.com
197
Profile
Santosh Kumar Pasi
• IT Securities professional
• 21 Years experience in IT
• 12 Years experience in trading (Stock, Futures, Commodities, Forex and Options)

• Currently managing “OptionsOracle India Plugin”


• Developed application “OpStrater”

• Worked/Travelled in India, USA, UK, Australia, Singapore and Sweden

santoshpasi.blogspot.com 198
Trading - Focus
• Chances of winning
Probability

• Risk to Reward Ratio


Profitability

• Greek should be reasonable, under control


Greek

• Controlled position size


Position Size

santoshpasi.blogspot.com 199
Algo Trading
You can delay it, but can’t be ignored

Better adapt now and get advantage of early-bird entry

Emotionless, but systematic trading

Keep evolving

santoshpasi.blogspot.com 200
Thank you

.
• Thank you for your attention

santoshpasi.blogspot.com 201
www.algoji.com
SIMPLE YET EFFECTIVE
Sachin Sarvade
• A hammer is a type of bullish
reversal candlestick pattern, made up of just one
candle, found in price charts of financial assets. The
candle looks like a hammer, as it has a long lower
wick and a short body at the top of the candlestick
with little or no upper wick.
• SOURCE- WIKI
THANK YOU
•SACHIN SARVADE
•RESEARCH ANALYST- TECHNICAL
•EMAIL ID- candilstick@gmail.com
www.algoji.com
Thank You
Ajay.shukla123@gmail.com
Activate 15-day Subscription of FoxTrader
₹0.00 (free)

Call 022-4091 8900


Visit http://foxtrader.in/
Amibroker For Professional Strategy Design and Algo
Trading (APSAT)
₹20,000.00
Curriculum Revised!
•Two-month intensive online training with personal classes
•Program, backtest, and deploy advanced multi-leg strategies on hedging, option
chains, pairs etc.
•Program, backtest, and deploy advanced scale-in, scale-out and grid trading strategies
•Seamlessly integrate Amibroker and Python for exhaustive machine learning
•Build custom execution strategies by programming order management rules
•Combine different premise like trend, momentum, mean-reversion into a single
powerful strategy
•Combine uncorrelated strategies into a robust portfolio

https://algoji.com/training/amibroker-apsat/
Python for Algorithmic Trading
₹0.00 (free)
•Understand quantitative side of trading and investing
•Build a solid foundation in python programming strategies
•Discover and validate trading strategies using python code templates
•Increase your chances of employment in Algorithmic Trading firms
•Start a side-job that doesn’t interfere with office hours
•Grow a large fund for your retirement
•Give up views, opinions, and whims; start scientific trading and investing

https://algoji.com/training/python-for-algorithmic-trading/
5th May, 2018

Вам также может понравиться