Saturday, June 22, 2013

thinkscript included: percent change from open on watchlist

my daytrader friends asked me to write this custom column thinkscript:
# sdi_pctChgFromOpen: plots the percentage change from the opening price in a way that is appropriate for a watchlist custom column.
#hint: plots the percentage change from the opening price in a way that is appropriate for a watchlist custom column. rev: 1.0 
# author: allen everhart
# date: 22june2013
# copylefts reserved. This is free software. That means you are free
# to use or modify it for your own usage but not for resale. 
# Help me get the word out about my blog by keeping this header

# in place.
plot x=round(100*((close/open)-1),1);
x.assignValueColor( if x < 0 then color.RED else color.Dark_GREEN);


here's what this custom column looks like on a watchlist:
percent change from open custom column

here's how to install a custom column:
  1. right click on the heading of the watchlist and select Customize
  2. scroll down the Available Items list and double left-click on the scroll icon of any Custom column
  3. in the Custom Quote Formula dialogue, select the ThinkScript Editor tab
  4. in the editor textbox replace SimpleMovingAvg() with a cut-n-paste of the thinkscript above. 
  5. in the Column Name entry box select a reasonable column name such as "%ochg" (not too many characters)
  6. click ok
  7. select the "%ochg" column from the Available Items list and click the Add Item button
  8. click ok


  1. Hey, thanks so much for this code it really help my trading. Is there a way you tell me how to edit the default values, for example instead of -1.1 it says -1.10, like the percentage change from yesterdays close? That would be really helpful.
    Thanks in advance.

    1. if you want two decimal places then change the expression that reads: "round(100*((close/open)-1),1)" to "round(100*((close/open)-1),2)", where that final '1' is changed to a '2'.

  2. This is great! Thanks! Is there anyway to use this as a scan criteria as well? (eg, a custom "% change from open" scan criteria as opposed to the already built-in "% change (from close)" critera?)

    1. Yes. Install the script ( and you can access it from the 'custom' selection of 'add study filter'

    2. Its been a few years and I don't plan on paying 40 fuckin bucks for an Easycator Indicator, I was wondering how it would only show the gainers and not the losers on the day. As some will move 400% premkt only to fall 40% on the day. So I want to get rid of those through the use of a scanner.

    3. How would I edit the script so it only shows the winners

  3. Do you have a script similar to percent daily volume above 50 day moving average? I found one that alerts me/displays triangles for average daily volume above 50% daily average volume. Similar to an CANSLIM breakout model trigger.
    #hint type: Type of the volume moving average: simple or exponential
    input type = { default SMP } ;
    #hint length: Number of bars to use for volume moving average.
    input length = 50 ;
    #hint hotPct: Percent over volume moving average to trigger decorations.
    input hotPct = 50.0 ;

    def ma =
    if type == type.SMP then
    simpleMovingAvg(Volume, length)
    movAvgExponential(vOlume, length)

    plot hv =
    if 100 * ((volume / ma) - 1) >= hotPct then

    hv.SetDefaultColor( color.CYAN);
    hv.SetLineWeight(1) ;
    hv.setPaintingStrategy( PaintingStrategy.LINE_VS_TRIANGLES);

    1. I don't know to laugh or cry - you have quoted back to me here an early version of my sdi_hivol ( all the comments stripped out. I guess that was to be expected.

      To answer your question - I have on my watchlist a custom column I call 'vpc' - Volume Percent Change. This the calculation that Bill O'Neal describes somewhere. The code is trivial and I never released it. But since you asked here 'tis: round(100*volume/average(data=volume, length=50),0)

  4. This comment has been removed by the author.

  5. Hi, Allen,

    I installed the column as detailed above and it works fine. Your guidance most useful and greatly appreciated, thanks so much and have a good day.

  6. Yes, Thx so much. Still works in 2018.

  7. Question, is there a way to look at change from your own time frame, last 15 / 30 minutes instead of open. Would like to look at reversals intra day off my double and triple etf watch list.

  8. While I Like this, the only problem with this is a Gap up in over night will show a Large percentage Up at the Open, this is Incorrect Information and Not Trade-able at all. I need this to start at the Opening of the Daily trading session. I use a custom trading watchlist for my trading.

  9. I input your formula and it works well and this is exactly what I wanted. Color is a little off and I need to put the % in the data fields but thanks for the info.


Note: Only a member of this blog may post a comment.