# Heiken Ashi Momentum Arrow UP/DOWN on Chart with no WICK

#### Montana101x

##### New member
Hello Everyone,
I was looking for Arrow signal on Heiken Ashi chart with no wick to give me confident for holding position to bigger move. I was unable to find it except on haha-tech forum but it was an incomplete code. Since i don't know coding and i can't figure it out but i will share the post link for anyone can crack the code for this strategy into scripting and thank you. https://www.hahn-tech.com/ans/scann...CQ_lcU5HWUFpT2jS60RL3ZQYhok0VNW5PjTkSPvpNHFkI

Solution
#Hi Montana101x, try the following.

def HAclose = ohlc4;
rec HAopen = compoundValue( 1, ( HAopen[1] + HAclose[1] ) / 2, HAclose );
def HAhigh = Max( high, Max( HAopen, HAclose ) );
def HAlow = Min( low, Min( HAopen, HAclose ) );
def haBuy = HAopen <= HAlow;
def haSell = HAopen >= HAhigh;
rec count=if haBuy==1 and count[1]==0 then 1 else if haSell==0 and count[1]>=1 then count[1]+1 else 0;
rec count1=if haSell==1 and count1[1]==0 then 1 else if haBuy==0 and count1[1]>=1 then count1[1]+1 else 0;
def PrimaryUP = if HAopen <= HAlow and habuy==1 and count[1]==0 then yes else no;
def PrimaryDOWN = if HAopen >= HAhigh and hasell==1 and count1[1]==0 then yes else no;

plot ArrowUp = if PrimaryUP then HAlow else Double.NaN...
#Hi Montana101x, try the following.

def HAclose = ohlc4;
rec HAopen = compoundValue( 1, ( HAopen[1] + HAclose[1] ) / 2, HAclose );
def HAhigh = Max( high, Max( HAopen, HAclose ) );
def HAlow = Min( low, Min( HAopen, HAclose ) );
def haBuy = HAopen <= HAlow;
def haSell = HAopen >= HAhigh;
rec count=if haBuy==1 and count[1]==0 then 1 else if haSell==0 and count[1]>=1 then count[1]+1 else 0;
rec count1=if haSell==1 and count1[1]==0 then 1 else if haBuy==0 and count1[1]>=1 then count1[1]+1 else 0;
def PrimaryUP = if HAopen <= HAlow and habuy==1 and count[1]==0 then yes else no;
def PrimaryDOWN = if HAopen >= HAhigh and hasell==1 and count1[1]==0 then yes else no;

plot ArrowUp = if PrimaryUP then HAlow else Double.NaN;
ArrowUp.SetDefaultColor(Color.Dark_Orange);
ArrowUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_Up);
ArrowUp.SetLineWeight(5);
ArrowUp.HideBubble();

plot ArrowDn = if PrimaryDOWN then HAhigh else Double.NaN;
ArrowDn.SetDefaultColor(Color.Dark_Orange);
ArrowDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
ArrowDn.SetLineWeight(5);
ArrowDn.HideBubble();
def shavenBottom = HAopen <= HAlow;
def shavenTop = HAopen >= HAhigh;

plot DotUp = if shavenBottom then HAlow * 0.999 else double.nan;
DotUp.SetPaintingStrategy(paintingStrategy.LINE_VS_POINTS);
DotUp.SetDefaultColor(CreateColor(40, 150, 100));
DotUp.SetLineWeight(4);
DotUp.HideBubble();
#DotUp.Hide();

plot DotDn = if shavenTop then HAhigh * 1.001 else double.nan;
DotDn.SetPaintingStrategy(paintingStrategy.LINE_VS_POINTS);
DotDn.SetDefaultColor(CreateColor(255, 20, 0));
DotDn.SetLineWeight(4);
DotDn.HideBubble();
#DotDn.Hide();

#Hi Montana101x, try the following.

