NexusFi: Find Your Edge


Home Menu

 





Standard Deviation Lines based on options expiration


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one greg9 with 11 posts (4 thanks)
    2. looks_two rmejia with 7 posts (12 thanks)
    3. looks_3 mcfalwell with 6 posts (0 thanks)
    4. looks_4 anidealworld with 2 posts (0 thanks)
    1. trending_up 21,774 views
    2. thumb_up 16 thanks given
    3. group 12 followers
    1. forum 34 posts
    2. attach_file 18 attachments




 
Search this Thread

Standard Deviation Lines based on options expiration

  #21 (permalink)
mcfalwell
dallas, tx
 
Posts: 6 since Mar 2014
Thanks Given: 0
Thanks Received: 0

@rmejia any way you could PM me?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Futures True Range Report
The Elite Circle
Exit Strategy
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
36 thanks
NexusFi site changelog and issues/problem reporting
25 thanks
The Program
20 thanks
GFIs1 1 DAX trade per day journal
19 thanks
  #22 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

@gsl8r

Checking the math thinkorswim wasn't calculating all of the closes in the length due to diferent timeframes. Can't find a way to specify a date and add a length to that. Specifying the Opt Exp date the length keeps defaulting to that period instead of days. Was only able to do it manually.

So manually one has to count the length of the period, last opt exp is 23 days, and how many days from today to the last day in that opt exp, from today it is 9 days ago. Enter that info on the study, then hit ok and it will calculate the SD and show the result in the label in the top left corner. After that reopen the study and enter that info in deviation and it will add it to the close line.


This is so similar to Pivot Points that I checked out a few and saw that these levels are very close to the CamarillaPoints pivot study R3 and S3. I only checked the past 2 months. The lines from the SD indicator are overlaid and are pretty close. In the Month before that drew a rectangle the size of the SD 7.428 and the CamarillaPoints S3 & R3 again are very close. Didn't keep checking past months. The default thinkorswim CamarillaPoints didn't have the Opt Exp option so added that, hid all the other levels and changed the linestyle. Attached is the modified indicator.

Attached Files
Elite Membership required to download: X_gsl8r2STUDY.ts
Elite Membership required to download: X_CamarillaPoints_R3S3STUDY.ts
Reply With Quote
  #23 (permalink)
mcfalwell
dallas, tx
 
Posts: 6 since Mar 2014
Thanks Given: 0
Thanks Received: 0


So can you use the Next3rdFriday operator in the code so you don't have to manually calculate days?

Reply With Quote
  #24 (permalink)
mcfalwell
dallas, tx
 
Posts: 6 since Mar 2014
Thanks Given: 0
Thanks Received: 0

Also, all three of my lines are bunched together using the new study - also, is there not a was to use the monthly IV and projected move numbers on monthly contracts on the monthly options expiration date? So for PCLN on 2.21.14 the stock closed at 1315.65 and the Mar14 Contracts had an IV of 24.73 percent and Projected move (stdDev) of 72.416 - is there a way to grab those three numbers and use them? Again, thanks for the help!

Reply With Quote
  #25 (permalink)
 
greg9's Avatar
 greg9 
SLC, UT
 
Experience: Intermediate
Platform: Sierra
Trading: ES CL
Posts: 108 since Mar 2013
Thanks Given: 102
Thanks Received: 67


rmejia View Post
@gsl8r

Checking the math thinkorswim wasn't calculating all of the closes in the length due to diferent timeframes. Can't find a way to specify a date and add a length to that. Specifying the Opt Exp date the length keeps defaulting to that period instead of days. Was only able to do it manually.

So manually one has to count the length of the period, last opt exp is 23 days, and how many days from today to the last day in that opt exp, from today it is 9 days ago. Enter that info on the study, then hit ok and it will calculate the SD and show the result in the label in the top left corner. After that reopen the study and enter that info in deviation and it will add it to the close line.


This is so similar to Pivot Points that I checked out a few and saw that these levels are very close to the CamarillaPoints pivot study R3 and S3. I only checked the past 2 months. The lines from the SD indicator are overlaid and are pretty close. In the Month before that drew a rectangle the size of the SD 7.428 and the CamarillaPoints S3 & R3 again are very close. Didn't keep checking past months. The default thinkorswim CamarillaPoints didn't have the Opt Exp option so added that, hid all the other levels and changed the linestyle. Attached is the modified indicator.

@rmejia

Thanks for looking into this. Going through your steps I can see that I can get the right lines but then I have to do that for each symbol individually and its a bit tedious if I'm going to go through a whole watchlist.

So the big kickers we need are:
1. A way of defining the days from Options ex to today and subtracting those so the calculation starts calculating from the close of the last options expiration.
2. A way of calculating the length of days in the calculation. So days from today to Opt_exp[1] - days from today to Opt_exp[2]?

Once we have those dynamically plotted the standard deviation will plot automatically.

Maybe someone out there in the community can help figure these pieces out.

Thanks everyone for your help.

Started this thread Reply With Quote
  #26 (permalink)
mcfalwell
dallas, tx
 
Posts: 6 since Mar 2014
Thanks Given: 0
Thanks Received: 0

