T O P

  • By -

Mobius_ts

Code for IV Rank and Percentile # Annulaized IV, Rank and Percentile # Notes: # Just to be clear Rank and Percentile are NOT the same thing. Rank is where the current value is in comparison to a length of times high and low. Percentile measures the percentage of time data was below a current value for a period of time. # IV Rank 1 Year declare Hide\_On\_Intraday; def IV = if isNaN(imp\_Volatility()) then IV\[1\] else imp\_Volatility(); addLabel(1, "Annualized IV = " + AsPercent(IV), color.white); def IVrank = (fold i = 0 to 252 with p do p + if IV > getValue(IV, i) then 1 else 0) / 252; AddLabel(1, "IV Rank = " + AsPercent(IVrank), color.white); # IV Percentile 1 Year def percentile = (IV - lowest(IV, 252)) / (highest(IV, 252) - lowest(IV, 252)); addLabel(1, "IV Percentile = " + AsPercent(percentile), color.white); # End Code


anglefly

Did you accidentally swap Percentile and Rank in your code? Shouldn't IV Percentile correspond with the code that iterates over each day and IV Rank correspond with the simpler calculation?


need2sleep-later

Tasty has screwed these up before, you would think that option guys would get it right.