# HAMA Heiken Ashi indicator

#### MBF

##### Active member
2019 Donor
Does anyone know if this indi is out there somewhere? It's a beautiful thing.

T

#### tomsk

##### Well-known member
VIP
@MBF Here is a Heiken Ashi Moving Average study you may like to check out. Feel free to edit the length of the moving average to suit your requirements

# START
def length = 8;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close) / 2);
HAhigh = Max(high, close[1]);
HAlow = Min(low, close[1]);
HAclose = (HAopen + HAclose[1] + HAlow + close) / 4;
AssignPriceColor(if HAclose > HAopen then Color.GREEN else color.RED);
plot HAMA = Average(HAclose, length);
# END

Last edited:

#### MBF

##### Active member
2019 Donor
@MBF Here is a Heiken Ashi Moving Average study you may like to check out. Feel free to edit the length of the moving average to suit your requirements

# START
def length = 8;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close) / 2);
HAhigh = Max(high, close[1]);
HAlow = Min(low, close[1]);
HAclose = (HAopen + HAclose[1] + HAlow + close) / 4;
AssignPriceColor(if HAclose > HAopen then Color.GREEN else color.RED);
plot HAMA = Average(close, length);
# END
Thank you!!!

S

#### skynetgen

##### Well-known member
Heikin Ashi concept is very interesting . In essence its 2 period smoothing of price action, which visually represents what actually happens in trend better than individual candles. However it can be misleading when used in some timeframes.
back to your question. There is this study I made while playing with HKA - it color candles pink when there is HKA trend transition. It can be used both on regular and HKA charts

Code:
``````#HK
#Use bar to figure trendDown or confirm.
#heikin ashi bars. close=OHLC/4.  open=1/2(open[1]+close[1])  and HA trend
#
def haclose = (open + high + low + close) / 4;
def haopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close[1]) / 2);
def hahigh=max(open,max(close,high));def halow=min(open,min(close,high));

def HAtrendUP  = haclose > haclose[1];
def upBar = if HAtrendUP then upBar[1] + 1 else 0;
def HATrendDown = haclose <= haclose[1];
def downBar = if HATrendDown then downBar[1] + 1 else 0;
def bars = upBar + downBar;
#the one with body small relative to wicks . let say less than 0.3
def HAtransition=absvalue((haopen-haclose)/(hahigh-halow))<0.3;
def HARed = HAOpen > HAclose;
def HAGreen = !HARed;
def HADecidedRed = HARed and HAHigh == HAopen;
def HADecidedGreen = HAGreen and HAlow == HAOpen;

plot data=0;
#
AssignPriceColor( if hatransition then color.MAGENTA
else Color.CURRENT);``````

#### MBF

##### Active member
2019 Donor
@skynetgen Thank you I will take it for a spin!
Take a look at this beauty.

S

#### skynetgen

##### Well-known member
Yeah it looks good . Like every trending chart does : ) . The issue with trends is that its not hard to identify and paint them postfactum with all the nice entries. I wrote dozens of indicators which do that with 99% accuracy on trending stocks (without repainting). Key is how to get something which will NOT show the signals on things which do not result in trends. Most losses comes from the chop. So indicators which shows trends with 100% accuracy is pretty worthless when it also shows non-trends often. As most price movement is chop odds of getting into chop are very high to start with

p.s. I am now of opinion that inidcator based on the single timeframe can never do that. In fact probably no indicator can do that with high probability if its single timeframe, price action based only. There are other factors which determine that.

#### MBF

##### Active member
2019 Donor
Yeah it looks good . Like every trending chart does : ) . The issue with trends is that its not hard to identify and paint them postfactum with all the nice entries. I wrote dozens of indicators which do that with 99% accuracy on trending stocks (without repainting). Key is how to get something which will NOT show the signals on things which do not result in trends. Most losses comes from the chop. So indicators which shows trends with 100% accuracy is pretty worthless when it also shows non-trends often. As most price movement is chop odds of getting into chop are very high to start with

