# Scan for no bottom wick candle no touching 5 ema

#### kabira

##### Member
min(open,close) == low and !between(expaverage(close,5),low,high) trying to convert this using HeinkenAshi instead of regular candle..

I am trying the below but not working. any advice how to fix it please.

def haClose = ohlc4;
def haOpen = if haOpen[1] == 0 then haClose[1] else (haOpen[1] + haClose[1]) / 2;
def haHigh = Max(high, Max(haClose, haOpen));
def haLow = Min(low, Min(haClose, haOpen));
min(haOpen,haClose) == haLow and !between(expaverage(close,5),haLow,haHigh)

Last edited by a moderator:
Solution
I am not very familiar with meme bars, but assuming that the rest of it is correct, my best guess would be this:

def haClose = ohlc4;
def haOpen = if haOpen[1] == 0 then haClose[1] else (haOpen[1] + haClose[1]) / 2;
def haHigh = Max(high, Max(haClose, haOpen));
def haLow = Min(low, Min(haClose, haOpen));
plot Scan = min(haOpen,haClose) == haLow and !between(expaverage(haClose,5),haLow,haHigh);

If not I can take a deeper look into it.

Works fine on my end. Are you showing the 5EMA of regular closes, or HA closes? That is likely where the discrepancy is.

#### Joshua

##### Well-known member
VIP
I am not very familiar with meme bars, but assuming that the rest of it is correct, my best guess would be this:

def haClose = ohlc4;
def haOpen = if haOpen[1] == 0 then haClose[1] else (haOpen[1] + haClose[1]) / 2;
def haHigh = Max(high, Max(haClose, haOpen));
def haLow = Min(low, Min(haClose, haOpen));
plot Scan = min(haOpen,haClose) == haLow and !between(expaverage(haClose,5),haLow,haHigh);

If not I can take a deeper look into it.

Works fine on my end. Are you showing the 5EMA of regular closes, or HA closes? That is likely where the discrepancy is.

#### kabira

##### Member
It is working. Thanks Joshua.

#### Betozenho

##### New member
Hey,
min(open,close) == low and !between(expaverage(close,5),low,high) trying to convert this using HeinkenAshi instead of regular candle..

I am trying the below but not working. any advice how to fix it please.

def haClose = ohlc4;
def haOpen = if haOpen[1] == 0 then haClose[1] else (haOpen[1] + haClose[1]) / 2;
def haHigh = Max(high, Max(haClose, haOpen));
def haLow = Min(low, Min(haClose, haOpen));
min(haOpen,haClose) == haLow and !between(expaverage(close,5),haLow,haHigh)
my friend, I’m looking for the same but regular candles, do you know how to do the code?

#### kabira

##### Member
Hey,

my friend, I’m looking for the same but regular candles, do you know how to do the code?
min(open,close) == low and !between(expaverage(close,5),low,high)

#### Betozenho

##### New member
Hey Kabira, thanks for your help my friend, if may I abuse a little more of your help, I saved this as study in my tos but its not showing any signal in my chart , do you know what I’m missing?

Thanks again!

#### kabira

##### Member
Put that in the study of the scan and you will get the results. It is a scan to find the stocks which is not touching 5 EMA not a study to put on chart,

Below is the code to put on chart

input length = 5;

plot ema = ExpAverage(close, length);

#AssignPriceColor(if low > ema then getColor(6) else if high < ema #then getColor(5) else getColor(7));

plot signalHigh = low > ema;
signalHigh.DefineColor("Above", GetColor(1));
signalHigh.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

plot signalLow = high < ema;
signalLow.DefineColor("Below", GetColor(2));
signalLow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

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