Custom Quote/Watchlist Columns: % of Change

zhihaol

New member
Hello, I would like to have a custom column for my scan/watchlist just like the default %Change. That show green when the percentage is positive and red when the percentage is negative.

But I would like one for 5 days % of Change & 1 month of change.

I know the formula should be fairly straight forward, but I'm not that good at coding.

It would be really helpful if I can get some help.

Thank you guys so much!!!

This is all I have so far, but it doesn't show the quote as % nor does it have the color function.

Code:
input price = close;
input percent = 2.0;
input length = 5;

def x = 100*(price / price[length]-1);
plot PercentChg = 100*(price / price[length]-1);
 

zhihaol

New member
I found what I was looking for. But if anyone could tell me how to display the percentage signs much appreciated!

Shoutout to @Len20 thank you so much. So glad I came across your response!

Code:
input length = 30;

def price = close;
def oldprice =close[length];

plot change = 100*(price / price[length]-1);
change.assignValueColor( if change < 0 then color.RED else color.GREEN);
 

BenTen

Administrative
Staff member
Staff
VIP
@zhihaol Try this:

Code:
input length = 30;

def price = close;
def oldprice =close[length];

def change = 100*(price / price[length]-1);
def value = Round(change);
#change.assignValueColor( if change < 0 then color.RED else color.GREEN);

AddLabel(yes, Concat(value, "%"), color.orange);
 

zhihaol

New member
@BenTen Hmmm, it turns the value all orange. But it does show the % sign.

I would like to keep this functionality.

change.assignValueColor( if change < 0 then color.RED else color.GREEN);

Wait, I got it. I just change the color.orange and replaced it.

Thank you so much!!
 

Anon2311

New member
@BenTen Thanks for posting that above code in post #3, helped me get a custom watch-list column the way I wanted it.

Hoping you might have a solution for this issue...

When on ThinkorSwim desktop the watch-list column displays fine as you can see in "pic 1", but on ThinkorSwim Mobile the column is there but it is not displaying the data, see "pic #2".
I can't figure out how to get it to also display on my mobile platform.
Any thoughts?

Thanks


 

Similar threads

Top