NexusFi: Find Your Edge


Home Menu

 





Implied volatility oscillator with candles?


Discussion in ThinkOrSwim

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




 
Search this Thread

Implied volatility oscillator with candles?

  #1 (permalink)
Mibobwa
Israel
 
Posts: 8 since Mar 2015
Thanks Given: 3
Thanks Received: 2

Hello
I’m trying to do this for some time without success.
I need to display the implied volatility oscillator with candles instead of line, is it possible to do such thing?
Thanks

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
Better Renko Gaps
The Elite Circle
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Build trailing stop for micro index(s)
Psychology and Money Management
Deepmoney LLM
Elite Quantitative GenAI/LLM
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
36 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 thanks
GFIs1 1 DAX trade per day journal
19 thanks
  #2 (permalink)
tangerine
albuquerque nm/usa
 
Posts: 29 since Aug 2015
Thanks Given: 3
Thanks Received: 9


Mibobwa View Post
Hello
I’m trying to do this for some time without success.
I need to display the implied volatility oscillator with candles instead of line, is it possible to do such thing?
Thanks

Mibobwa, not sure how that would be possible, since OHLC values (on a Daily chart) are by definition "intraday" values and since ImpVol by definition excludes intraday values and timeframes shorter than 1 day. Well, maybe somebody else knows how. But would you be satisfied with a histogram? And you could also load this with the canned ImpVol study into one panel and see both. (to merge, click the little up/down triangle that appears when you hover over a loaded study on your Edit Studies panel)
 
Code
declare lower;
plot myimpvol = impvolatility();
myimpvol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
EDIT: There's more insight to the problem here . So you "might" get away with the Add Chart function if it still works. Alternatively, code might be written for WEEKLY "sort of" candles, where you could REFERENCE impvolatility() as Highest(high,5), Lowest(low,5), Open[5], and Close. Then plot it, and assign specific colors and/or shapes (dots, triangles etc) to each datapoint.

Reply With Quote
Thanked by:
  #3 (permalink)
Mibobwa
Israel
 
Posts: 8 since Mar 2015
Thanks Given: 3
Thanks Received: 2


Thanks tangerine for your suggestions, I think it's difficult to build daily implied volatility candles oscillator as there are no intraday data, but it is possible to build weekly one with the daily data as you suggested, I will try this.

Reply With Quote
  #4 (permalink)
Mibobwa
Israel
 
Posts: 8 since Mar 2015
Thanks Given: 3
Thanks Received: 2

though I program in other languages, this is the first time with thinkscript, I did write the code below but I think there is something missing, help appreciated.
 
Code
#
# TD Ameritrade IP Company, Inc. (c) 2007-2015
#

declare lower;

def openVL;
def closeVL;
def highVL;
def lowVL;

highVL = IMP_VOLATILITY(getSymbol(),Highest(high,5),priceType = "LAST");
lowVL = IMP_VOLATILITY(getSymbol(),Lowest(low,5),priceType = "LAST");
openVL = IMP_VOLATILITY(getSymbol(),Open[5],priceType = "LAST");
closeVL = IMP_VOLATILITY(getSymbol(),Close[5],priceType = "LAST");

AddChart(high = highVL, low = lowVL, open = openVL, close = closeVL, type = ChartType.CANDLE, growColor = color.green, fallColor = color.red, neutralColor = color.gray);

Reply With Quote
  #5 (permalink)
tangerine
albuquerque nm/usa
 
Posts: 29 since Aug 2015
Thanks Given: 3
Thanks Received: 9


Mibobwa View Post
though I program in other languages, this is the first time with thinkscript, I did write the code below but I think there is something missing, help appreciated.
 
Code
#
# TD Ameritrade IP Company, Inc. (c) 2007-2015
declare lower;
def openVL;
def closeVL;
def highVL;
def lowVL;
highVL = IMP_VOLATILITY(getSymbol(),Highest(high,5),priceType = "LAST");
lowVL = IMP_VOLATILITY(getSymbol(),Lowest(low,5),priceType = "LAST");
openVL = IMP_VOLATILITY(getSymbol(),Open[5],priceType = "LAST");
closeVL = IMP_VOLATILITY(getSymbol(),Close[5],priceType = "LAST");
AddChart(high = highVL, low = lowVL, open = openVL, close = closeVL, type = ChartType.CANDLE, growColor = color.green, fallColor = color.red, neutralColor = color.gray);

