Tuesday, November 19, 2013

SBI trade

SBI Price = 1821.35
BUY  1 lot of 1750 PUT  @ 11.90
Delta = -0.22
Theta = -1.46
SELL 1 lot of 1800 PUT  @ 24.10
Delta = -0.38
Theta = -1.64
Credit = 12.2
Return/Risk = 12.2/37.8
Position delta = 16 deltas

Go to Option Strategy Graph.

Friday, November 8, 2013

NSEDatabase

I am starting a new package called NSEDatabase which will contain some tools to collect historical quotes from NSE India website and store it as a database. I would also make tools to process the data with different strategies and try to find the profit potential of the strategy. It is a new endeavor and I am not sure how it will proceed further.

The project can be found at: https://github.com/chinmayHundekari/NSEDatabase

Tuesday, October 29, 2013

Follow up on L&T

L&T has recovered handsomely to 977.9. 920 CALL @ 58.3. It is ideal time to book profit of 18.5*750=13875.

Investment: 29850
Profit: 13875
Days held: 3

Friday, October 25, 2013

Follow up on L&T & ICICI Bank

Follow up on L&T & ICICI Bank.

L&T moved in an undesirable direction and closed at 947, down 16 points from 963. The 920 CALL closed at 33.60, down from 46. It is a good time to buy 1 more lot, so the average price reduces to 39.8. If the stock regains yesterday's close, then we would be able to break even.

ICICI bank closed 1022, 2 points up from previous close. The trade could be closed today with the following results.

BUY 1000 CALL @ 36.00 - SELL 1000 CALL @ 34.60
Profit = -1.40
SELL 1020 CALL @ 26.00 - BUY 1020 CALL @ 21.30
Profit = +4.70

Net profit = 3.30
Investment gain = 825

On the other hand, the trade could be kept for the rest of the week, for a max gain of 2500. I would prefer to book profit, considering the market is in a down trend.

Thursday, October 24, 2013

L&T & ICICI Bank

Larsen & Tubro (NSE:LT) has moved from 800 on Oct, 07 to 963 on Oct, 24. I hope the trend would continue next week. To profit most from the trend I suggest to purchase 920 Call @ 46.00. This is a high delta of 82. The call will be held for 1 week. Additional purchases may be done, if the price falls next day.

ICICI bank  has moved from 893 on Oct, 07 to 1020 on Oct, 24. I hope the bank stays above 1020. So i suggest the following trades.

BUY 1000 CALL @ 36.00
SELL 1020 CALL @ 26.00

 The trade is 10 profit/10 loss. The position will be held till expiration next week.

Monday, October 21, 2013

Money management


With this chart we can observe that there is 75% chance of making profit. 12.5% chance of no profit no loss and 12.5% chance of major losses. It is important that the technical study done before implementing this money management strategy should not have false signals with high losses. This strategy covers only false signals with minor losses.

Friday, October 18, 2013

Brokerage on Zerodha 2


  • Number of trades - 3
  • Quantity bought - 200
  • Quantity sold - 200
  • Gross total - 57480
  • Turnover charges - 45.41
  • Stamp charges - 3.45
  • Service tax - 13.03
  • STT - 5
  • Sebi charges - 0.06
  • Total brokerage - 60
The brokerage is 0.12% of Gross total and Rs. 60 for 3 trades.

Wednesday, October 16, 2013

Strategy as of today

Money Invested : 15,000
Instrument : NIFTY Call or Put options with price in range 100-150
Lots : 2
Lot size : 50
Initial setup : Bollinger bands are moving in upwards direction.
Strategy : Buy when price jumps of the middle bollinger band after returning from the top bollinger band.
Target : 10 points
Profit potential : 1000
Recovery : If the trade goes bad, then buy 2 more lots when the price starts to bounce back. Sell of with a loss if the market does not recover at all. 

Tuesday, October 15, 2013

Brokerage on Zerodha

Yesterday Oct 15, I traded on Zerodha for the first time. My first impression was of a total surprise. I was overwhelmed by the speed of execution of order and the ease of execution. I got carried away and ended up putting on 20 trades. most of them profitable but not worth the effort. All these trades were done in 36 minutes. One thing that I did learn was what the brokerage is charged on Zerodha.

The brokerage is split into 6 parts

  • Turnover charges
  • Stamp charges
  • Service tax
  • STT
  • Sebi charges
  • Total brokerage
To to give numbers to the variables as per yesterdays trades
  • Number of trades - 20
  • Quantity bought - 800
  • Quantity sold - 800
  • Gross total - 189317.5
  • Turnover charges - 149.56
  • Stamp charges - 11.36
  • Service tax - 67.93
  • STT - 16
  • Sebi charges - 0.19
  • Total brokerage - 400
