Current Price Line Indicator For ThinkOrSwim

I am looking at the box where you put the symbol, the SPX chart right now, the price in the box next to it is 4136.48. TastyWorks is showing the same price. Using the Bar style Chart Type. For the 20 days 1 day Heikin Ashi style chart the current price line is 4136.52. The Heikin Ashi is showing 4135.32 which is expected.

Right, so if you want the line to show up on the Heikin Ashi close, you need to add a variable to calculate the Heikin Ashi close, which is just the OHLC4.

Just replace this line (shown below). But, be aware that is not the true price at the close of the market - that is a calculated price to generate the Heikin Ashi bar. I'm sure you already know that part though.

REPLACE IN CODE:
def lastClose = if !IsNaN(close) and IsNaN(close[-1]) then OHLC4 else lastClose[1];
 

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

Not sure what your saying. my chart show the Heiken Ahsi normal close bubble. I also added the current or last price line on the chart. Both of them don't match the last close price next to the SPX symbol.
 
Current Price Line Indicator For ThinkOrSwim Line At Price
Due to the most recent ToS update the HighestAll function has lagging issues.
Mobius of the TSL recently posted this priceline indicator in the chat as an alternative to using HighestAll(). Maybe you can find it useful.

Code:
# Line At Price
# Mobius
# Alternative to using the HighestAll() function

input barsBack = 1000;

def c = if !IsNaN(close) and IsNaN(close[-1])
        then close
        else c[1];
plot line = if isNaN(close[-barsBack])
            then c[-barsBack]
            else Double.NaN;
Thanks for this code. This works great. Is it possible to dynamically change color like RED or GREEN based on cancle?
Can someone help on this?
 
Last edited by a moderator:
Thanks for this code. This works great. Is it possible to dynamically change color like RED or GREEN based on cancle?
Can someone help on this?
Ruby:
# Line At Price
# Mobius
# Alternative to using the HighestAll() function

input barsBack = 1000;

def c = if !IsNaN(close) and IsNaN(close[-1])
        then close
        else c[1];
plot line = if isNaN(close[-barsBack])
            then c[-barsBack]
            else Double.NaN;

line.AssignValueColor(if close>open then color.uptick else color.downtick);
CA2CGYf.png
 
Current Price Line Indicator with Current Price in Bubble(movable)

I believe this my the first post and hope I'm posting this correctly.
I've added to a Mobius script "Line At Price" by adding a movable price bubble on the plot line. It's been much better watching the charts with this modification.
I realize that the price line is constantly moving but Is there a way to have the bubble change color when the current price line moves above or below the previous bars close?

Code:
# Line At Price With Current Bubble

# Mobius
# Alternative to using the HighestAll() function
#

input barsBack = 1;

def c = if !IsNaN(close) and IsNaN(close[-1])
        then close
        else c[1];
plot line = if isNaN(close[-barsBack])
            then c[-barsBack]
            else Double.NaN;
line.SetLineWeight(1);
line.SetDefaultColor(Color.LIME);

# Bubble mover snippet
input bubblemover =3;
def b  = bubblemover;
def b1 = b + 1;

DefineGlobalColor("D”, CreateColor(133, 163, 104));
#AddChartBubble(IsNaN(line[b1]) and !IsNaN(line[b]), line[b], AsDollars(c), GlobalColor("D"));
 
This workaround by Mobius fixes the lag you are experiencing when using highestall(). TOS must have been experiencing performance issues by the widespread use of highestall() as you did.

1707004581809.png

I am using the color to be orange using --> line.SetDefaultColor(color.orange);

While the line itself appears in ORANGE, why does the price on the price axis appear in GREEN? Is there a way to set that to ORANGE?

Current Price Line Indicator For ThinkOrSwim Line At Price
Due to the most recent ToS update the HighestAll function has lagging issues.
Mobius of the TSL recently posted this priceline indicator in the chat as an alternative to using HighestAll(). Maybe you can find it useful.

Code:
# Line At Price
# Mobius
# Alternative to using the HighestAll() function

input barsBack = 1000;

def c = if !IsNaN(close) and IsNaN(close[-1])
        then close
        else c[1];
plot line = if isNaN(close[-barsBack])
            then c[-barsBack]
            else Double.NaN;
1707004740951.png

I am using the color to be orange using --> line.SetDefaultColor(color.orange);

While the line itself appears in ORANGE, why does the price on the price axis appear in GREEN? Is there a way to set that to ORANGE?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
471 Online
Create Post

Similar threads

Similar threads

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