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 leestockz with 2 posts (0 thanks)
    1. trending_up 21,792 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

  #1 (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

I have this idea that I'm trying to code but i'm getting mixed results. The indicator will take the previous period based on options expiration and find out 1 standard deviation and plot lines above and below the close of the period.

What i'm finding is that i'm almost there but can't figure out why the value grows each period.... Its like they are being summed up. When it is finished it will plot over price similar to a pivot but putting it below the price you can see what i'm talking about. Screenshot below.

Anyone know how to fix this?


 
Code
input timeFrame = aggregationPeriod.OPT_EXP;
input length = 20;

def StdDev = StDev(close(period = timeFrame)[1], length);

plot St =  (StdDev);

st.SetDefaultColor(color.DARK_green);
st.SetStyle(Curve.POINTS);

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Are there any eval firms that allow you to sink to your …
Traders Hideout
Better Renko Gaps
The Elite Circle
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
44 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #2 (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

Does the ProbablityofExpiringCone indicator work even though it only shows the SD based on the current price?


Reply With Quote
Thanked by:
  #3 (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
Does the ProbablityofExpiringCone indicator work even though it only shows the SD based on the current price?


@rmejia Thanks, that is an interesting indicator and I haven't seen it before..... But its not quite getting at what i'm hoping to find.

I'm realizing that aggregationPeriod.OPT_EXP is giving me the close of every option ex period which is not what I want. I wish I was a little better at understand tos coding. I need the aggregation period to be day and I need it to start and end with the Opt exp time frame of 1 month. I really can't figure out how to do that.

Here is what the indicator will look like. SPY's last options exp was from 1/21 to 2/21. Take the stdev of all the closes of that period (using yahoo finance data) you get a standard deviation of 3.18. Now take the close of the last options ex period of 183.91 and add 3.18 to that and subtract 3.18 to that and you end up with a chart that looks like this below.

I'm proposing that those levels are going to be super important. Big funds are going to sell premium above / below 1 and 2 standard deviations and are going to protect those levels.

Anyone that can help code this it would be much appreciated!

Thanks

Attached Thumbnails
Click image for larger version

Name:	spy.jpg
Views:	373
Size:	234.1 KB
ID:	138913  
Started this thread Reply With Quote
  #4 (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

This could be it:


Attached Files
Elite Membership required to download: X_gsl8rSTUDY.ts
Reply With Quote
  #5 (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
This could be it:


@rmejia Thank you so much for your work on this! Awesome it does what I need it to. One small tweak on it would be to define the number of days during the previous month and then have that be the length. I noticed if I make the length 19 days it comes out with the right values for the last period. Each month has a slightly different number of trading days and that would be the only thing that would make this a done deal. Thanks for your work already and getting it to this point!

Started this thread Reply With Quote
Thanked by:
  #6 (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

The length parameter defines the aggregation period lookback. The aggregation period being Opt Exp, a length of 1 is the previous Option Expiration, a length of 19 is the 19 previous Opt Exp's of which it finds the high and low of that period and calculates the standard deviation of that. Selecting the aggregation period Opt Exp it automatically calculates the days in the opt exp of that month.

Length = 1 on the left, Length = 19 on the right

Reply With Quote
Thanked by:
  #7 (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
The length parameter defines the aggregation period lookback. The aggregation period being Opt Exp, a length of 1 is the previous Option Expiration, a length of 19 is the 19 previous Opt Exp's of which it finds the high and low of that period and calculates the standard deviation of that. Selecting the aggregation period Opt Exp it automatically calculates the days in the opt exp of that month.

Length = 1 on the left, Length = 19 on the right

@rmejia Awesome I guess I was just misinterpreting it and what it meant. Looking at it now its complete! And I can easily get 2 standard deviations up and down as well. Thank you so much for your work on this. I'm sure others may find this useful as well.

Started this thread Reply With Quote
  #8 (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

I took off the midline for simplicity and just show 1 up and 1 down.

This is fantastic! Look at those reaction areas!


Started this thread Reply With Quote
Thanked by:
  #9 (permalink)
 Cloudy 
desert CA
 
Experience: Intermediate
Platform: NT7, various
Broker: various, TDA
Trading: NQ,ES
Posts: 2,124 since Jul 2011
Thanks Given: 2,396
Thanks Received: 1,748

Nice idea, thanks.

Visit my NexusFi Trade Journal Reply With Quote
  #10 (permalink)
leestockz
Norman, OK
 
Posts: 3 since Sep 2013
Thanks Given: 0
Thanks Received: 1


The levels don't look the same on my screen...
Any idea how to disconnect the levels/lines before and after options expiry?

Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2014-03-02 at 8.33.14 PM.png
Views:	329
Size:	20.1 KB
ID:	138987  
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