The total brokerage is simple Number of trades multiplied by 20.

The rest seem to be function of Gross total. The sum of rest of the charges as a percentage of gross total is 0.129%

Hope these numbers are useful for estimating the profitability. Any comment on how to exactly get the values are welcome.

Friday, October 4, 2013

Nifty trade


Nifty had moved up the earlier significantly the earlier day. This led me to believe that today I should be bullish in my trade. I saw Nifty move up in the  morning and retrace back to 66% levels. But what signalled a buy decision was the sudden upwards movement of the stock in a bearish movement. After purchasing OTM options at 144, I had to wait for couple of minutes for the stock to form a base before climbing up.I put in a sale order at 150, modified it to 155 when the stock was going up and finally booked a profit when the first big red candle showed up on the minute chart. I sold at 150, while I saw a max of 152.75. I was more than happy to book the 600 rupee profit on 2 lots. The stock fell and did not recover till the evening.

Price = 144
Volume = 100
Investment = 14,400
Time held = 10.04 to 10.22 = 16 mins
Profit = 600
ROI = 4.16%
Capital = 100,000
ROC = 0.6%

Brokerage = 144
Service tax = 19.05
STT = 2.55
Total = 165.6

Net profit = 434.4

Thursday, September 26, 2013

Charts - 3 of n


The above chart of Nifty on 25 and 26 has the same formation as Charts 1 of n. The index should fall after this. A good strategy would have been to purchase on bottoms on 26th after seeing the cup formation on 25 Sep.

Thursday, September 19, 2013

Charts - 2 of n


On Sep 18, the index was flat till 14.30. This was followed by a bullish end of day rally. This indicated a buy signal. On Sep 19, on back of good news which was unknown a day before, we see a gap up. The first 5 minutes form the range for the next 3 hours. This was followed by a bullish rally for the rest of the day. As the news lead to overbought levels, there is seen some cooling down in the last hour to 6100 levels.

Wednesday, September 18, 2013

Charts - 1 of n



The above chart has a cup formation on 17 and a handle formed on 18, followed by the stock moving upwards. The handle on 18 also consists of a smaller and flatter cup and a handle. The consolidation from 10.30 to 11.30 on the 18th is a buy signal.

Tutorial on Cup & handle:
http://stockcharts.com/school/doku.php?id=chart_school:chart_analysis:chart_patterns:cup_with_handle_cont

Wednesday, September 11, 2013

Learnings from trading

  1. Do not hold position longer than a day. 
  2. Make a prediction. If the prediction holds then put on a position. If the prediction doesn’t hold then, then do not take any position. 
  3. Trade as small as possible. Trade often. 
  4. As the position is held for a day only, any profit even marginal is good enough to be booked. 
  5. Good time to trade is 9:30 to 11:00 am. 
  6. If the stock has moved up one day by a large amount(3.00% or more), then it would move up the next day buy a large amount too. 
  7. There is a higher chance the trend continues or slows down rather than a reversal.

Tuesday, August 20, 2013

21st Aug

Expect bank rally to continue on the good news. TCS should form a low here. http://option-strategy-001.appspot.com/ has been updated.

Sunday, August 18, 2013

Option Strategy Plotter

The earlier mentioned code for Option strategy plotter has been ported to Google app engine. Apologize for the bad UI. It takes in 3 strings as input with no validation. The format is the same as mentioned earlier. I will mention it here again.

Format:
The strategies are defined are strictly typed. For Stock the syntax is as follows.
<Long/Short> <Volume> Stock <Price>

and for option...
<Long/Short> <Volume> <Strike> <Call/Put> <Price>

link: http://option-strategy-001.appspot.com/

Couple of examples are given below to understand the possible options that are valid.

Long 250 1860 Call 11.05
Short 250 1960 Call 3.05
Long 1000 Stock 131.7
Short 800 Stock 134.7

Friday, August 16, 2013

16th Aug Review

NIFTY:
The stock broke all supports and freely slid downwards to 5500. Bad news spoiled the technical analysis. The stock slid 100 points in first hour and another 100 points in the last 2 hours. The fall should continue till 5400 level on Monday. 5416 also happens to be 200 week moving average. The market is bearish on the daily chart too.

TCS: 
Compared to NIFTY the stock performed really well. 1810 support was present.The next support of 1780 was also present. 1760 turned out to be good support and in spite of the market, TCS bounced back to 1780. TCS is a very good bet against the index.

ITC:
332 turned out to be a resistance after the fall in market. 320 levels are being held for now. At the max the stock will drop another 10 points to 200 day average.Stock should not breach 300 for the next few days.

