Академический Документы
Профессиональный Документы
Культура Документы
www.algoji.com
Coding Cases
Saurabh Lohiya
Founder, AlgoJi
Example:
Amibroker ATS
Charting/Strategy • Real-Time
Software Market Data
Amibroker
AFL
Execution • Risk
Strategy Management In-house CTCL/
NEST/NOW/ODIN
Example: Example: Example:
Amibroker ATS Python ATS Amibroker ATS
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
• 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
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
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
% Win 66%
% Win 72%
Win 73%
Win 83%
Q: You have not taken slippage, impact cost, Rollover cost etc.. ?
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
“I’d be a bum with a tin cup in the street if the markets were
efficient”…. Warren Buffet
Data
First Step
Second Step
Leverage
Margin usage
Third Stage
Post Validity, Go live on Pilot basis before going full fledged live
Risk Management…
Risk : Reward = 1 : 3
Never overleverage
Simply Speaking…
Risk Management is everything you do before
you take a trade
Trending
Trading Range
Accordingly, we have two types of trading systems
1. Trend Following Systems
Breakout System
1. Model 1 :
3. Model 3:
Oscillators
Overbought/Oversold Indicators
Sentiment
Linear Regression:
Use of Filters
AD Ratio
• Key Characteristics
• Type of Issuer
Yield curve
Cme group interest rate products
3.50%
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%
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
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)
• 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
• Price calculation formula = 2 Year T-Note x 208 x 2 minus 10 Year T-Note 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
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
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
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)
ARE
WE
TAKING
MONEY
HOME ?
Quarterly Results
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
santoshpasi.blogspot.com 198
Trading - Focus
• Chances of winning
Probability
santoshpasi.blogspot.com 199
Algo Trading
You can delay it, but can’t be ignored
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)
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