So here is what I'm trying to get at - using an old indicator I had in Tradestation - I a having trouble with the IF statement to calculate my own IV based on the conditions below... Thoughts?

Inputs: DA1(21);

if Next3rdFriday( 0 ) = 0 then begin

ImplVolty = IVolatility of data2;

SD = Squareroot(DA1/365);
CalRange = CloseD(1) * ImplVolty * SD;
UpBand = CloseD(1) + CalRange;
LoBand = CloseD(1) - CalRange;

end;

Reply With Quote
  #27 (permalink)
 
AlexanderKors's Avatar
 AlexanderKors 
San Diego, CA
 
Experience: Beginner
Platform: TWS, ThinkOrSwim
Trading: AAPL
Posts: 10 since Sep 2013
Thanks Given: 3
Thanks Received: 0


rmejia View Post
This could be it:


It seems to me that you are charting historical standard deviation as opposed to implied standard deviation.

or am I getting something wrong?

Reply With Quote
  #28 (permalink)
mcfalwell
dallas, tx
 
Posts: 6 since Mar 2014
Thanks Given: 0
Thanks Received: 0

AlexanderKors - it might be showing historical IV but that's not what I'm going for. After talking with TOS, they say their calculation of IV is proprietary and they don't release the code - so my question is how can i get that number as close to an actual as I can? Looking for the projected stock move (stock price + (price * IV * std Dev)) and the same for the lower level based on a set time period. Man, what seems to be an easy formula sure is tough to get coded :-)

Reply With Quote
  #29 (permalink)
zubbs1
Kansas City, MO United States
 
Posts: 1 since Apr 2014
Thanks Given: 0
Thanks Received: 0


mcfalwell View Post
AlexanderKors - it might be showing historical IV but that's not what I'm going for. After talking with TOS, they say their calculation of IV is proprietary and they don't release the code - so my question is how can i get that number as close to an actual as I can? Looking for the projected stock move (stock price + (price * IV * std Dev)) and the same for the lower level based on a set time period. Man, what seems to be an easy formula sure is tough to get coded :-)

This is exactly what I'm looking for too. Essentially on the second Thursday of the month, after the close, I grab the current expected move, and closing price to calculate the 1, 1.5, and 2 std deviation moves for the upcoming monthly. I then manually draw those lines on the chart. I do this for approximately 25 stocks I'm tracking. Doing it manually is accurate, but takes time and is tedious work. I end up with six lines, giving three sets of unique colors. I want to make sure that the study only looks at the price and std dev at that specific moment, not dynamically as the month progresses.

Unfortunately, I hve zero programming experience, and don't even know if this is possible.

I assume its not possible to grab the expected move from the options chain where it shows imp vol (std dev) (to the upper right of the cal/put box that appears when you expand that month?

If so, is it possible to make these two values user define, and then it draws the lines for you?

Reply With Quote
  #30 (permalink)
CafeGrande
St Paul, MN, USA
 
Posts: 200 since Jan 2014
Thanks Given: 131
Thanks Received: 207



mcfalwell View Post
AlexanderKors - it might be showing historical IV but that's not what I'm going for. After talking with TOS, they say their calculation of IV is proprietary and they don't release the code - so my question is how can i get that number as close to an actual as I can? Looking for the projected stock move (stock price + (price * IV * std Dev)) and the same for the lower level based on a set time period. Man, what seems to be an easy formula sure is tough to get coded :-)


(Don't bite my head off, I just want to raise a point). I think I understand what you're aiming for, but I'm not sure the calculations you're using are the correct ones for a time series of prices. As a general rule, prices follow a lognormal distribution and their returns (daily price changes) follow a normal distribution. It gets more complicated than that when you try to incorporate skew and kurtosis into the returns distribution, but the generally accepted method is to use the natural log (LN in Excel) of daily returns before calculating a standard deviation and then a monthly or annual volatility.

Note also that with a lognormal distribution, you can't just add and subtract a 'fixed' standard deviation owing to the fact that a lognormal price series cannot go below zero, so I think you're mixing apples and oranges by calculating 1 SD at roughly 30 S&P points and adding that number to, and subtracting from, the most recent close to get a price range for the next 30 days (or about 21 trading days).

I'm not a TOS customer so I don't know how to get what you're looking for in their program. It can be done in Excel and certainly in a dedicated stats package, but if you're not already familiar with the concepts or it's been a long time since you sat through a stats class (both true in my case), it can be a challenge.

TOS may have a ready made tool similar to some of the online ones that help an option trader with probability of expiring worthless and probability of touch (touching the strike at any time during the otpion's life). Ivolatility licenses their calculator to TradeKing, OptionsHouse and probably others and the nice thing about it is that you can plug in a custom date and volatility and it will calculate plus and minus one, two and three SDs using the lognormal math. If you can get your hands on a calculator like this, all you need is the range derived from the SDs and you can simply slap a couple of horizontal lines on your price chart and update it as often as you wish. No coding required.

The probability cones, which I'm almost certain TOS has, perform a similar function. The key variable is volatility - you can use 21 trading day HV if you believe the coming month will be about the same as the month just passed. Or you can use the market's implied volatility for a 30 day (21 trading day) option, or some blend of the two.

Reply With Quote




Last Updated on February 29, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts