10 Min Heikin Ashi Colors on 1 Min bars for ThinkOrSwim

Townsend

Townsend

Active member
VIP
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.
Code:
input UsePeriod = aggregationperiod.ten_MIN;
Notice the white label in the upper left hand corner designates the period in use.


Code:
## 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);
 
U

Utajiri

New member
Hi,
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!
 
Townsend

Townsend

Active member
VIP
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.
 
Townsend

Townsend

Active member
VIP
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.
Code:
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);
o.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
c.AssignValueColor(if o > c then Color.Red else Color.Green);
c.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
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.
 
H

HighBredCloud

Well-known member
VIP
This is great...Thank You for a great script @Townsend
 
T

Trading51

Active member
2019 Donor
@Townsend Hello thanks for the post, does this back paint at all or once the bars change color it stays colored ?
 
BenTen

BenTen

Administrative
Staff
VIP
@Trading51 After the candle from the higher timeframe closed, it should not repaint.
 
H

HighBredCloud

Well-known member
VIP
@Trading51 Pretty sure on lower time frames it will repaint the bars while the time aggregation is set to the higher timeframe...
 

Similar threads

Top