CIPLA:
The morning was good. AT the stock was in a slumber for the evening. Interestingly, the stock fell the least out of the five. Stock has good support at 414 level.

BHARTI:
Bharti also held 335. There 11.3 points of movement on a bad day. A low was formed at 335. But with the bad market it might be broken a bit. Stock stayed below 347.


Thursday, August 15, 2013

16th Aug

Nifty:
The stock touched the middle bollinger band at 5720, which could be a minor support. 5700 is the major support. Stock will stay above 5700. There could be resistance around 5780. As this is a bullish trend the prediction will only be for the support. Stock might not have a strong rally like 13th Aug.

TCS:
There was a low at 1805, high at 1828, followed by low at 1818 and then high at 1841. So 23 points up, 10 down,23 up. Expect a low at 1830. The trend should be bullish in the day.1860 is still a hard wall.

ITC:
Suport is formed at 332. The stock should come down to maybe 332 levels and continue a rally.

CIPLA:
If 420 is held then stock will take one more day before a rally upwards. There is strong resistance at 416 level. The current level should be considered as low volatility towards the low. Expect a good morning followed by a slumber mid day.

BHARTI:
The volatility has increased with bigger movements towards lows. There might be a low forming here at 340 level. Volatility should reduce to signal a low. Expect less than 10 points of movement and a minor support at 341. It might be broken but stock will stay above 338 and below 347.

14th Aug Review

Nifty:
5720 resistance was tested.The stock went above and formed a support at 5700 levels. The low formed at 5700 level.

TCS:
Support at 1800 was tested instead of 1810. The range was 1800-1855. 1810 was broken but 1800 support was present. This could be interpreted as 1810 being 1800 in reality.

ITC:
There was resistance at 336.5. Support formed at 330 levels. Resistance at 340 was never touched. Support was formed in the first 2 hours and then stock moved upwards.

CIPLA:
Resistance at 430 leveles was tested. The stock came down to 420 levels. There was negative bias. A support may have been formed. We will know if it is held.

BHARTI:
The stock remained above 340 but the stock moved downwards instead of said upwards.

Tuesday, August 13, 2013

5 Stocks on 14th Aug

NIFTY:
Nifty has strong resistance at 5720 levels. 5620 will be the new support from now. The trend might continue as the stock is between bollinger bands on the 30 min chart. A breach on the upper side followed by a touch to the lower band will signal a good support. The prediction is for index to remain above 5675 and move upwards.with a possible low forming towards 5700 levels.

TCS:
Support at 1810 is being tested today. The range is 1810-1840. If the stock remains in the range then the stock will be ready to move upwards. If 1810 breaks then 1780 is the next support. The prediction is that 1810 will hold and the stock will start a bullish turn now.

ITC:
There is very good support at 320 levels and 325 levels.335 seems to be another support forming. The volatility has dropped drastically. There is resistance at 340 levels. Even if it goes below 325 should be easily maintained. There might be support forming between 330 and 335 levels. The prediction is the stock will move upwards after forming a support in the first 2 hours.

