• Data Analytics and Trading Systems in Stock Market

Reference: nseindia.com/products/content/equities/indices/historical_pepb.htm

Books on Technical Analysis and Candlestick Charting

These are economical editions for Indian sub-continent in the price range INR 450~700 /-
1. Technical Analysis of Stock Trends - by Robert D. Edwards and John Magee
2. Candlestick Charting Explained - by Morris and Litchfield
3. Martin Pring on Market Momentum - by Martin Pring

There is a GREEDY buyer, there is a PROFITABLE seller

These statements may look mysterious, foolish or obvious, the fact remains that money only changes hands in the stock market. Hence, if trades are evaluated over a long term, half shall be winners and remaining half shall be losers. Let's monitor from start of an IPO (when companies sell certain number of shares at certain price to the public):
1. X number of shares allotted each to A, B, C, D, E investors at price P0. Total shares= 5X
2. A sold it to F at price P1: A's profit/loss = P1 - P0
3. D sold it to G at price P2: D's profit/loss = P2 - P0
4. F sold it to K at price P3: F's profit/loss = P3 - P1
As one continues tracking the transactions in a particular share, it is a negative-sum situation unless the profit generated by the company is accounted for. The profit generated by the company results in dividends, bonus and business expansions.
Interest Rate Return Table

Following table gives an idea on interest rate and time required for money to double (100% return) and triple (200% return). The information can be used to benchmark the return from an stock market.

 Rate of Interest Time (in Years) to DOUBLE when compunded Time (in Years) to TRIPLE when compunded Annual Monthly Quarterly Annually Monthly Quarterly Annually 4% 17.36 17.42 17.67 27.51 27.60 28.01 5% 13.89 13.95 14.21 22.02 22.11 22.52 6% 11.58 11.64 11.90 18.36 18.45 18.85 7% 9.931 9.988 10.24 15.74 15.83 16.24 8% 8.693 8.751 9.006 13.78 13.87 14.27 9% 7.730 7.788 8.043 12.25 12.34 12.75 10% 6.960 7.018 7.273 11.03 11.12 11.53 11% 6.330 6.388 6.642 10.03 10.12 10.53 12% 5.805 5.862 6.116 9.201 9.292 9.694 13% 5.361 5.418 5.671 8.497 8.587 8.989 14% 4.980 5.037 5.290 7.893 7.984 8.385 15% 4.650 4.707 4.959 7.370 7.461 7.861 16% 4.361 4.418 4.670 6.912 7.003 7.402 17% 4.106 4.163 4.415 6.508 6.599 6.997 18% 3.880 3.937 4.188 6.149 6.240 6.638 19% 3.677 3.734 3.985 5.828 5.918 6.316 20% 3.495 3.552 3.802 5.539 5.629 6.026

Delta Calculator

Following entries can be used to calculate delta for up to 5 strike prices for a given spot-price. The default values are: Rate of Interest (ROI) = 5.0% per annum, Implied Volatility = 20 [%] and Dividend Yield = 0 [%]. In order to omit calculation in any row, specify lot size = 0. As an option trader, most of the money is earned through time decay and hence one should try to be delta neutral with only small bias in the anticipated direction of price movement.

 Spot Price: Days to Expiry (days): ROI: IV: Option Type Lot Size Trade Type Delta Values Strike Price-1: CALL PUT SELL BUY Delta-1: Strike Price-2: CALL PUT SELL BUY Delta-2: Strike Price-3: CALL PUT SELL BUY Delta-3: Strike Price-4: CALL PUT SELL BUY Delta-4: Strike Price-5: CALL PUT SELL BUY Delta-5: Net Delta:

Concepts

Fixed Income Option: Fixed income securities are investment where the cash flows are according to a predetermined amount of interest, paid on a fixed schedule. Popularly known as Debt instrument. In addition to fixed deposits with bankd, the different types of fixed income securities include government securities, corporate bonds, Treasury Bills, Commercial Paper. In broader terms Corporate bonds are fixed income securities issued by corporates i.e. entities other than Government. Public sector units, Banks, corporates, Financial Institutions are major issuer of corporate bonds. In NSE, the private placement securities are listed and traded in WDM segment of the Exchange. Public issues are listed and traded in CM segment of the Exchange.
• Fixed Rate Bonds:-have a coupon that remains constant throughout the life of the bond.
• Floating Rate Bonds: - Coupon rates are reset periodically based on benchmark rate.
• Zero-coupon Bonds no coupons are paid. The bond is issued at a discount to its face value, at which it will be redeemed. There are no intermittent payments of interest.
The % change in price of bonds is smaller than that of stocks as bond requires definite amount of money to be paid to the bond-holder (less risk) whereas holding stocks of a company merely represents the participation in proportionate fraction in the profits of the company after interest on bonds and dividend on preferential shares issued by the company.

