Price level indicator

BobbyJJ22

New member
I'm looking for an indicator that draws a horizontal line all the way across the screen at the current price level (and obviously adjusts with price). I think this comes standard on tradingview but doesn't on TOS for some reason. I got this script from someone else and it works fine, however, the problem is that you have to adjust the length, so on some time frames it's very short and on others it's very long. Does anyone have a script that would show a horizontal price line extending throughout the entire chart no matter what time frame is used? Here is the code I started with for reference:

#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.LINE);
priceline.setlineWeight(3);
priceline.setdefaultColor(color.green);
priceline.hideBubble();
 
@BobbyJJ22 There are several PriceLine indicators here in these forums, as well as elsewhere on the internet, that display all the way across the chart... However, due to recent changes made to Thinkscript they no longer work without lag... The culprit is the use of the HighestAll() function... It seems that the folks at TD-Ameritrade/Thinkscript limited the use of all functions that look at All candles on a given chart... I am fairly certain that this is due to the use of overly long lookback charts by some users that add unnecessary burden to the server farm... Due to the fact that these functions have been throttled back, only updating every several minutes like some Custom Watchlist Columns, alternate methods of displaying the PriceLine have been implemented... The code you have posted is just one example... In reality, do we really need to see the current price when we scroll the chart back days, weeks, or months when we have the current price displayed at the top of the chart...??? While a convenience, it surely isn't a necessity...
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
475 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top