Mibobwa, the first "error" I see is you didn't code Close as I suggested. Instead, you called for Close[5] (let's call that Monday Close, for example), but what you want is Friday Close, i.e., the Close for the week. Of course, this is a moving calculation so the days are just examples. Other than that, you're calling for what may be an extinct piece of TS code, i.e., "growColor", which I believe is what they were saying at that link- that it doesn't work anymore.
One other thing... I am shocked at how you got away with writing that code that way. I never knew a standalone def could be written without popping up code red (and I write tutorials on TS basics ) . Anyway, I think you're working too hard- the simpler version of your code is this, but it still does not display anything:
 
Code
declare lower;

def openVL = IMP_VOLATILITY(getSymbol(),Open[5],priceType = "LAST");
def closeVL = IMP_VOLATILITY(getSymbol(),Close,priceType = "LAST");
def highVL = IMP_VOLATILITY(getSymbol(),Highest(high,5),priceType = "LAST");
def lowVL = IMP_VOLATILITY(getSymbol(),Lowest(low,5),priceType = "LAST");

AddChart(high = highVL, low = lowVL, open = openVL, close = closeVL, type = ChartType.CANDLE, growColor = color.green, fallColor = color.red, neutralColor = color.gray);
Alright, I'm gonna try and build what I mentioned earlier with dots and triangles, etc. Be back later.

Reply With Quote
  #6 (permalink)
tangerine
albuquerque nm/usa
 
Posts: 29 since Aug 2015
Thanks Given: 3
Thanks Received: 9

Okay, Mibobwa, here's the best I can come up with. I also added a Cloud line which you can delete. You can change dots to triangles or whatever with right-click on the study, then Edit Study. Also, I found that it makes viewing easier if on the Edit Study panel I clcik Draw As and choose the third one in the dropdown (looks like a battleship to me). If you do that you get this nice overlap of color that seems to signal start or end of a trend. As we discussed, this code works for Daily or higher. If you run for Daily, it's showing ImpVol for the past week; if you run on a Weekly chart, it's showing you ImpVol for the past 5 weeks (so we could code an Input to change the period from the charting screen if you want).
Dot colors: Blue is Open, Dark_Green is High, Red is Low, Black is close.
 
Code
declare lower;

def myimpVol = reference impvolatility();
plot myopenVL = myimpVol[5];
plot mycloseVL = myimpVol;
plot myhighVL = Highest(myimpVol, 5);
plot mylowVL = Lowest(myimpVol, 5);
myopenVL.SetDefaultColor(Color.BLUE);
myopenVL.SetStyle(Curve.POINTS);
myopenVL.SetLineWeight(5);
mycloseVL.SetDefaultColor(Color.BLACK);
mycloseVL.SetStyle(Curve.POINTS);
mycloseVL.SetLineWeight(5);
myhighVL.SetDefaultColor(Color.DARK_GREEN);
myhighVL.SetStyle(Curve.POINTS);
myhighVL.SetLineWeight(5);
mylowVL.SetDefaultColor(Color.RED);
mylowVL.SetStyle(Curve.POINTS);
mylowVL.SetLineWeight(5);
AddCloud(myhighVL,mylowVL, Color.dark_red, Color.blue);
EDIT~~ Hm, I don't understand this but once in awhile the Open plots lower than the Low. No biggie, it's usually correct.

Reply With Quote
  #7 (permalink)
tangerine
albuquerque nm/usa
 
Posts: 29 since Aug 2015
Thanks Given: 3
Thanks Received: 9

Here's a screenshot
Edit~~ This image crams the points together but they're clearly visible if you zoom in a little.

Reply With Quote
  #8 (permalink)
tangerine
albuquerque nm/usa
 
Posts: 29 since Aug 2015
Thanks Given: 3
Thanks Received: 9

Mibobwa, instead of adding the battleship thing, just add an extra line of cloud code:
AddCloud(myopenVL,mycloseVL, Color.lime, Color.yellow);
The effect is stunning and informative- thanks for the idea of this code!

Reply With Quote
Thanked by:
  #9 (permalink)
Mibobwa
Israel
 
Posts: 8 since Mar 2015
Thanks Given: 3
Thanks Received: 2

Thanks tangerine, you did a great work
and my last question, is it possible to display the same info in this oscillator as Japanese candles?

Reply With Quote
  #10 (permalink)
tangerine
albuquerque nm/usa
 
Posts: 29 since Aug 2015
Thanks Given: 3
Thanks Received: 9



Mibobwa View Post
Thanks tangerine, you did a great work
and my last question, is it possible to display the same info in this oscillator as Japanese candles?

As far as I know, Mibobwa, at present there's no way to plot candles on a lower study. But I did just try something interesting- I removed "declare lower;" to make this into an overlay on price (then right-click on the study and Use Left Axis, and then from the chart screen I went in and unchecked all 4 plots to get rid of the confusing dots. Makes it easier to compare the clouds to price.

Reply With Quote
Thanked by:




Last Updated on January 12, 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