Saturday, November 22, 2014

thinkscript included: sdi_yield_label

this one is so obvious that i am surprised that there is not a standard tos study to display a stock's yield in a chart label. here's the picture:
spy with sdi_yield_label in upper left hand corner

here's the code:
################################
# sdi_yield_label: Display Yield In A Chart Label.
#hint: Displays yield in a chart label. sdi_ivp rev: 1.0.0 http://www.smallDogInvestor.com 
# author: allen everhart
# date: 22nov2014
# revision 1.0.0
# copylefts reserved. This is free software. That means you are free
# to use or modify it for your own usage but not for resale. 
# Help me get the word out about my blog by keeping this header
# in place. 
plot labelColor=double.nan; #just to pull-in the color-chooser widget
labelColor.setDefaultColor(color.DARK_GREEN);
labelColor.hideTitle();
labelColor.hide();
addLabel(1,concat("Yield:",asPercent(getYield())), labelColor.takeValueColor());
################################

No comments:

Post a Comment