Need % Percentage Change Label for ThinkorSwim

Branch

Branch

Member
Can someone create a label that will tell me how much the current product (symbol) is up or down? TOS has it in the Symbol Menu but I would like to have it on the chart as a label also.
 
T

tomsk

Well-known member
VIP
@Branch Here is your color coded percent change label, based on the previous day's close

Code:
# Percent Change Label (from Previous Day's Close)
# tomsk
# 1.8.2020

# To be used on daily chart

def DailyClose = close(period = AggregationPeriod.DAY);
def PctChange = (close - DailyClose[1]) / DailyClose[1];
AddLabel(1, "Percent Change = " + AsPercent(PctChange), if PctChange > 0 then Color.Green else if PctChange < 0 then Color.Red else Color.Gray);

# End Percent Change Label (from Previous Day's Close)
 
Last edited:
Branch

Branch

Member
@tomsk Thank you. I am using this on various aggregation periods on various charts. Thanks your help.
 
zeek

zeek

Active member
2019 Donor
Just tried it on a 5min chart but its not working for me, sometimes i see the label blink in either green or red color but only for a second or so. Otherwise the label stays grey and says 0% change.

Anyone else seeing this?
 
zeek

zeek

Active member
2019 Donor
Why only on a daily chart? Wouldn`t this be more useful on a intraday chart?
 
Branch

Branch

Member
@zeek you can change the code to what you like/want. Tomsk provided the code for me on the DAY AggregationPeriod. Just change the period.
 
T

tomsk

Well-known member
VIP
I have updated the Percent Change Label (from Previous Day's Close) that should work both on a daily as well as intraday aggregations. Since the equities market is currently closed I have tested this against /ES. It seems to work fine as far as I can tell.

Code:
# Percent Change Label (from Yesterday's Close)
# tomsk
# 1.9.2020

# V1.0 - 01.08.2020 - tomsk - Initial release of Percent Change Label, to be used for daily aggregation
# V1.1 - 01.09.2020 - tomsk - Updated to work on intraday aggregation as well as daily

def PC = close(period = AggregationPeriod.DAY)[1];
def PctChange = (close - PC) / PC;
AddLabel(1, "Percent Change = " + AsPercent(PctChange), if PctChange > 0 then Color.Green else if PctChange < 0 then Color.Red else Color.Gray);

# End Percent Change Label (from Yesterday's Close)
 
Last edited:
zeek

zeek

Active member
2019 Donor
Thanks @tomsk for the updated version, works great!

I also found this in my collection of studies which displays both % change & net change based on the prior day close.

#HINT: This study plots a chart label for Net Change and Percent Change from prior close (regardless of time period of the chart.

input period_Type = AggregationPeriod.DAY;

def begin = close(period = period_Type)[1];
def end = close(period = period_Type);
def NetChg = end - begin;
def PctChg = (end / begin) - 1;

AddLabel(yes, "Change from Prior close: " + AsDollars(NetChg) + " " + AsPercent(PctChg), if NetChg > 0 then CreateColor(100,200,100) else if NetChg < 0 then Color.Dark_Orange else color.LIGHT_GRAY);
 
T

tomsk

Well-known member
VIP
@zeek Very good feedback, glad it worked fine for you. Yes the study you posted above would provide similar results
 
Last edited:
M

Mike

New member
Hello @tomsk. In addition to the displaying the Percent Change Label for the selected symbol (plotted symbol) , I'd like to display the Percent Change Label for an additional symbol for comparison purposes. Your insight would be appreciated!
 
S

soary

Member
I have updated the Percent Change Label (from Previous Day's Close) that should work both on a daily as well as intraday aggregations. Since the equities market is currently closed I have tested this against /ES. It seems to work fine as far as I can tell.

Code:
# Percent Change Label (from Yesterday's Close)
# tomsk
# 1.9.2020

# V1.0 - 01.08.2020 - tomsk - Initial release of Percent Change Label, to be used for daily aggregation
# V1.1 - 01.09.2020 - tomsk - Updated to work on intraday aggregation as well as daily

def PC = close(period = AggregationPeriod.DAY)[1];
def PctChange = (close - PC) / PC;
AddLabel(1, "Percent Change = " + AsPercent(PctChange), if PctChange > 0 then Color.Green else if PctChange < 0 then Color.Red else Color.Gray);

# End Percent Change Label (from Yesterday's Close)

Could you add the 52 Week high and low stats in a label and percentage that current price is away from high and low. Thanks
 
Top