Hello, Wondering how to make change to this script to use the ATH if the stock has less than 252 days of trading history. I looked at the thinkscript functions, but didn't find any functions that returns me ATH. Appreciate your response. Thanks.52-week high/low is the highest and lowest price at which a stock has traded during the previous year. It is a technical indicator used by some traders and investors who view the 52-week high or low as an important factor in determining a stock's current value and predicting future price movement.
"Paris: Here's a watchlist you can use for percentage off 52 week high. For 52 week low, you can modify this."
Code:# Percentage Off 52 Week High Watchlist # 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. Round((close / Highest(high, 252) - 1) * 100)
Update: Below is the code I came up with. Can someone please audit and let me know if it looks ok. thinkorswim is flashing warning sign saying it might affect performance.
Code:
def high52WeekHigh = if IsNaN( Highest(high, 252)) then HighestAll(high) else Highest(high, 252);
def high52WeekHighPercent = (close - high52WeekHigh)/close * 100;
Last edited: