I have imported this IV Percentile (current IV vs. "normal" IV) watchlist column study : http://tos.mx/6IlMBw. But it shows either NaN or Error value in column. Can you please check if something is wrong with the script?
I have imported this IV Percentile (current IV vs. "normal" IV) watchlist column study : http://tos.mx/6IlMBw. But it shows either NaN or Error value in column. Can you please check if something is wrong with the script?
next time, post the code and a link where it came from
its near impossible to debug a bad column study.
copy the code and make a lower chart study.
then add a line and a bubble to display some variables.
lower chart study for debugging
Code:
#iv_per_col02_lower
# col
#iv_per_col02
#https://usethinkscript.com/threads/iv-percentile-watchlist-column.21441/
#IV Percentile watchlist column
#AlwaysLearning 8/20
#I have imported this IV Percentile (current IV vs. "normal" IV) watchlist column study...
I have imported this IV Percentile (current IV vs. "normal" IV) watchlist column study : http://tos.mx/6IlMBw. But it shows either NaN or Error value in column. Can you please check if something is wrong with the script?
next time, post the code and a link where it came from
its near impossible to debug a bad column study.
copy the code and make a lower chart study.
then add a line and a bubble to display some variables.
lower chart study for debugging
Code:
#iv_per_col02_lower
# col
#iv_per_col02
#https://usethinkscript.com/threads/iv-percentile-watchlist-column.21441/
#IV Percentile watchlist column
#AlwaysLearning 8/20
#I have imported this IV Percentile (current IV vs. "normal" IV) watchlist column study
#http://tos.mx/6IlMBw
#But it shows either NaN or Error value in column. Can you please check if something is wrong with the script?
declare lower;
input tradingDays = 252;
#input period = AggregationPeriod.DAY;
#def IV = if !IsNaN(imp_volatility(period = period))
# then imp_volatility(period = period)
def IV = if !IsNaN(imp_volatility())
then imp_volatility()
else IV[1];
def IVperc = fold i = 0 to tradingDays
with p = 0
# do if IV < GetValue(IV , -i, tradingDays)
do if IV < GetValue(IV , -i)
then IVperc[1] + 1
else IVperc[1];
def normal_IV = fold j = 0 to tradingDays
with q = 0
do if 1 == 1
then normal_IV[1] + 1
else normal_IV[1];
plot IVpercentile = IVperc / (tradingDays + 1);
plot z = 0;
addchartbubble(1, 0,
iv + "\n" +
IVperc + "\n" +
normal_IV + "\n" +
IVpercentile + "\n"
, color.yellow, no);
#AssignBackgroundColor (if IVpercentile < 0.35 then color.GREEN else if IVpercentile > 0.70 then color.RED else color.LIGHT_GRAY);
#
when i loaded this as a lower study, the white circle with the ! appeared in the top left of chart.
(252) getvalue: dynamic offset cannot exceed max offset
Code:
def IVperc = fold i = 0 to tradingDays
with p = 0
do if IV < GetValue(IV , -i, tradingDays)
then IVperc[1] + 1
else IVperc[1];
i never use the 3rd parameter on getvalue.
i removed it, from this
. do if IV < GetValue(IV , -i, tradingDays)
to this
. do if IV < GetValue(IV , -i)
and my lower plotted data
i removed the 3rd parameter ( and the 2nd agg DAY stuff) in the column code and it worked.
ps
1. you dont need 2nd aggregation . just specify DAY time in the column config window
2. you didn't specify a color for the plot. in a column, this will be the font color. my numbers were white, hard to read. i added a black color
column code
Code:
# HINT: This IV percentile is NOT a 0 - 100 rank of where current IV is located within the 52-week high/low range for ImpVolatility. Instead this IV percentile compares 52-weeks of ImpVolatility data to determine where current IV is located relative to "normal" ImpVolatility.
# Many times IV percentile rank will be same or similar to IV percentile, however, if there has been a spike high or spike low in the ImpVolatility high/low range that spike(s) can skew IV percentile rank causing current IV to appear lower or higher than actual realtive to "normal" IV
input tradingDays = 252;
#input period = AggregationPeriod.DAY;
def IV = if !IsNaN(imp_volatility())
then imp_volatility()
else IV[1];
def IVperc = fold i = 0 to tradingDays
with p = 0
# do if IV < GetValue(IV , -i, tradingDays)
do if IV < GetValue(IV , -i)
then IVperc[1] + 1
else IVperc[1];
def normal_IV = fold j = 0 to tradingDays
with q = 0
do if 1 == 1
then normal_IV[1] + 1
else normal_IV[1];
plot IVpercentile = IVperc / (tradingDays + 1);
IVpercentile.setdefaultcolor(color.black);
AssignBackgroundColor (if IVpercentile < 0.35 then color.GREEN else if IVpercentile > 0.70 then color.RED else color.LIGHT_GRAY);
#
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
How do I get started?
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.