10 Min Heikin Ashi Colors on 1 Min bars for ThinkOrSwim


Active member
This indicator will display Heikin Ashi colors (red or green) from any period on any other period.
In this example, I'm putting 10 minute Heikin Ashi colors on 1 minute bars.
This is possible thanks to the Aggregation Period function.
input UsePeriod = aggregationperiod.ten_MIN;
Notice the white label in the upper left hand corner designates the period in use.


## Heiken Aski Multi-Time Frame
## 2019 Paul Townsend v3

input UsePeriod = aggregationperiod.ten_MIN;

def aOpen = open(period = usePeriod);
def aClose = close(period = usePeriod);
def aHigh = high(period = usePeriod);
def aLow = low(period = usePeriod);

def haClose = (aOpen + aClose + aHigh + aLow)/4;
def haOpen = (haOpen[1] + haClose[1]) /2;

assignpriceColor(if haOpen < haClose then color.green else
if haOpen > haClose then color.red else color.white);

addlabel(yes,"[" + useperiod/60000 + "]",color.white);


New member
Can someone help with building a script for multi-time frame closing price?
I want to be able to view the closing price of any time frame (from 30m, hourly etc - preferably have the option of selecting any time time frame I want) on smaller time frames and indicate it with a line on my intraday 1 or 3min chart.
If there is a way to do this such that I can select any price type (OHLC) of a larger time frame (from 30mins upwards), on smaller time frames (between 1-5mins) that would be awesome.
Thanks guys!


Active member
Can someone help with building a script for multi-time frame closing price?
@Utajiri I think this code already exists. I'm just trying to find it. I Looked all over for it. No luck yet.

"The top chart is AAPL 5 min chart with 15 minute overlay. The bottom chart is the same 5 min chart of AAAPL with a 60 min overlay. "

Quick question: is this similar to what @shizah requested here: https://usethinkscript.com/threads/candle-plot-mtf.746/ ?

@BenTen Yes. They both display a longer time frame over a shorter time frame.

My Percent Range Indicator would be much better if I could draw a box like the chart above, (instead of using that sloppy AddCloud() function). I was thinking of posting a question about that, but if anyone knows where the code to the above chart is, please post a link here.


Active member
This is about as close as I can find. @Utajiri This will work for you.
I'll post this in the Indicator Section, with a chart later, just so it's in the library.
input agg = AggregationPeriod.FOUR_HOURS;
plot o = open(period = agg);
plot c = close(period = agg);
o.AssignValueColor(if o > c then Color.Red else Color.Green);
c.AssignValueColor(if o > c then Color.Red else Color.Green);
AddCloud(c, o, Color.Green, Color.Red);

But... my Percent Range Indicator doesn't look back based on a different time period,
but rather a number of bars. So this technique won't work for me.
I'll keep looking for a solution on that.


New member
@Townsend your script above is really nice and using it helped me to clean up my chart as well as provide great continuation trend entries and avoid chop.

I have forgotten the author of this "Plot Price" script.

Modified it to paint ValueColor. Painting Strategy as LINE works well with Heiken Ashi.

# Plot Price useful with "Heiken Ashi"
# UNTICK 'Show Last Price Bubble" Chart Settings, General

plot price = close;


price.AssignValueColor(if price > price[1] then Color.DARK_GREEN else Color.DARK_RED);