p.s. I am now of opinion that inidcator based on the single timeframe can never do that. In fact probably no indicator can do that with high probability if its single timeframe, price action based only. There are other factors which determine that.
I really get that but, say you were to apply the RVOL condition? Knowing that a stock will trend one way the other might be helpful in at least picking stocks for the day that have a higher probability to trend.

S

#### skynetgen

##### Well-known member
I really get that but, say you were to apply the RVOL condition? Knowing that a stock will trend one way the other might be helpful in at least picking stocks for the day that have a higher probability to trend.

yeah. Since you mentioned SMB capital ( I watched their videos a lot) - its what they call "stocks in play". Stocks with catalyst, and rvol etc. One problem with RVOL in TOS - it doesnt have one. You need something which will show relative volume AT TIME OF DAY compared to average volume done at this time of day.
And yeah playing stock in play increased the odds of "something" happening. However what actually happens - it might be varied chop and then trend. it might be trend which is gone and done by 945 and then chop. It might be both way fakeouts and then sqz sideways. Many things. So you would narrow down to "something happening" (maybe!) but still problem of knowing when trend starts and not of various fakeouts/chops remains.

I been doing stocks in play for a while now - its far from easy! (at least for me)

#### MBF

##### Active member
2019 Donor
@skynetgen Right now that is about all I can play. I have been trying to find a decent RVOL on TOS. I just don't get how they have all these complicated scripts or cool scripts but can't find a decent RVOL. THAT is my most complicated area right now is finding stocks to play. I need high IV or at least a very liquid stock that trades \$60 and below ATM. Drives me nuts!

S

#### skynetgen

##### Well-known member
@skynetgen Right now that is about all I can play. I have been trying to find a decent RVOL on TOS. I just don't get how they have all these complicated scripts or cool scripts but can't find a decent RVOL. THAT is my most complicated area right now is finding stocks to play. I need high IV or at least a very liquid stock that trades \$60 and below ATM. Drives me nuts!
To find stocks in play I use simply premarket gapper approach . Filtering by price, capitalization and average volume per day (to weed out penny and/ or illiquid stocks). Out of average 15-30 names which pop on scanners 2-4 stocks I pick have at least one mover "stock in play". That is done premarket so I dont have to scramble with scans intraday
here is this very simple scan: https://tos.mx/WXUxaCb

another proxy for stocks in play I use is sizzle index. (>2 is wide critera, >5 picks something with big catalyst practically every day)

#### J007RMC

##### Well-known member
2019 Donor
VIP
@MBF Here is a Heiken Ashi Moving Average study you may like to check out. Feel free to edit the length of the moving average to suit your requirements

# START
def length = 8;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close) / 2);
HAhigh = Max(high, close[1]);
HAlow = Min(low, close[1]);
HAclose = (HAopen + HAclose[1] + HAlow + close) / 4;
AssignPriceColor(if HAclose > HAopen then Color.GREEN else color.RED);
plot HAMA = Average(close, length);
# END
I sure like this moving average ty

#### MBF

##### Active member
2019 Donor
To find stocks in play I use simply premarket gapper approach . Filtering by price, capitalization and average volume per day (to weed out penny and/ or illiquid stocks). Out of average 15-30 names which pop on scanners 2-4 stocks I pick have at least one mover "stock in play". That is done premarket so I dont have to scramble with scans intraday
here is this very simple scan: https://tos.mx/WXUxaCb

another proxy for stocks in play I use is sizzle index.
Thank you @skynetgen!
I don't really understand that last part,
(>2 is wide critera, >5 picks something with big catalyst practically every day).

S

#### skynetgen

##### Well-known member
Thank you @skynetgen!
I don't really understand that last part,
(>2 is wide critera, >5 picks something with big catalyst practically every day).
if you add stocks to your watchlist and add sizzle index column just sort by it . - indicates increased activity - basically a proxy to relvol (very often you will see significantly increased volume on those stocks)

MBF
S

#### skynetgen