CIPLA:
Cipla has a weak support at 415 levels. It formed half an inverted bowl and then a flag pointing towards right. Better drawn as (_F. It has resistance at 430 levels. It should hit a wall and come down and spend a day at 420 levels. The reason for this is that the bollinger bands have contracted and need expansion. The most comfortable way seems downwards.The prediction is stock remains between 430 and 420 with negative bias as in forming a support.

BHARTI:
Bhart is on an upward move with support at 340. It should continue without much support, as it seems the major trend for the day is upwards. The prediction is stock remains above 340 and move upwards.

TCS and nifty - End of day

TCS:
TCS did not test a low of 1784. Instead it held the 1820 level. 1820 is the new support now. The volatility surely increased a lot, with the stock testing the upper bollinger band and the lower bollinger band too. TCS should move upwards from here. The day was overall bullish because of the opening.

Nifty:
Nifty had a third good day. 5675 was broken. buying 5500 call would have been a better idea. No lows were formed. An expected retracement never occurred, most likely because of the bullish sentiment. The volatility was the same as yesterday's. 

Monday, August 12, 2013

TCS and Nifty

TCS:
TCS has a support at 1750 on the daily chart. On the 30 min chart, for a bullish day we can observe that TCS expands in the morning session and normally stays in place for the rest of the day. TCS had tested a low of 1784 a day ago and this low could be tested again today. In a good scenario, today's low of 1808 is maintained and the stock stays above it. This would surely mean a bullish move from here.Below 1780 a lot of stop losses will trigger and the stock could move to 1760 levels too. The stock should be bullish for a below 1810 opening.The days volatility should be greater than today's. The stock should form a bottom today. So the day can be considered bullish.

Nifty:
Nifty has had very good 2 days. Aug 7th had 2 supports at 5500 levels. It is time for Nifty to make a low. But this low could still be higher than 5570.Most likely a low will form between 5570 and 5580 followed by another bullish day. Surely 5675 will not be broken.The volatility will be less than todays. Selling 5500 puts should be a good idea for this month.

The news is very bad for NIfty as it has been downgraded by a number of agencies. this should surely result in a much lower low than as expected earlier. It might even be a bearish day.

Wednesday, August 7, 2013

Natenberg Notes (1 of n)

I plan to start a series of notes from the book "Option Volatility and pricing" by Sheldon Natenberg. The book is considered very important for options traders. From this book, I would be noting down points relevant to trading. So here it begins.

Long Calls:

You expect
  • The underlying contract to rise in price
  • The underlying contract to move very swiftly.
  • Volatility to rise.
  • Time to decrease the value of your position.

Short Calls:

You expect
  • The underlying contract to fall in price
  • The underlying contract to move very slowly.
  • Volatility to fall.
  • Time to increase the value of your position.

Long Puts:

You expect
  • The underlying contract to fall in price
  • The underlying contract to move very swiftly.
  • Volatility to rise.
  • Time to decrease the value of your position.

Short Puts:

You expect
  • The underlying contract to rise in price
  • The underlying contract to move very slowly.
  • Volatility to fall.
  • Time to increase the value of your position.

Tuesday, August 6, 2013

Another Naked put

Earlier last month I had implemented a naked put on TCS. This position turned out to be very good. After a rally in TCS, the option lost 11 points, at which point i booked profit of 11 rs per share. For a total of Rs 2750. As the direction seemed right to me still I made another naked put on a 1760 put of TCS @ 16 rs. From what I observed that theta was meaningless and the position would change only if the stock moved. This nullifies the main reason to sell the put to collect theta gain. But we still get premium at a good rate of return. In the best scenario I stand to make another 4000 rs. The margin which is important was at  63, 000. So a return of 10% should be in order.

I do not have much idea about how to recover from a case where TCS falls drastically. That risk remains. So of the ways I could stop the fall is by buying an even more OTM put, or going aggressive and buying an ITM put. I prefer the aggressive route.

One observation regarding options is that the implied volatility seems to be high at all times. It is as though  the option market is in an constant state of fear. Volatility doesn't seem to change much. it just hovers around 30. It also appears that instead of changing a premium as multiple of days and volatility, a fixed amount is being charged all the time.Volatility seems to have a direction of its own. This makes delta very important. Also this gives some cushion to buying a call or put. A good idea could be to buy calls and put every time vol dropped below 30 and sell premium when it went to 35.

UPDATE: I found this link explaining a way to recover from failing naked puts.
http://www.optiontradingpedia.com/answers/repairing_losing_short_put_options.htm

Thursday, July 25, 2013

Options code updated - 25 Jul 2013

The earlier mentioned code has been updated. Now the files can be directly copied from a  dropbox link. A single compact example is shown for reference. Also now we can see probability that a strategy will return profit for the volatility.

Dropbox link: https://www.dropbox.com/sh/7yuzb20grpgg5de/fBUZBauRfx



Tuesday, July 23, 2013

First Naked Put

With current rise in TCS, it seems highly probable that the stock does not fall anymore. The rise might be subdued because of the 18% rise in the stock in the month of July 2013. This points coupled with me wanting to make my first thought out safe trade, brought me to selling deep OTM puts. I have sold one lot of 1640 TCS PE at 17.00. The strike is 1 sd away from the stock. The theta gain is 0.48 per day and delta loss is 0.2. By month end I expect to have collected the full premium of 4250.


Friday, July 19, 2013

Option strategy plotter


This code snippet displays the profit vs underlying diagram for a combination of  option strategies. The chart shows the amount of profit earned for the price movement at expiration and also the break even price.

Before we jump into the code, let us look at the python notebook example.



As we can see all the inputs need is the strategy themselves. We can also see that break even is at 107.33.

The strategies are defined are strictly typed. For Stock the syntax is as follows.
<Long/Short> <Volume> Stock <Price>

and for option...
<Long/Short> <Volume> <Strike> <Call/Put> <Price>


The graph is plotted using matplotlib's pyplot. This is the only externally used library.



import matplotlib.pyplot as plt

Next we need floating point version of range, and the best implementation happens to be the following



def drange(start, stop, step):
 r = start
 while r < stop:
  yield r
  r += step

Followed by processStrategy which processes individual strategy and generates profit of loss value for a particular price point. As we can see the the flow is split depending on whether we have Call, Put or Stock  and a Long or Short strategy.


def processOptionStrategy(strat, price_point):
 strategy = strat.split(' ') 
 if (strategy[2] == 'Stock'):
  volume = float(strategy[1])
  price = float(strategy[3])
 else:
            try:
                volume = float(strategy[1])
                strike = float(strategy[2])
                price = float(strategy[4])
            except:
                print "dumbass...numbers"
 if strategy[0] == 'Long':
  if strategy[3] == 'Call':
   if price_point < strike:
    return -(price * volume)
   else:
    return (((price_point - strike) * volume) -(price * volume))
  elif strategy[3] == 'Put':
   if price_point > strike:
    return -(price * volume)
   else:
    return (((strike - price_point) * volume) -(price * volume))
  elif strategy[2] == 'Stock':
                    return (price_point - price) * volume
  else:
   print "...Call or put"
 elif strategy[0] == 'Short':
  if strategy[3] == 'Call':
   if price_point < strike:
    return (price * volume)
   else:
    return ((price * volume)) - ((price_point - strike) * volume)
  elif strategy[3] == 'Put':
   if price_point > strike:
    return (price * volume)
   else:
    return ((price * volume)) - ((strike - price_point) * volume)
  elif strategy[2] == 'Stock':
                    return (price - price_point) * volume
  else:
   print "...Call or put"
 else:
  print "...Long or short"

and finally we plot a graph for all the possible price points in range. X axis values for all values present in strategies and breakeven points are also added.


def plotStrategy(strats, min1=0.9, max1=1.1):
 stratvals = []
 min = 100000
 max = 0
 xticks = []
 for row in strats:
     valstr = row.split(' ')[2]
     if valstr == 'Stock':
         val = float(row.split(' ')[3])
         xticks.append(val)
     else:
         val = float(valstr)
            if val < min:
                min = val
            if val > max:
             max = val
            stratvals.append(val)
            xticks.append(val)
 yvals = []
 xvals = []
 max = max * max1  
 min = min * min1
 for i in drange(min, max, (max - min) / 200.0 ):
  xvals.append(i)
  sum = 0
  for strat in strats:
   sum = sum + processOptionStrategy(strat, i)
  yvals.append(sum)
  if i in stratvals:
   xticks.append(i)
  if len(yvals) >3:
   if (abs(yvals[-1] + yvals[-2]) < abs(yvals[-1] - yvals[-2])):
    xticks.append(i-(max - min) / 200.0)
 plt.plot(xvals, yvals)
 plt.axhline(0, color='black')
 plt.xticks(xticks)
 plt.setp(plt.xticks()[1], rotation=60)
 plt.grid(b=True, which='major', color='g', linestyle='--')

and that's it. That is all required to plot Option strategies.

Downloading Yahoo IEOD charts

The following python script downloads yahoo 1 day charts and saves them for you.  I personally use this as IEOD data is available only at a price. The scripts are stored with a directory for each day. This might not provide continuity for most users but I found it useful to see the correlation between the stocks on a particular day. This script has been tested on Python 2.7 and requires no extra libraries. The code of getNIFTY.py is given below.
import urllib
import csv
import os
from datetime import date
fi = open("symbolList.csv", "rb")
symList = csv.reader(fi)
dt = date.today()
if not os.path.exists("./Intraday_YAHOO"):
    os.makedirs("./Intraday_YAHOO")
direc = "./Intraday_YAHOO/"+str(dt.year)+str(dt.month).zfill(2)+ \
str(dt.day).zfill(2)
if not os.path.exists(direc):
    os.makedirs(direc)

for row in symList:
 print row[0],row[1]
 url_chart = "http://chart.finance.yahoo.com/z?s=" + row[0] + "&t=1d&q=&l=off&z=m&a=v&p=s&lang=en-US&region=US"
 file_chart = direc+"/"+row[1]+".jpg"

 urllib.urlretrieve(url_chart, file_chart)
Create symbolList.csv with the format (<Yahoo symbol>, <image_finename>). An example is given below.
^NSEI,NSEI
ACC.NS,ACC
AMBUJACEM-EQ.NS,AMBUJACEM-EQ
AXISBANK.NS,AXISBANK
The folder structure that is generated should look somewhat like this.
~\
|   getNifty.py
\---Intraday_YAHOO
\---20130716
    |   ACC.jpg
    |   AMBUJACEM-EQ.jpg
    |   AXISBANK.jpg
\---20130717
\---20130718
\---20130719