Current Price Line Indicator for ThinkorSwim



This indicator displays a horizontal line across your ThinkorSwim chart to show the current value of the price.

One some charts, it is hard to discern the last price among all the other indicators and bubbles on the axis. Sometimes one wants to see the last price relative to other meaningful values like prev lows, reversal points, etc. This indicator draws a horizontal line across the chart area for the last price. I find it useful on VolumeProfile and TPO charts and many more.

Image of LinePriceTracker
(Orange line at 2981.5 on the sample charts below)

Code for LinePriceTracker

# LastPriceTracker
# Author: Kory Gill, @korygill
# Shows the last price as horizontal line across entire chart area.
# VERSION HISTORY  - Sortable date and time (your local time is fine), and your initials.
# 20190910-2200-KG - Created.
# ...
# ...

def vClose = close;
def nan = double.NaN;

def highestClose = HighestAll(if IsNaN(vClose[-1]) then vClose else nan);
plot hc = highestClose;
Link to LastPriceTracker study

Happy trading,
Kory Gill, @korygill
Last edited by a moderator:


Hi Kory and community, this looks interesting but since I'm not a programmer and just a beginner learning thinkscript I didn't understand it at first but I think I do now, however I wonder why this code would be useful since the last price is on the platform. I do see visual benefit of having a line for the last price even though it will keep moving with every last price. Did I interpret your code correctly.?

I have been looking for something similar for a long time to put a horizontal line on my daily and intraday charts with the prior days market close that occurs at 1600 Eastern time. I found a code in TOS and tried to modify it twice. In my first attempt it was similar to your code here and the close horizontal line on the charts moved with every last close candle which is not what I wanted. This is my most recent attempt which shows no red mistakes in the code in TOS but it doesn't show the price graph on the charts. I have no idea how to fix it. I would greatly appreciate your help or the community to help me add the market close to my charts. Thanks in advance

def marketClose = 1600.00;

plot yesterday = marketClose;

input aggregationPeriod = AggregationPeriod.DAY;

input showOnlyLastPeriod = yes;

input Close = 1600.00;

#hint Close: End of Period, Market close 1600 EST.

input length = 1;

input displace = -1;

def closeByPeriod = close(period = “DAY”)[-1];

def prevPrice = close(period = aggregationPeriod)[-1];

def price = close(period = aggregationPeriod);

plot DailyClose = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else price;


Last edited:


New member
Hi, I noticed E-trade and Tradingview have a static price line indicator in their charts but TOS did not. TOS help desk made such an indicator for me but they could not or did not have the time to make it work with extended hours, only works with extended hours set to 0. Thus it does not work with any study such as Ichimoku. Was wondering if such an indicator already exist or can someone code this one to work with extended hours. Thanks in adavance .