# Heikin Ashi RSI candlesticks For ThinkOrSwim

##### Member
The Heikin Ashi RSI candlestick is a valuable tool for traders, offering a clearer view of trends by smoothing out price noise. It differs from traditional candles by considering the previous period's open, close, high, and low prices.

Integrating Heikin Ashi with RSI:
1. Identifying Trends: Heikin Ashi helps spot trends more effectively. Paired with RSI, it aids in identifying potential reversals and confirming momentum.
2. Divergence Analysis: Watch for divergences between Heikin Ashi trends and RSI values, indicating potential reversals.
3. Confirmation Signals: Use Heikin Ashi patterns to confirm RSI signals, enhancing trading strategy confidence.

Hello,
Does anyone know how to code this script in TOS language please?
Thanks

Last edited by a moderator:
Hello,
Does anyone know how to code this script in TOS language please?
Thanks

check the below

CSS:
``````#/@version=4
#study("RSI CANDLESTICKS", overlay=false, precision=2)
# converted by Sam4Cok@Samer800    - 03/2024

declare lower;

input chartType = {Default "Candle", "Heikin Ashi"};
input rsiLength = 14;
input overBought = 70;    # "Over Bought Limit"
input overSold   = 30;      # "Over Sold Limit"

def na = Double.NaN;
def last = isNaN(close);

def O = RSI(Price = open , Length = rsiLength);
def H = RSI(Price = high , Length = rsiLength);
def L = RSI(Price = low  , Length = rsiLength);
def C = RSI(Price = close, Length = rsiLength);

def c1 = (o + h + l + c) / 4;
def o1 = CompoundValue(1, (o1[1] + c1[1]) / 2, (o[1] + c[1]) / 2);
def h1 = Max(Max(h, o1), c1);
def l1 = Min(Min(l, o1), c1);

def oo; def hh; def ll; def cc;
Switch (chartType) {
Case "Heikin Ashi":
oo = o1;
hh = h1;
ll = l1;
cc = c1;
Default:
oo = o;
hh = h;
ll = l;
cc = c;
}

def up = CC > OO;

def opUp = if up then OO else na;
def hiUp = if up then HH else na;
def loUp = if up then LL else na;
def clUp = if up then CC else na;

def opDn = if up then na else OO;
def hiDn = if up then na else HH;
def loDn = if up then na else LL;
def clDn = if up then na else CC;

# Plot the new Chart

AddChart(open = clUp, high = hiUp , low = loUp , close = opUp,
type = ChartType.HEIKIN_ASHI, growcolor =  CreateColor(0,206,209));

AddChart(open = OpDn, high = hiDn , low = loDn , close = clDn,
type = ChartType.HEIKIN_ASHI, growcolor =  CreateColor(220,20,60));

plot midLine = if last then na else 50;
midLine.SetDefaultColor(Color.GRAY);
midLine.SetStyle(Curve.SHORT_DASH);
def obLevel = if last then na else overBought;
def osLevel = if last then na else overSold;

#-- End of CODE``````

check the below

CSS:
``````#/@version=4
#study("RSI CANDLESTICKS", overlay=false, precision=2)
# converted by Sam4Cok@Samer800    - 03/2024

declare lower;

input chartType = {Default "Candle", "Heikin Ashi"};
input rsiLength = 14;
input overBought = 70;    # "Over Bought Limit"
input overSold   = 30;      # "Over Sold Limit"

def na = Double.NaN;
def last = isNaN(close);

def O = RSI(Price = open , Length = rsiLength);
def H = RSI(Price = high , Length = rsiLength);
def L = RSI(Price = low  , Length = rsiLength);
def C = RSI(Price = close, Length = rsiLength);

def c1 = (o + h + l + c) / 4;
def o1 = CompoundValue(1, (o1[1] + c1[1]) / 2, (o[1] + c[1]) / 2);
def h1 = Max(Max(h, o1), c1);
def l1 = Min(Min(l, o1), c1);

def oo; def hh; def ll; def cc;
Switch (chartType) {
Case "Heikin Ashi":
oo = o1;
hh = h1;
ll = l1;
cc = c1;
Default:
oo = o;
hh = h;
ll = l;
cc = c;
}

def up = CC > OO;

def opUp = if up then OO else na;
def hiUp = if up then HH else na;
def loUp = if up then LL else na;
def clUp = if up then CC else na;

def opDn = if up then na else OO;
def hiDn = if up then na else HH;
def loDn = if up then na else LL;
def clDn = if up then na else CC;

# Plot the new Chart

AddChart(open = clUp, high = hiUp , low = loUp , close = opUp,
type = ChartType.HEIKIN_ASHI, growcolor =  CreateColor(0,206,209));

AddChart(open = OpDn, high = hiDn , low = loDn , close = clDn,
type = ChartType.HEIKIN_ASHI, growcolor =  CreateColor(220,20,60));

plot midLine = if last then na else 50;
midLine.SetDefaultColor(Color.GRAY);
midLine.SetStyle(Curve.SHORT_DASH);
def obLevel = if last then na else overBought;
def osLevel = if last then na else overSold;

#-- End of CODE``````

87k+ Posts
346 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?