10 Min Heikin Ashi Colors on 1 Min bars for ThinkOrSwim

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.

lkIjHCW.png

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);
 

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

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!
 
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. "
5RfL9Dx.png


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.
 
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.
 
@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.

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

plot price = close;

price.setDefaultColor(GetColor(9));

price.SetPaintingStrategy(PaintingStrategy.LINE);
price.SetLineWeight(2);
price.AssignValueColor(if price > price[1] then Color.DARK_GREEN else Color.DARK_RED);
 
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.

lkIjHCW.png

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);
i like it

but can you add an alert pleas ?
 
i like it

but can you add an alert pleas ?
Add this to the bottom of your script
Ruby:
Alert( haOpen < haClose and haOpen[1] > haClose[1], " HA turned green", Alert.Bar, Sound.Chimes);
Alert( haOpen > haClose and haOpen[1] < haClose[1], " HA turned red", Alert.Bar, Sound.Chimes);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
228 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.
Back
Top