Heikin Ashi For ThinkOrSwim

@Parker427 Maybe this is what you're looking for? Full credit goes to MTS1 of the TSL.

Code:
# HeikinAshiPaintBars_MTSmod180412
# MTS1 1804 based on JQ shared script TSL
# http://tos.mx/jKArTG##
# Updated formula based on http://stockcharts.com/school/doku.php?id=chart_school:chart_analysis:heikin_ashi which seems to match ToS HA Chart

def o = open;
def h = high;
def l = low;
def c = close;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (o[1] + c[1]) / 2);
HAhigh = Max(Max(h, haopen), haclose[1]);
HAlow = Min(Min(l, haopen), haclose[1]);
HAclose = (open + high + low + close) / 4;
AssignPricecolor(if haclose > haopen
                 then Color.Green
                 else Color.Red);

and here is a MTF version -

Code:
# HeikinAshiPaintBars_MTSmod180412
# MTS1 1804 based on JQ shared script TSL
# http://tos.mx/jKArTG##
# Updated formula based on http://stockcharts.com/school/doku.php?id=chart_school:chart_analysis:heikin_ashi which seems to match ToS HA Chart
# Pensar - added MTF 7/30/2020

input agg = aggregationPeriod.TEN_MIN;

def o = open(period = agg);
def h = high(period = agg);
def l = low(period = agg);
def c = close(period = agg);
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (o[1] + c[1]) / 2);
HAhigh = Max(Max(h, haopen), haclose[1]);
HAlow = Min(Min(l, haopen), haclose[1]);
HAclose = (o + h + l + c) / 4;
AssignPricecolor(if haclose > haopen
                 then Color.Green
                 else Color.Red);
Does this repaint?
 
Does this repaint?
No, Heikin-Ashi candles do not repaint.

Repainting indicators on the forum are prefixed with "repaints"

Most of the indicators on the forum will update on the current candle with every tick until the bar closes.
This is not considered repainting.
 
@Drgrcrpilot You can use this code below to display Heikin Ashi as a lower study:

Code:
#TSI_HeikinAshi_Bars
# (c) 2009
#Copyright Authorship: ThinkSwimIndicators.com


#==========================================================================
# >>>                H E I K I N - A S H I   B A R S                  <<< [
#.........................................................................[
#                                                                         [
#                         -----=== O ===-----                             [
#                                                                         [
#****COPYRIGHT NOTICE:  "Heikin-Ashi Bars" is free to use by the general  [
# public. Distribution or modification is prohibited. All content, form,  [
# and style, likewise, is protected by copyright.                         [
#                                                                         [
#                         -----=== x ===-----                             [
#                                                                         [
# ThinkSwimIndicators.com  will  CONTINUE  to release FREE indicators--of [
# the  highest quality and caliber--for the Thinkorswim Trading platform, [
# for use by all.  Many of our free indicators surpass the Quality & Use- [
# fulness of indicators offered for "purchase" by other sites. We suggest [
# that  you  visit the free "Learning Center"  at our website for further [
# information on the use of this indicator. "GO: Master the Markets!" (TM)[
#==========================================================================


declare lower;

def haclose = (open + high + low + close) / 4;
rec haopen = compoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] +
close[1]) / 2);
def diff = haclose - haopen;

plot HA_Down = if  diff > 0 and diff[1] >= 0 then 0 else 1;
plot HA_Up = if diff < 0 and diff[1] <= 0 then 0 else 1;

HA_Up.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
HA_Up.AssignValueColor(color.GREEN);
HA_Up.SetLineWeight(5);

HA_Down.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
HA_Down.AssignValueColor(color.RED);
HA_Down.SetLineWeight(5);
Can this placed in a watchlist green for up trend and red for down trend?
 

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
561 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