##### Well-known member
@MBF Here is a Heiken Ashi Moving Average study you may like to check out. Feel free to edit the length of the moving average to suit your requirements

# START
def length = 8;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close) / 2);
HAhigh = Max(high, close[1]);
HAlow = Min(low, close[1]);
HAclose = (HAopen + HAclose[1] + HAlow + close) / 4;
AssignPriceColor(if HAclose > HAopen then Color.GREEN else color.RED);
plot HAMA = Average(close, length);
# END

There is small bug here (uses close isntead of haclose). Anyhow this HA code works better than one I was using before. Integrated it with my transition code
https://tos.mx/aA77lzO

T

#### tomsk

##### Well-known member
VIP
Here is the revised code

def length = 8;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close) / 2);
HAhigh = Max(high, close[1]);
HAlow = Min(low, close[1]);
HAclose = (HAopen + HAclose[1] + HAlow + close) / 4;
AssignPriceColor(if HAclose > HAopen then Color.GREEN else color.RED);
plot HAMA = Average(HAclose, length);

#### mc01439

##### Well-known member
2019 Donor
VIP
There is small bug here (uses close isntead of haclose). Anyhow this HA code works better than one I was using before. Integrated it with my transition code
https://tos.mx/aA77lzO

MBF

#### tenacity11

##### Active member
2019 Donor
This is a comparison I did using the HA_MA 10 with the VWMA 10
The green line is the HA_MA and the cyan/brn line is the VWMA

H

#### HighBredCloud

##### Well-known member
VIP
following this...From my testing thus far of various SuperTrends...its hard to beat good ole Heikin Ashi...What I am wondering about tho is if anyone was able to make a SuperTrend based on Heikin Ashi but to use regular candles? I have seen many that overlap regular candles with Heikin Ashi candles...but that's not the same as Heikin Ashi trend on regular candles...

T

#### tomsk

##### Well-known member
VIP
@HighBredCloud Per your request here's a version of SuperTrend using Heiken Ashi from Mobius. Please enjoy this!

# Mobius
# SuperTrend HeikenAshi
# V03.10.2015
# Up = (HIGH + LOW) / 2 + Multiplier * ATR
# Down = (HIGH + LOW) / 2 – Multiplier * ATR
# When the change of trend occurs, the indicator flips

input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;
input PaintBars = yes;
input BubbleOn = no;
input ShowLabel = no;
input PlotLine = no;

def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close) / 2);
HAhigh = Max(high, close[1]);
HAlow = Min(low, close[1]);
haclose = (HAopen + HAclose[1] + HAlow + close) / 4;
def v = volume;
def bar = barNumber();
def EOD = if SecondsTillTime(1545) == 0 and
SecondsFromTime(1545) == 0
then 1
else 0;
def NotActive = if SecondsFromTime(1545) > 0
then 1
else 0;
def ATR = MovingAverage(AvgType, TrueRange(HAhigh, HAclose, HAlow), nATR);
def UP = HL2 + (AtrMult * ATR);
def DN = HL2 + (-AtrMult * ATR);
def ST = if close < ST[1]
then Round(UP / tickSize(), 0) * tickSize()
else Round(DN / tickSize(), 0) * tickSize();
plot SuperTrend = ST;
SuperTrend.SetHiding(!PlotLine);
SuperTrend.AssignValueColor(if close < ST then Color.RED else Color.GREEN);
SuperTrend.SetPaintingStrategy(PaintingStrategy.Line);
AssignPriceColor(if PaintBars and close < ST
then Color.RED
else if PaintBars and close > ST
then Color.GREEN
else Color.CURRENT);
plot ST_point = if isNaN(close[-1])
then ST
else double.nan;
ST_point.SetStyle(Curve.Points);
ST_point.SetLineWeight(3);
ST_point.SetDefaultColor(Color.Yellow);
# End Code SuperTrend HeikenAshi

H

#### HighBredCloud

##### Well-known member
VIP
@tomsk woah...OK this is interesting...I will be testing this out! Thank You!