T-Bill is a money market instrument to finance the short term requirements of the Government of India (GOI). The returns on T-Bill instrument shall be difference between the par value and issue price / traded price. T-Bills are issued at discount in primary auction conducted by Reserve Bank of India (RBI). Negotiated Dealing System - Order Matching (NDS-OM) is a platform provided by RBI to trade T-Bills in secondary market. Yield is the income (return) on an investment usually expressed as a % annual return. Yield can be quoted as Yield to Maturity (YTM) = [Par Value - Market Price] / [Market Price] x 365/[Actual Days] or Discount Yield (DY) = [Par Value - Market Price] / [Par Value] x 360/[Actual Days].

Daily Price Bands

Daily price bands are applicable on securities as below. For Auction market the price bands of 20% are applicable. Scrips on which no derivatives products are available but which are part of Index Derivatives, are also subjected to price bands.
• Group-1: Daily price bands of 2% (either way)
• Group-2: Daily price bands of 5% (either way)
• Group-3: Daily price bands of 10% (either way)
• Group-4: No price bands are applicable on scrips on which derivative products are available. In order to prevent members from entering orders at non-genuine prices (typing or data entry errors) in such securities, the Exchange has fixed operating range of 10%.
• Group-5: Price bands of 20% (either way) on all remaining scrips (including debentures, preference shares...).

Caveats

• Do not pay attention to the news, they are to justify the market actions. News has no prediction potential for stock price movement - only higher volatility can be expected when an important news such as quarterly result, RBI monetary policy... are to be announced.
• Credit rating agencies and brokerage house play it safe and may have their own vested interest. It is worth playig opposite to their findings (sell rating implies time is ripe for slow accumulation and vice versa).
• Trading process by its design is a negative-sum game. In other words, trading is always a "win-lose" situation and never a "win-win" or "lose-lose" situation.
• Insider trading is not illegal in its entirety and can be easily circumvented!
• Crashes change the players!
• Failing to plan is planing to fail! However, not all decisions are made with checklists - let your instinct and heuristics take over sometimes.

Data, Data and Data

FII-FPI trade data: refer to NSDL website www.fpi.nsdl.co.in/web/Reports/Latest.aspx

Since FII and FPI may trade on both NSE and BSE, the turn-over data from NSE may not be sufficient to estimate what fraction of trading volume is contributed by FII/FPI. Refer to the following data for trades on 31-May-2019.

As reported, total trades value by FII/FPI is 7,552 + 5,480 = INR 13,032 Crores which is 33% of total traded value in equities on NSE.

The turnover data on NSE for stock futures is INR 59,013 Crores where the FII/FPI contribution is 24,387 + 23,362 = INR 47,749 Crores which is almost 80% of the total trades. Similarly, the turnover data on NSE for index futures is INR 32,151 Crores where the FII/FPI contribution is 8,208 + 5,986 = INR 14,194 Crores approximately 40% of total traded value.

Candlesticks Summary
Candlesticks: Work only at Support / Resistance Level and reflect 'personality' of a stock - back test is a necessity! Long candles = buy/sell pressure, short = consolidation.
 Candlestick Type Next Verification Candle Probability Anticipated Move Hammer Gap-up opening next day ending in a Marubozu High Bullish Reversal after significant downtrend Morning Star or Abandoned Baby (Evening Star) Very potent as combination of > 2 candles High Reversal after significant trending market Three White Soldier (3 Black Crow) Doji or Bearish (Bullish) Engulfing High Early phase of trend reversal Piercing Candle 1st bearish candle with large body, high EOD volume High Bullish Reversal after significant downtrend Dark Cloud Cover Heavy volume during opening of 2nd day High Reversal after significant uptrend Long Marubozu / Belt-Hold Short Marubozu or Spinning Top Moderate Trend Reversal / continuation Harami or Petrifying pattern Gap up near bottom or gap down near top Moderate Decrease in momentum Doji Gap-down opening or formed after long candle Moderate Trend interruption / slowing momentum Shooting Star Gap-down opening next day ending in a Marubozu Moderate Bearish Reversal after significant uptrend Bullish (Bearish) Engulfing Volume on 2nd day, more potent if left stick is a Doji Moderate Reversal in trading market

Automotive sales data

The chart for consituents of BankNifty is as per post by NSE on Twitter date 01-May-2019.

Adapted from MOOC: Elements of AI by University of Helsinki

Probability in trading: We all need to guess the market direction and the impact of news on stock prices. From technical analysis perspective, an "informed guess" is analogous of estimating the probability. A key caveat about 'probability' that it is not probability calculus. Instead, it is the ability to think of uncertainty as a thing that can be quantified at least in principle. This means that we can and should be able talk about uncertainty as if it were a number: numbers can be compared ("is this event more probable than that even") and they can often be measured. Measuring probabilities is difficult and not unique method exists: we usually need many observations about a phenomenon to draw conclusions. However, by systematically collecting data, we can critically evaluate probabilistic statements, and our numbers can sometimes be found to be right or wrong. In other words, the key lesson is that uncertainty is not beyond the scope of rational thinking and discussion, and probability provides a systematic way of doing just that.

