• Data Analytics and Trading Systems in Stock Market

Books on Technical Analysis and Candlestick Charting

There are econimical Indian edition books 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

It is negative-sum game

Every BUY trade, there is a SELL trade

There is a PANIC seller, there is a GREEDY buyer

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 hand in the stock market. Hence, average of trade value is calculated over a long term, half are winner and half are losers. Let's take start of an IPO (every company came on stock exchange by selling certain number of shares at certain price):
  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

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.

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


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].

Stock Price Variations

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...).


  • 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 is 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.
  • Insidere 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.

NSE Turnover 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.

FII/FPI cash trade volume 31-May-2019

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.

FII/FPI derivative trade volume on 31-May-2019

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 TypeNext Verification CandleProbabilityAnticipated Move
HammerGap-up opening next day ending in a MarubozuHighBullish Reversal after significant downtrend
Morning Star or Abandoned Baby (Evening Star)Very potent as combination of > 2 candlesHighReversal after significant trending market
Three White Soldier (3 Black Crow)Doji or Bearish (Bullish) EngulfingHighEarly phase of trend reversal
Piercing Candle1st bearish candle with large body, high EOD volumeHighBullish Reversal after significant downtrend
Dark Cloud CoverHeavy volume during opening of 2nd dayHighReversal after significant uptrend
Long Marubozu / Belt-HoldShort Marubozu or Spinning TopModerateTrend Reversal / continuation
Harami or Petrifying patternGap up near bottom or gap down near topModerateDecrease in momentum
DojiGap-down opening or formed after long candleModerateTrend interruption / slowing momentum
Shooting StarGap-down opening next day ending in a MarubozuModerateBearish Reversal after significant uptrend
Bullish (Bearish) EngulfingVolume on 2nd day, more potent if left stick is a DojiModerateReversal in trading market

Automotive sales data

auotmotive sales data in table

auotmotive sales data in chart

Monthly data INR vs. USD chart

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

BankNifty constituents

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

gold Price 2004 to 2012

gold Price 2010 to 2018

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

Monthly price change in silver

Historical Price of Brent Crude

Brent crude Price 201 to 2018

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.

OI scan in Trade Tiger

Scan for stock based on your own pre-defined criteria

OI scan in Trade Tiger

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

NIFTY50 weekly RSI

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.

NIFTY50 PE Ratio

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

Option Trading

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
  • Either short-sell in stock or futures
  • Or short position (bearish speculation) in lower strike CALL
CALL Sell Speculation:
Bearish Outlook
  • Either long in stock or futures
  • Or buy position (bullish speculation) in lower strike CALL
PUT Buy Speculation:
Bearish Outlook
  • Either long in stock or futures
  • Or short position (bullish speculation) in higher strike PUT
PUT Sell Speculation:
Bullish Outlook
  • Either short in stock or futures
  • Or buy position (bearish speculation) in higher strike PUT



δ: 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 typePosition typeδ
CallLong (Buy)+
CallShort (Sell)-
PutLong (Buy)-
PutShort (Sell)+


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


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.
OutlookDescriptionBuyBuySellSellRemarkL:Lim/U:Unlim, Time ErosionProfit ProbabilityVega Strategy, Desired IV LevelDebit / Credit
BullishNaked Short Put--Put-ITM / OTML / U ! ++High: >90%- Vega | HighCredit
Bull Put SpreadOTM Put-ITM Put-Put credit spreadL / L ! -High: >90%- Vega | HighCredit
Long ComboOTM Call-OTM Put-U / U ! -Med: ~50%- Vega | High-
Synthetic Long CallStock / FUTRPut--Protective putU / L ! -Med: ~50%+ Vega | LowDebit
Synthetic Long-CallPut-same strk/maturityU / U ! -Med: ~50%+ Vega | Low-
Bull Call Spread(ITM) Call-(OTM) Call-Vert. Bull SpreadL / L ! +Low: <10%+ Vega | LowDebit
Call Backspread(Hi Strk) Call(Hi Strk) Call(Lo Strk) Call-Ratio Call SpreadU / L ! -Low: <10%+ Vega | LowDebit
Naked Long CallCall---ITM / OTMU / L ! --Low: <10%+ Vega | LowDebit
BearishNaked Short Call--Call-ITM / OTML / U ! ++High: >90%- Vega | HighCredit
Covered Put--Stock / FUTROTM PutL / U ! -High: >90%- Vega | HighCredit
Synthetic Long PutCall-Stock / FUTR-L / L ! -Low: <10%+ Vega | LowCredit
Bear Call SpreadOTM Call-ITM Call-Call Credit SpreadL / L ! +Low: <10%- Vega | HighCredit
Bear Put SpreadITM Put-OTM Put-Vert. Bear SpreadL / L ! -Low: <10%+ Vega | LowDebit
Naked Long PutPut---ITM / OTMU / L ! --Low: <10%+ Vega | LowDebit
Put Backspread(Lo Strk) Put(Lo Strk) Put(Hi Strk) Put-Ratio Put SpreadU / L ! -Low: <10%+ Vega | LowDebit
NeutralShort Straddle--CallPutsame strk/maturityL / U ! ++High: >90%- Vega | HighCredit
Short Strangle--OTM CallOTM Putsame strk/maturityL / U ! ++High: >90%- Vega | HighCredit
Long Call ButterflyITM CallOTM CallATM CallATM CallL / L ! +High: >90%NeutralCredit
Short Call ButterflyATM CallATM CallITM CallOTM CallL / L ! +High: >90%NeutralCredit
Iron CondorITM CallOTM CallITM CallOTM CallL / L ! +High: >90%NeutralCredit
Covered CallStock-OTM Call-Covered WriteL / U ! +High: >90%- Vega | HighDebit
Long StraddleCallPut--same strk/maturityU / L ! --High: >90%+ Vega | LowDebit
Long StrangleOTM CallOTM Put--same strk/maturityU / L ! --Low: <10%+ Vega | LowDebit
Covered StrangleStock / FTR-Sell CallSell PutStock b/w call/putL / U ! -Low: <10%+ Vega | LowDebit
CollarStock / FUTRPutCall-L / L ! +Low: <10%+ Vega | LowDebit
Contact us
Disclaimers and Policies

The content on CFDyna.com is being constantly refined and improvised with on-the-job experience, testing, and training. Examples might be simplified to improve insight into the physics and basic understanding. Linked pages, articles, references, and examples are constantly reviewed to reduce errors, but we cannot warrant full correctness of all content.