Label for VIX

mikep

New member
Total noob here, can someone help me with code for creating a simple label in upper that shows the current value of the VIX? Thanks, Mike
 
Solution
Changing the text of a label has no effect on the logic.

It is due to handling the 'IsNaN' condition by referring to the previous bar.
Since the market is closed right now, the last real value is being carried over until market open.

VIX.jpg


If you want to, you can change the code to this
Code:
def VIXClose = if IsNaN(close("VIX")) then VIXClose[1] else close("VIX");
AddLabel(yes, "VIX: "+VIXClose, If VIXClose>VIXClose[1] then color.Green
                else If VIXClose<VIXClose[1] then color.RED else color.BLACK);
and the label will blackout between market close and market open.

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Remove the forward slash.
/VX is futures index, for some reason that is what I read when I saw your post.

You want just VIX so:
Code:
def VIXClose = close("VIX");
AddLabel(yes,VIXClose,color.white);
is what you want.
 
This should work.
Code:
def VIXClose = if IsNaN(close("VIX")) then VIXClose[1] else close("VIX");
AddLabel(yes, VIXClose, If VIXClose>=VIXClose[1] then color.Green else color.RED);
 
Remove the forward slash.
/VX is futures index, for some reason that is what I read when I saw your post.

You want just VIX so:
Code:
def VIXClose = close("VIX");
AddLabel(yes,VIXClose,color.white);
is what you want.
Thanks for the response Svanoy, actually you were correct when you mentioned VX, as futures is the one I'm interested in. Sorry for the confusion (on my part). If I were a younger man I'd give this coding a shot. I find it very interesting. Thanks again.
 
Changing the text of a label has no effect on the logic.

It is due to handling the 'IsNaN' condition by referring to the previous bar.
Since the market is closed right now, the last real value is being carried over until market open.

VIX.jpg


If you want to, you can change the code to this
Code:
def VIXClose = if IsNaN(close("VIX")) then VIXClose[1] else close("VIX");
AddLabel(yes, "VIX: "+VIXClose, If VIXClose>VIXClose[1] then color.Green
                else If VIXClose<VIXClose[1] then color.RED else color.BLACK);
and the label will blackout between market close and market open.
 
Last edited:
Solution
@akoplan. The label in the code above will show in the upper left as long as there are not any AddLabel lines above it in the code.
The Chart Bubble in the screenshot was just for illustrative purposes to show the value carrying over during market close.
 
Thread starter Similar threads Forum Replies Date
J Label ( vix price / 15.87) Questions 3
G VIX MTF label Questions 6
H VIX label for Tick chart Questions 2
cando13579 price label Questions 2
D Earning label for pre-market/afterhours/during Questions 1

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
415 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

What are the benefits of VIP Membership?
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.
Back
Top