• Get $40 off VIP by signing up for a free account! Sign Up

Heatmap-like as a an option to plot on chart?


New member

I am new to using thinkorswim to plot information about trading, and so far thinkscript seems promising for my purposes.

I have been interested in taking a measure for which I would like to evaluate multiple values all at once and display the array of results, which are all numbers between 0 and 1, as a stack of colored squares as wide as every time tick. The aggregate should be a sort of "heatmap" where one scale is time along with the chart, and the other is a series of rows along which I will sweep another parameter.

I've been looking through the available plotting resources but I seem to find either line charts, or plotting arrows or other things along a chart. I expected a heatmap, or contour plots, or maybe 3D data representations in the "Advanced" tab but it's only goes to far as to concatenate strings. Ooh. Advanced. So very.

A few twists I know are ahead for me: the ordinate (y-dimension) is calculated once for a series of time scales, back a minute, back a few minutes, back an hour, back a day, etc. I think I have a lead on how to handle calculations on multi-time-frame functions, but there's a chance that someone has worked through both essential issues in one go.

EDIT: Solved. Thermo mode is a whole method for handling input and I don't have to code up anything new.
Last edited:
That looks like where I started, but I'm disappointed by the lack of references to other display items. It took me a while but I found a few things.

This is what made me jump into thinkscript in the first place. Not the video and the rambling feller but the heatmap

I thought about being devilish with Add Cloud, but this isn't what I'm trying to plot. Something to try later, perhaps. Then I posted here...

However, this is actually what I wanted, and it came to me just after your post. It was not in an obvious area in the rubbish documentation snarl over there, but whatever. I can give it inputs and so my thinkscript's "scale" should be able to be adjusted by this dialog box. Thanks for the very quick response, though.
The study in the video is pretty neat. Having read through this teaching post about combining studies:


I think I have that down, at least for CCI and RSI anyway, because there is only one plot. I'm confused on what to do with MACD, BB, Ichimoku because they have more than one plot. Thermo appears to use one plot. So I just averaged them for now. In his video he says he has custom points for MACD, ICH, BB and weights them against the RSI and CCI. I don't know what that really means - did he use AverageType.Weighted or is he assigning a weight (40%) to MACD, ICH, BB and averaging them together? Something like (((MACD + ICH + BB)/3) * .04) + (CCI + RSI))/2?

Anyway sure my calc/code is jibberish, but at least I got the syntax down - not bad for noob browsing through the forum trying to learn to trade and code :D:

Declare lower;

input length = 14;
input price = close;
input averageType = AverageType.Wilders;
def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);

input length_CCI = 14;
def price_CCI = close + low + high;
def linDev = lindev(price_CCI, length_CCI);
def CCI = if linDev == 0 then 0 else (price_CCI - Average(price_CCI, length_CCI)) / linDev / 0.015;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType_MACD = AverageType.Exponential;
input showBreakoutSignals = no;
def MACD_Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
def MACD_Avg = MovingAverage(averageType, MACD_Value, MACDLength);
def MACD_Diff = MACD_Value - MACD_Avg;
def AVG_MACD = (MACD_Value + MACD_Avg + MACD_Diff)/3;

# BB
input price_BB = close;
input displace = 0;
input length_BB = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType_BB = AverageType.Simple;
def BB_sDev = stdev(data = price_BB[-displace], length = length_BB);
def BB_MidLine = MovingAverage(averageType_BB, data = price_BB[-displace], length = length_BB);
def BB_LowerBand = BB_MidLine + num_Dev_Dn * BB_sDev;
def BB_UpperBand = BB_MidLine + num_Dev_Up * BB_sDev;
DEF AVG_BB = (BB_sDev + BB_MidLine + BB_LowerBand + BB_UpperBand)/5;

# Ichimoku
input tenkan_period = 9;
input kijun_period = 26;
def Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
def Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
def "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
def "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
def Chikou = close[-kijun_period];
def AVG_ICHO = (Tenkan + Kijun + "Span A" + "Span B" + Chikou)/5;

# All Combined
# MACD, BB, ICH weighted (lets say 40% )against RSI, CCI
def MACD_BB_ICH = ((AVG_MACD + AVG_BB + AVG_ICHO)/3) * .40;
def RSI_CCI = (RSI + CCI)/2;
Plot Combined = MACD_BB_ICH + RSI_CCI;


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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
664 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.