Standard Deviation Lines based on options expiration

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:

We work extremely hard to keep things positive on our forums.

We do not tolerate rude behavior, trolling, or vendor advertising in posts.

We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.

We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

Standard Deviation Lines based on options expiration

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?

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

The following user says Thank You to greg9 for this post:

@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!

@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!

The following user says Thank You to greg9 for this 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

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

The following 3 users say Thank You to rmejia for this post:

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