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

C

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

tomsk

Active member
VIP
Warehouse
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
 
C

chaser2009

New member
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
Thank you for helping!
 
C

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:
T

tomsk

Active member
VIP
Warehouse
@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));
 
C

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?
 
T

tomsk

Active member
VIP
Warehouse
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
 
C

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!
 

Top