• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

Difference between current day high and low as watchlist column

J-Fearless

New member
VIP
Hi All,

I'm not great at scripting. I do okay but this alludes me for some reason, and I can't find a study that achieves this.

I'm looking for a script that will calculate the difference between the high of a period and the low of period, so I could add it as a watchlist column, and see at a glance without having to examine each chart.

So essentially if ABC stock has had a high of 50, and a low of 40, then the value would be the difference of 10.

Anyone know of a study like this or would be able to assist me in scripting one?

Thanks
 

BenTen

Administrative
Staff
VIP
What's the duration of the period? Previous day's high and low?

Here is an example for your watchlist column:

Ruby:
def prev_high = high[1];
def prev_low = low[1];

plot value = prev_high - prev_low;

Set the timeframe of the column to D (daily).
 

yildamile

New member
Hi. I'm looking for an indicator that shows me the high and the low of the price of the day on the watchlist. In the graph you can see the bubble with the price, I would like to have in the following list the notice of those ups and downs in the price. I will be very grateful if you can help me.
 

XeoNoX

Well-known member
VIP
Hi. I'm looking for an indicator that shows me the high and the low of the price of the day on the watchlist. In the graph you can see the bubble with the price, I would like to have in the following list the notice of those ups and downs in the price. I will be very grateful if you can help me.
you said...

I would like to have in the following list the notice of those ups and downs in the price

1)what list? and what do you mean by notice?

2) define ups and downs? ups and downs from what? close to open? open to high? low to high? high to low open to low? you will have to explain more?
 

MKToronto

New member
you said...

I would like to have in the following list the notice of those ups and downs in the price

1)what list? and what do you mean by notice?

2) define ups and downs? ups and downs from what? close to open? open to high? low to high? high to low open to low? you will have to explain more?
Hi: I need help with a custom column to show the difference between current high and current Last? Thanks
 

MerryDay

Well-known member
VIP
@MKToronto You left SO much out of your query. Thinkscript works based on definitions "def" statements. The statements are written as mathematical expressions. You will need to mathematically define the meaning of "high" (52 week High, Day High, the High of the Current Candle) and the meaning of "difference" (dollar difference, percentage difference, etc.)

In the below example, High is the 52-week High and Difference is the Percentage Diff. As this is an example, I am doing this as a label on a chart to more clearly illustrate the math. When you have it customized to your definitions, comment out the AddLabel statement (put a # in front of it, and then you can create your watchlist.
PS: this example only works on a watchlist or chart set to daily as in 252 DAYS in a year. Using a different aggregation, use different math.
mKKWlAe.png

https://usethinkscript.com/threads/thinkorswim-52-week-highs-lows-scanner-and-watchlist-column.809/#post-6335
Ruby:
# Percentage Off 52 Week High
# Nick Name NAG®
# 11.02.2015

# This assumes a daily aggregation.  You will need to use
# daily or higher, adjust the 252 length as needed.

def The52WkHigh = Highest(high, 252) ; 
plot percentage = Round((close / The52WkHigh  - 1) * 100);
AddLabel(yes, "Last: " +close +" | High: " +The52WkHigh +" | %: " +percentage, color.blue);
HTH
 

Leo1015

Member
VIP
@MerryDay , you've always been so helpful and kind. Have a quick question, is there a script/scanner that would be able to identify when a ticker has started an uptrend of a HH AND HL on the chart and also alert when the the ticker will start a the path to a new HH or new HL? Would also be nice if it can be utilized on different time frames, especially WK, D, 4hr and 1hr
 

Similar threads

Top