How to find the difference today's SlowVSI and yesterday's SlowVSI?

chaser2009

New member
Hello,

I am new to thinkorswim and I want to make a custom code for my charts. I am trying to find a way to find the difference between today's SlowVSI and yesterday's SlowVSI (today - yesterday).

Also, I want to try and find a way to know when the SlowVSI crosses 50. Is there a way to write a script for it to send an alert when a chart crosses 50 on the SlowVSI? (preferably a SMS alert)

Thank you.
 

tomsk

Well-known member
VIP
I don't know what a SlowVSI is, but typically the day you get the difference between the values of say today's close and yesterday's close would be close - close[1]. You can apply the same logic to your SlowVSI indicator
 

chaser2009

New member
Hi,

I want to plot LRR if Up is 1 and Dn is -1, others is 0. I am new, I can't figure out how to code it. help please!

Thanks.

Code:
input emaLength = 6;
input vsiLength = 14;

def ema = ExpAverage(close, emaLength);
def avgVolUp = WildersAverage(if close > ema then volume else 0, vsiLength);
def avgVolDown = WildersAverage(if close < ema then volume else 0, vsiLength);

def SlowVSI = if avgVolUp + avgVolDown == 0 then 50 else 100 * avgVolUp / (avgVolUp + avgVolDown);

def up=slowvsi crosses above slowvsi[1];
def dn=slowvsi crosses below slowvsi[1];

plot LRR = if up then 1 else 0;
LRR.SetDefaultColor(GetColor(1));
 
Last edited by a moderator:

tomsk

Well-known member
VIP
@chaser2009 - I have modified your code so that it plots LRR with 1 if the variable "up" evaluates to a boolean true, and plots -1 if the variable "dn" evaluates to a boolean true. Otherwise it just plots 0. Also, you'd want this to be in a lower study. Here's your modified study


declare lower;

input emaLength = 6;
input vsiLength = 14;

def ema = ExpAverage(close, emaLength);
def avgVolUp = WildersAverage(if close > ema then volume else 0, vsiLength);
def avgVolDown = WildersAverage(if close < ema then volume else 0, vsiLength);

def SlowVSI = if avgVolUp + avgVolDown == 0 then 50 else 100 * avgVolUp / (avgVolUp + avgVolDown);

def up=slowvsi crosses above slowvsi[1];
def dn=slowvsi crosses below slowvsi[1];

plot LRR = if up then 1 else if dn then -1 else 0;
LRR.SetDefaultColor(GetColor(1));
 

chaser2009

New member
Hi,

I want to plot LRR if Up is 1 and Dn is -1, others is 0. I am new, I can't figure out how to code it. help please!

Thanks.

Code:
input emaLength = 6;
input vsiLength = 14;

def ema = ExpAverage(close, emaLength);
def avgVolUp = WildersAverage(if close > ema then volume else 0, vsiLength);
def avgVolDown = WildersAverage(if close < ema then volume else 0, vsiLength);

def SlowVSI = if avgVolUp + avgVolDown == 0 then 50 else 100 * avgVolUp / (avgVolUp + avgVolDown);

def up=slowvsi crosses above slowvsi[1];
def dn=slowvsi crosses below slowvsi[1];

plot LRR = if up then 1 else 0;
LRR.SetDefaultColor(GetColor(1));

Thank you very much!

could you help to write if Up, alert sent SMS to the mobile?
 

tomsk

Well-known member
VIP
For SMS to be sent to your mobile, you would have to use MarketWatch Alerts. MarketWatch Alerts have to be individually set or set as part of a Dynamic WatchList. Probably best to contact the trade desk for assistance on platform related queries so they can walk you through the specifics step by step
 

chaser2009

New member
For SMS to be sent to your mobile, you would have to use MarketWatch Alerts. MarketWatch Alerts have to be individually set or set as part of a Dynamic WatchList. Probably best to contact the trade desk for assistance on platform related queries so they can walk you through the specifics step by step
Thank you very much!
 

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.
Top