def HAclose = ohlc4;
rec HAopen = compoundValue( 1, ( HAopen[1] + HAclose[1] ) / 2, HAclose );
def HAhigh = Max( high, Max( HAopen, HAclose ) );
def HAlow = Min( low, Min( HAopen, HAclose ) );
def haBuy = HAopen <= HAlow;
def haSell = HAopen >= HAhigh;
rec count=if haBuy==1 and count[1]==0 then 1 else if haSell==0 and count[1]>=1 then count[1]+1 else 0;
rec count1=if haSell==1 and count1[1]==0 then 1 else if haBuy==0 and count1[1]>=1 then count1[1]+1 else 0;
def PrimaryUP = if HAopen <= HAlow and habuy==1 and count[1]==0 then yes else no;
def PrimaryDOWN = if HAopen >= HAhigh and hasell==1 and count1[1]==0 then yes else no;

plot ArrowUp = if PrimaryUP then HAlow else Double.NaN;
ArrowUp.SetDefaultColor(Color.Dark_Orange);
ArrowUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_Up);
ArrowUp.SetLineWeight(5);
ArrowUp.HideBubble();

plot ArrowDn = if PrimaryDOWN then HAhigh else Double.NaN;
ArrowDn.SetDefaultColor(Color.Dark_Orange);
ArrowDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
ArrowDn.SetLineWeight(5);
ArrowDn.HideBubble();
def shavenBottom = HAopen <= HAlow;
def shavenTop = HAopen >= HAhigh;

plot DotUp = if shavenBottom then HAlow * 0.999 else double.nan;
DotUp.SetPaintingStrategy(paintingStrategy.LINE_VS_POINTS);
DotUp.SetDefaultColor(CreateColor(40, 150, 100));
DotUp.SetLineWeight(4);
DotUp.HideBubble();
#DotUp.Hide();

plot DotDn = if shavenTop then HAhigh * 1.001 else double.nan;
DotDn.SetPaintingStrategy(paintingStrategy.LINE_VS_POINTS);
DotDn.SetDefaultColor(CreateColor(255, 20, 0));
DotDn.SetLineWeight(4);
DotDn.HideBubble();
#DotDn.Hide();
Thank you so much. This's what it looks like on my chart

Last edited by a moderator:

Thank you too much and you guys are the BEST BEST BEST Thank you!!!

Looking for a script for when a heikin ashi candle closes flat bottom for the first time or flat top for the first time to give me an Arrow up or down, so I can easily spot a trend reversal.

Can the script be change so we get the arrow when candle closes flat top or flat bottom so we dont get fake outs. A lot of times we get arrows when candle opens then candle closes and arrow disappears. Thanks in advance!

Can the script be change so we get the arrow when candle closes flat top or flat bottom so we dont get fake outs. A lot of times we get arrows when candle opens then candle closes and arrow disappears. Thanks in advance!
Just wait until the candle closes. It is never wise to take a signal inter-bar!

Can the script be change so we get the arrow when candle closes flat top or flat bottom so we dont get fake outs. A lot of times we get arrows when candle opens then candle closes and arrow disappears. Thanks in advance!
The ToS syntax to look at the prior candle (the candle that is final) is [1]
Therefore, to get the arrow on the prior candle

change:
Code:
``plot ArrowUp = if PrimaryUP then HAlow else Double.NaN;``
to

Rich (BB code):
``plot ArrowUp = if PrimaryUP[1] then HAlow else Double.NaN;``

and this:
Code:
``plot ArrowDn = if PrimaryDOWN then HAhigh else Double.NaN;``
to

Rich (BB code):
``plot ArrowDn = if PrimaryDOWN[1] then HAhigh else Double.NaN;``

Last edited:
It looks like its right, I will see when market is open, thank you so much this is just what I was looking for.

Can a line be added to a heikin ashi flat top or flat bottom candle to this script as a sign of a stop loss. So when arrow shows up the line shows up as well, Im looking for line like in the fib reversal script, like this example. thank you so much in advance.

here.

87k+ Posts
321 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?