VIX MTF Label

QED

New member
VIP
Need help with label code:

My goal is to put a VIX moving average label on a 2 minute SPY chart.

I use a 20 minute EMA on a 2 minute VIX chart that changes to green when AvgExp > AvgExp[1] and red when it’s not.

To save space on my travel computer, I want to convert the EMA color change info on the VIX chart into a label that I can put on my 2 minute SPY chart. Theoretically, this way I can see if the VIX is rising or falling without looking at an actual VIX chart.

However, I have not been able to get the code to work properly.

Any assistance would be greatly appreciated.

——————

# VIX_Label

declare upper;

def aggregationPeriod = AggregationPeriod.TWO_Min;
input VIX = “VIX”;
input price = close;
input length = 20;
input displace = 0;
input showLabel = yes;

plot AvgExp = ExpAverage(price[-displace], length);
AvgExp.AssignValueColor(if AvgExp > AvgExp[1] then Color.GREEN else Color.RED);
AvgExp.SetHiding(1);

AddLabel(showLabel, “VIX 20ema", if AvgExp > AvgExp[1] then Color.GREEN else Color.RED);
 
Solution
Need help with label code:

My goal is to put a VIX moving average label on a 2 minute SPY chart.

I use a 20 minute EMA on a 2 minute VIX chart that changes to green when AvgExp > AvgExp[1] and red when it’s not.

To save space on my travel computer, I want to convert the EMA color change info on the VIX chart into a label that I can put on my 2 minute SPY chart. Theoretically, this way I can see if the VIX is rising or falling without looking at an actual VIX chart.

However, I have not been able to get the code to work properly.

Any assistance would be greatly appreciated.

——————

# VIX_Label

declare upper;

def aggregationPeriod = AggregationPeriod.TWO_Min;
input VIX = “VIX”;
input price = close;
input length = 20;
input...
Need help with label code:

My goal is to put a VIX moving average label on a 2 minute SPY chart.

I use a 20 minute EMA on a 2 minute VIX chart that changes to green when AvgExp > AvgExp[1] and red when it’s not.

To save space on my travel computer, I want to convert the EMA color change info on the VIX chart into a label that I can put on my 2 minute SPY chart. Theoretically, this way I can see if the VIX is rising or falling without looking at an actual VIX chart.

However, I have not been able to get the code to work properly.

Any assistance would be greatly appreciated.

——————

# VIX_Label

declare upper;

def aggregationPeriod = AggregationPeriod.TWO_Min;
input VIX = “VIX”;
input price = close;
input length = 20;
input displace = 0;
input showLabel = yes;

plot AvgExp = ExpAverage(price[-displace], length);
AvgExp.AssignValueColor(if AvgExp > AvgExp[1] then Color.GREEN else Color.RED);
AvgExp.SetHiding(1);

AddLabel(showLabel, “VIX 20ema", if AvgExp > AvgExp[1] then Color.GREEN else Color.RED);
declare upper;
input showLabel = yes;
input length = 20;

# Get VIX closing price using secondary aggregation
def vixPrice = close(symbol = "VIX", period = AggregationPeriod.TWO_MIN);

# Calculate the 20-period EMA of VIX
def vixEMA = ExpAverage(vixPrice, length);

# Determine if the EMA is rising or falling
def isRising = vixEMA > vixEMA[1];

# Display label on SPY chart
AddLabel(showLabel, "VIX 20 EMA", if isRising then Color.GREEN else Color.RED);
 
Solution
declare upper;
input showLabel = yes;
input length = 20;

# Get VIX closing price using secondary aggregation
def vixPrice = close(symbol = "VIX", period = AggregationPeriod.TWO_MIN);

# Calculate the 20-period EMA of VIX
def vixEMA = ExpAverage(vixPrice, length);

# Determine if the EMA is rising or falling
def isRising = vixEMA > vixEMA[1];

# Display label on SPY chart
AddLabel(showLabel, "VIX 20 EMA", if isRising then Color.GREEN else Color.RED);
Merci beaucoup 😀
 
Chart Bubble Assistance

@andre.muhammad generously "fixed" my coding errors (https://usethinkscript.com/threads/vix-mtf-label.20616) which I am grateful.

However, when I have attempted to AddChartBubble at the top and bottom of each candle only at crossovers, I either get error codes (invalid statement) or I get a chart bubble on every candle. :mad:

Any assistance of adding a chart bubble at candle high or candle low of each crossover to @andre.muhammad's "VIX MTF Label" code would be greatly appreciated.

These bubbles are to appear on a 2 minute SPY candle chart and show when the VIX crosses over its 20-period EMA on a 2 minute chart.

(andre.muhammad original code):

Code:
declare upper;
input showLabel = yes;
input length = 20;

# Get VIX closing price using secondary aggregation
def vixPrice = close(symbol = "VIX", period = AggregationPeriod.TWO_MIN);

# Calculate the 20-period EMA of VIX
def vixEMA = ExpAverage(vixPrice, length);

# Determine if the EMA is rising or falling
def isRising = vixEMA > vixEMA[1];

# Display label on SPY chart
AddLabel(showLabel, "VIX 20 EMA", if isRising then Color.GREEN else Color.RED);
 
Last edited by a moderator:
Chart Bubble Assistance

@andre.muhammad generously "fixed" my coding errors (https://usethinkscript.com/threads/vix-mtf-label.20616) which I am grateful.

However, when I have attempted to AddChartBubble at the top and bottom of each candle only at crossovers, I either get error codes (invalid statement) or I get a chart bubble on every candle. :mad:

Any assistance of adding a chart bubble at candle high or candle low of each crossover to @andre.muhammad's "VIX MTF Label" code would be greatly appreciated.

These bubbles are to appear on a 2 minute SPY candle chart and show when the VIX crosses over its 20-period EMA on a 2 minute chart.

(andre.muhammad original code):

Code:
declare upper;
input showLabel = yes;
input length = 20;

# Get VIX closing price using secondary aggregation
def vixPrice = close(symbol = "VIX", period = AggregationPeriod.TWO_MIN);

# Calculate the 20-period EMA of VIX
def vixEMA = ExpAverage(vixPrice, length);

# Determine if the EMA is rising or falling
def isRising = vixEMA > vixEMA[1];

# Display label on SPY chart
AddLabel(showLabel, "VIX 20 EMA", if isRising then Color.GREEN else Color.RED);

why is your version is different? there is no plot

you didn't say what crosses what?
next time be specific when stating the rules.
so i guessed, a cross is when the vixema line crosses a candle.

showing vix on a 1 minute chart

Code:
#bubble_help2

#https://usethinkscript.com/threads/chart-bubble-assistance.20648/

declare upper;
input showLabel = yes;
input length = 20;

# Get VIX closing price using secondary aggregation
def vixPrice = close(symbol = "VIX", period = AggregationPeriod.TWO_MIN);

# Calculate the 20-period EMA of VIX
def vixEMA = ExpAverage(vixPrice, length);

# Determine if the EMA is rising or falling
def isRising = vixEMA > vixEMA[1];

plot z = vixema;

# Display label on SPY chart
AddLabel(showLabel, "VIX 20 EMA", if isRising then Color.GREEN else Color.RED);

def cross = (high > vixema and low < vixema);

addchartbubble(cross, high, high, color.green, yes);
addchartbubble(cross, low, low, color.red, no);
#
 

Attachments

  • 00a-1.JPG
    00a-1.JPG
    55.6 KB · Views: 40
why is your version is different? there is no plot

you didn't say what crosses what?
next time be specific when stating the rules.
so i guessed, a cross is when the vixema line crosses a candle.

showing vix on a 1 minute chart

Code:
#bubble_help2

#https://usethinkscript.com/threads/chart-bubble-assistance.20648/

declare upper;
input showLabel = yes;
input length = 20;

# Get VIX closing price using secondary aggregation
def vixPrice = close(symbol = "VIX", period = AggregationPeriod.TWO_MIN);

# Calculate the 20-period EMA of VIX
def vixEMA = ExpAverage(vixPrice, length);

# Determine if the EMA is rising or falling
def isRising = vixEMA > vixEMA[1];

plot z = vixema;

# Display label on SPY chart
AddLabel(showLabel, "VIX 20 EMA", if isRising then Color.GREEN else Color.RED);

def cross = (high > vixema and low < vixema);

addchartbubble(cross, high, high, color.green, yes);
addchartbubble(cross, low, low, color.red, no);
#
@halcyonguy, thanks. Sorry, more details:

I use a 2 minute chart of VIX to foretell or confirm a short trend change for scalping day trades. It's pretty obvious that SPY falls and rises inverse to the VIX.

When I am not traveling I have multiple screens so I am able to watch more charts. However, when I am traveling, I only have my laptop with limited charts so I mainly day trade SPY. Yes, it is easier just to watch an actual VIX chart, but when traveling I do not have that luxury so I am trying to compensate.

@andre.muhammad helped me by providing the code for a VIX label that indicates whether the 20-period EMA of VIX is rising or falling (short term trend), but now I am trying to add chart bubbles to indicate when a 2-minute VIX candle closes above or below its 20-period EMA. Yes, there are whipsaws, but that is where the label comes in handy because it indicates if it is a whipsaw or a short term trend change in the VIX.

I do not trade off of a VIX indicator, I trade the SPY, but I do like to know when I might be wrong so I can close my position before I get smoked.

I am just looking for chart bubbles that say V-L (at the bottom of a VIX candle that crosses and closes above the 20-period EMA of VIX, and chart bubbles that say V-S (at the top of a VIX candle that crosses and closes below the 20-period EMA of VIX. I can then ignore the ones that the aforementioned VIX label does not confirm.
 

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

Thread starter Similar threads Forum Replies Date
G VIX MTF label Questions 6
R VIX put/call volume ratio symbol Questions 2
K SPY candle color based on "reverse VIX" (-VIX) DMI Questions 2
N VIX Signal - need to change it Questions 2
R $VIX Questions 2

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
676 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