IHopeToLearn
New member
Hi guys,
I found these two scripts which I combined and altered. What I am missing and would like is to show the difference from the Opening Stock Price to the Last price in Percentage and Price displayed on both lines. Showing also if it went down or up using + or - symbols.
Also since I'm asking if possible, in Green for Up and Red for Down, and finally, the ability to see the previous days if wanted. Thanks
See screenshot here:
Here's the code:
#This is where I found the code for the opening price, thanks
#https://usethinkscript.com/threads/current-price-line-indicator-for-thinkorswim.614/post-8400
#Plots a Horizontal Line for the opening price
declare upper;
def agg = AggregationPeriod.DAY;
plot OpenLine = open(period = agg);
OpenLine.setpaintingStrategy(paintingStrategy.LINE);
OpenLine.setlineWeight(1);
OpenLine.setdefaultColor(color.white);
OpenLine.hideBubble();
#This is where I found the below code, and a thank you for this
# https://usethinkscript.com/threads/current-price-line-indicator-for-thinkorswim.614/post-8400
#Plots a Horizontal Line that follows the price value selected
input price=close;
input offset=0;
input length = 300;
def sma = SimpleMovingAvg(price, 1, length);
rec line = if IsNaN(sma) then line[1] else sma[offset];
plot priceline=if isnan(sma) then line else double.nan;
priceline.setpaintingStrategy(paintingStrategy.POINTS);
priceline.setlineWeight(1);
priceline.setdefaultColor(color.white);
priceline.hideBubble();
I found these two scripts which I combined and altered. What I am missing and would like is to show the difference from the Opening Stock Price to the Last price in Percentage and Price displayed on both lines. Showing also if it went down or up using + or - symbols.
Also since I'm asking if possible, in Green for Up and Red for Down, and finally, the ability to see the previous days if wanted. Thanks
See screenshot here:
Here's the code:
#This is where I found the code for the opening price, thanks
#https://usethinkscript.com/threads/current-price-line-indicator-for-thinkorswim.614/post-8400
#Plots a Horizontal Line for the opening price
declare upper;
def agg = AggregationPeriod.DAY;
plot OpenLine = open(period = agg);
OpenLine.setpaintingStrategy(paintingStrategy.LINE);
OpenLine.setlineWeight(1);
OpenLine.setdefaultColor(color.white);
OpenLine.hideBubble();
#This is where I found the below code, and a thank you for this
# https://usethinkscript.com/threads/current-price-line-indicator-for-thinkorswim.614/post-8400
#Plots a Horizontal Line that follows the price value selected
input price=close;
input offset=0;
input length = 300;
def sma = SimpleMovingAvg(price, 1, length);
rec line = if IsNaN(sma) then line[1] else sma[offset];
plot priceline=if isnan(sma) then line else double.nan;
priceline.setpaintingStrategy(paintingStrategy.POINTS);
priceline.setlineWeight(1);
priceline.setdefaultColor(color.white);
priceline.hideBubble();