spx 34 ema and uvxy 34 ema cross

sonnytrader

Member
VIP
Is there anyway to create an alert when both spx 34 ema and uvxy 34 ema cross with volume on one minute chart with volume and if not simultaneously within one bar on opening of candle

i want an alert for any cross with volume over 25% average using a 1 minute chart
 
Solution
@sonnytrader The following code should meet your criteria...

The Volume average is a simple average... If you want Exponential just prepend Average with Exp...

Please note that this code, in its current form, does not plot the averages, it only provides an Alert...

In its current form Alerts will fire in both directions, above and below...

With the markets closed it isn't possible to test so let us know if it works next week...

Ruby:
# SPX_and_UVXY_Cross_EMA34_with_Volume
# Created by rad14733 per request of sonnytrader
# v1.0 : 2025-05-10 : Initial release

input avgLen = 34;
input avgVolLen = 34;
input percent = .25;
input lookBack = 1;

def spxEma = ExpAverage(close(symbol="SPX"), avgLen);
def spxVol = Volume(symbol="SPX")...
@sonnytrader The following code should meet your criteria...

The Volume average is a simple average... If you want Exponential just prepend Average with Exp...

Please note that this code, in its current form, does not plot the averages, it only provides an Alert...

In its current form Alerts will fire in both directions, above and below...

With the markets closed it isn't possible to test so let us know if it works next week...

Ruby:
# SPX_and_UVXY_Cross_EMA34_with_Volume
# Created by rad14733 per request of sonnytrader
# v1.0 : 2025-05-10 : Initial release

input avgLen = 34;
input avgVolLen = 34;
input percent = .25;
input lookBack = 1;

def spxEma = ExpAverage(close(symbol="SPX"), avgLen);
def spxVol = Volume(symbol="SPX");
def spxAvgVol = Average(spxVol, avgVolLen);
def spxTrue = close(symbol="SPX") crosses spxEMA and spxVol > spxAvgVol * (1 + percent);

def uvxyEma = ExpAverage(close(symbol="UVXY"), avgLen);
def uvxyVol = Volume(symbol="UVXY");
def uvxyAvgVol = Average(uvxyVol, avgVolLen);
def uvxyTrue = close(symbol="UVXY") crosses uvxyEMA and uvxyVol > uvxyAvgVol * (1 + percent);

def trigger = spxTrue within lookBack bars and uvxyTrue within lookBack bars;

Alert(trigger, "SPX and UVXY Cross EMA" + avgLen + " with Volume", Alert.BAR, Sound.DING);

# END - SPX_and_UVXY_Cross_EMA34_with_Volume
 
Solution
@sonnytrader The code I posted had no errors as it was coded within TOS... As you can see below, there are no errors...

Good catch on SPX having no Volume so switching to SPY will resolve that issue...

Also, you stated a 1m Chart and made no mention of Daily, which is why I harped so much about details... You have your staring point so modify as needed...

1746923916565.png
 
def spyTrue = close(symbol = "SPY") crosses spyEma and spyVol > spyAvgVol * (1 + percent);

def uvxyEma = ExpAverage(close(symbol = "UVXY"), avgLen);
def uvxyVol = volume(symbol = "UVXY");
def uvxyAvgVol = Average(uvxyVol, avgVolLen);
def uvxyTrue = close(symbol = "UVXY") crosses uvxyEma and uvxyVol > uvxyAvgVol * (1 + percent);

def trigger = spyTrue within lookBack bars and uvxyTrue within lookBack bars;

Alert(trigger, "SPY
and UVXY Cross EMA" + avgLen + " with Volume", Alert.BAR, Sound.DING);

# END - SPYAvgVol_and_UVXY_Cross_EMA34_with_Volume ****** I am getting error on the last 2 lines of thinkscript from Alert(trigger til the end?
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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