NexusFi: Find Your Edge


Home Menu

 





Calculate IV Level where most days are less


Discussion in ThinkOrSwim

Updated
    1. trending_up 1,708 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

Calculate IV Level where most days are less

  #1 (permalink)
HumbleViking
Cincinnati, OH
 
Posts: 2 since Mar 2014
Thanks Given: 0
Thanks Received: 0

I want to find the lowest implied volatility level where some large percentage of days is less than. In other words, given a percentage P% for a given underlying, fill in the blank in the following statement: "P% of the time, implied volatility is less than BLANK." My difficulty is writing this functionality in thinkScript, which is why I am posting it here. I have written the logic two different ways in C programs and also written a stub "study" in thinkScript. futures.io (formerly BMT) won't let me post a link to my tarball here, so if interested look me up @tomstevelt and get it from my recent tweet. Or send me a message here.

Based on my observations, the IV level I am looking for is much lower than the percentage of high minus low. It looks to me that IV cruises along at a low to medium low level, with occasional spikes up and back down.


#
# Script: IV_Level ( Percent );
# Author: Tom Stevelt
# Date : March 9, 2014
# Result: Plot implied volatility AND
# answer the question:
# P% of the time, IV is below X.
# Twittr: @tomstevelt

declare lower;
input Percent = 90.0;
plot Data = imp_volatility();

# Need code here! Stub value reasonable for SPX
def Answer = 17.12;

plot Level = Answer / 100.0;
AddLabel ( yes, Concat(Concat ( Percent, "% of the time, IV is below " ), Concat ( Answer, "." )) );


Thanks for looking, please share success!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
Exit Strategy
NinjaTrader
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #2 (permalink)
 growex 
Trubchevsk
 
Experience: Beginner
Platform: tos
Trading: stocks
Posts: 61 since May 2011
Thanks Given: 40
Thanks Received: 79

Here it is

 
Code
                            
def iv impVolatility()*100;

input window 200;
input IVCut 12;
def count fold i 0 to window with n do if getvalue(iv,i,window) < IVCut then n+else n;
def percentage = (count window)*100;
Addlabel(yesconcat("p= ",percentage),color.violet); 
Settings :
window - full number of bars you want to calculate percentage of.
IVCut - lower implied volatility level...
for example by default this study will look how many times in last 200 bars the implied volatility was lower than 12%
Then it takes the calculated number and show it as a percent of 200.

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
HumbleViking
Cincinnati, OH
 
Posts: 2 since Mar 2014
Thanks Given: 0
Thanks Received: 0


Thanks for your code, very nice example of the fold statement. Unfortunately, you calculated the percentage, with IV Level as an input. I am looking for the opposite: given a percentage, find the IV level that would "cut" the data set. If you look at my sample again, you'll see one input for Percentage. And then a stub to find and display the Answer.

I am starting to believe this can not be accomplished in thinkScript.

Reply With Quote
  #4 (permalink)
 growex 
Trubchevsk
 
Experience: Beginner
Platform: tos
Trading: stocks
Posts: 61 since May 2011
Thanks Given: 40
Thanks Received: 79

I've seen your percentage input...and was thinking about realisation of this....but this task require to create the new, user defined array of IV data to search from. Thinkscript doent have such functionality yet
This piece of code at least helps a little..it may looks like ancient age style but IV is not that big number so you can find it manually by adjusting the IV setting and to look at percentage level until it reach the value you want.
To finetune it a little more we can change IV variable type to float... it will be

 
Code
                            
input IVCut 12.00
Hope it helps

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on March 15, 2014


© 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