Elaboration by example:

A pattern analysis forecasts that the price is is going to increase by 2% with 75% probability tomorrow but the day turns out to be drop in price by 1%. Can it be concluded that the forecasting capability of this particular method is not good?

We can't conclude that the forecast was wrong based on only single event. The forecast said stock price is going to increase with 70% probability, which means price may drop or increase by lesser percentage with 25% probability or in one out of 4 days. It is reasonable to accept that the day in question was the 1 in 4 event. Concluding that the probability 75% was correct would also be wrong because by the same argument, we could then conclude that 50% chance of price increase by 2% was also correct and both cannot be correct at the same time.

Historical charts of Gold

The dialemma of long term investing is clearly visible from following chart.

Historical Price of Brent Crude

Historical data of NIFTY50 stocks and description of some MS-Excel based tools are summarized below.

Filters and Scans in Trade Tiger

To to filter for unusual activity in futures and option (sharp rise or fall in OI). Unusual option activity before key events typically represent insider information. An increase in CALL option OI at ask-price (seller's price) is bullish, an increase in CALL option OI as bid-price (buyer's price) is bearish. Similarly, an increase in PUT option OI at ask-price (seller's price) is bearish, an increase in PUT option OI as bid-price (buyer's price) is bullish.

Scan for stock based on your own pre-defined criteria

Some rules of stock market movement:
• The market direction rarely turns on a dime! It takes lot of time and energy to reverse the direction. Investors are like mules who take lot of pain before admitting defeat!
• Stock market and physics: price is displcement, rate of change of price (ROC) is velocity, moving average are inertia (mass), indicators like RSI is momentum - combined effect of mass and velocity (index - a train moving at slow / high speed, stocks - a motorcycle moving at slow / high speed).
• Trend is your friend until there is bend in the end! If weekly moving average (inertia or mass) is down, a move on daily chart against this direction may be a trap unless key supply zone or resistance levels are broken decisively.

View as on 13-Dec-2017

Technical analysis works, but market does retreat to some levels governed by fundamentals specially earning ratios. Combined "price earning ratio" of the stocks comprising the index is one such variable. In very simple terms, if you get 5% interest on your fixed deposits (FD), the PE ratio of your FD is 100/5 = 20. Similarly, if a stock is trading at 1000 Rupees and it generates profit of 20 Rupees per share in a year, its PE ratio is 1000/20 = 50.

NIFTY PE trading above previous year highs and a retracement is very likely.

There are only following 8 basic purposes of any option trade. One of these will be appropriate depending upon market conditions.

 Option Type Trade Type Purpose(s) CALL Buy Speculation: Bullish Outlook Hedging: Either short-sell in stock or futures Or short position (bearish speculation) in lower strike CALL CALL Sell Speculation: Bearish Outlook Hedging: Either long in stock or futures Or buy position (bullish speculation) in lower strike CALL PUT Buy Speculation: Bearish Outlook Hedging: Either long in stock or futures Or short position (bullish speculation) in higher strike PUT PUT Sell Speculation: Bullish Outlook Hedging: Either short in stock or futures Or buy position (bearish speculation) in higher strike PUT

Greeks

Delta

δ: The delta of an option is defined as the rate of change of the option price (preimium), Π with respect to the rate of change of underlying asset (stock, commodity, forex) price, S. Mathemtically, δ = dΠ/dS and for small changes in prices, δ = ΔΠ/ΔS. The calculation of option premium based on change in stock price and δ is correct ony for small changes in price say up to 5%. For large swing in price the impact of gamma, γ needs to be taken into consideration.
 Option type Position type δ Call Long (Buy) + Call Short (Sell) - Put Long (Buy) - Put Short (Sell) +

Gamma

The gamma of an option is defined as the rate of change of δ respected to the rate of change of underlying asset price: Γ = dδ/dS. Thus,

change in option premium = δ × change in stock price + 1/2 × Γ × (change in stock price)2

Theta

It is rate of change of the option price (premium) with respective to the passage of time.

Application of greeks. In practice the interaction or trade-off between these parameters is required to correctly estimate the premium and take benefit of expected change in option price.

• Change in stock prices result in higher value of the option price when gamma is positive and large. This means that when there is no change in stock prices, the value of the option will decline towards the expiration date.
• On the other hand, change in stock prices result in lower option value when gamma is negative and large. This means that when there is no change in stock price, the value of the option will increases towards the expiration and theta is positive.
• Hence, a trade-off between gamma and theta should be worked out so that they can be used as proxy for each other in a delta neutral portfolio.