Last Price Axis Label for Think or Swim

UPDATE 9 Feb 2009: Think or Swim added this as an option under “Chart Style Settings”, “Show Last Price Bubble”. It’s painted the same color as your candle scheme. My indicator is now obsolete, but I leave the code below for reference, since it shows a useful way to handle indicators that deal with the current bar only.

lastpriceaxislabel3

Think or Swim does not did not originally have a built-in “last price” label on the price axis. You have to look in the upper corner to get the latest print. My focus is always on the right hand side price axis when I trade, and I found it very distracting to have to look away from there to see the current price. Thinkscript time!

The easy answer: Plot last=close;

The problem with that is that you get a plot of some kind (dot, line, etc) on every bar on your chart. Not good. If you simply hide the study, you also hide the axis label, and end up seeing nothing. In the end I found a clean way to get that price to update live on the price axis without any other clutter on the chart. We use your friend and mine, ‘double.nan’ for this. If the current value for an indicator is N/A, then there is no plot on the chart for the current bar. Also, when the current value is N/A, the axis label retains the last known value of the indicator. This is the key. We set up the plot to check the close 1 bar in the future. If the close is a number (valid for every bar except the current bar) then we will plot N/A. If we are in the current bar, then we set the value to the ‘close’ of the bar, or the last tick. It turns out that the bar is not painted with an indicator due to the N/A logic, but the axis label is still there, happily updating away. Just what we wanted!

Here is the code (only two lines of code, lots of other commentary):

# Last Price Axis Label
# By Prospectus @ https://readtheprospectus.wordpress.com
#
# Note! If you want your Last price label to be on top of all
# other axis labels, this study must be the first study added
# to your chart, appearing at the top of the list.
#
# This trickery will plot N/A for all bars, keeping your past bars
# clean, but will set the Y-axis value for the current bar close:
#
plot Last = if isnaN(close[-1]) then close else double.nan;
#
# Formatting:
#
Last.setdefaultcolor(Color.white);

Tags: ,

4 Responses to “Last Price Axis Label for Think or Swim”

  1. Vlad Says:

    Interesting solution. I have found it is quite annoying also. Can you please navigate me where to insert the script to customize last price bubble ( I am new to thinkorswim). Thx in advance.

  2. Prospectus Says:

    This will help you install it:

    https://readtheprospectus.wordpress.com/the-complete-beginners-guide-to-using-custom-thinkscripts/

  3. Vlad Says:

    I’m using PaperMoney version for now and there is a problem with import function – app crashes :-S. BTW, what Last Price Bubble anyway?

  4. Prospectus Says:

    It shows a bubble with the last printed price on the right axis. It’s outdated now because it’s built in to TOS.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: