# Determine the size of a candle vs average candle size?

#### lee-I-O=coke-A

##### Member
Is there a way to determine the size of a candle, example the candle might be 10x the size of majority candles

I don't know if there is additional info needed.

Your help would be deeply appreciated

Last edited by a moderator:
Code for ya:

Code:
``````declare upper;

input ThresholdMult = 3;
input LookbackLength = 10;

def AverageOverRange = SImpleMovingAvg(price = (high[1] - low[1]), length = lookbackLength);

def CurrentRange = high - low;

plot tallCandle = if CurrentRange >= (AverageOverRange * ThresholdMult) then 1 else double.nan;

AssignPriceColor(if tallCandle then COLOR.MAGENTA else Color.CURRENT);``````

Hope that gets you close to what you were looking for.

-mashume

Last edited:
3 questions please. what does thresholdmult do?
2nd what does lookbacklength do?
3rd Is there a way to scan for a candle say 5x the average candle size.
thank you, i appreciate it.

3 questions please. what does thresholdmult do?
2nd what does lookbacklength do?
3rd Is there a way to scan for a candle say 5x the average candle size.
thank you, i appreciate it.
thresholdMult is the relative size of the candle you're looking for. The default setting is 3, so that would be 3x the size of the average candle... which brings us to:
LookbackLength, which is the period of time over which the candle sizes are averaged for comparison. I set a default at 10, so that the script will tell you, at default settings, whether the current candle is 3x larger (high to low) than the average of the proceeding 10 candles.
I modified the code above slightly from yesterday, as I thought that perhaps the most recent candle should NOT be included in the average.
I also threw in a plot so that a scan could be done.

Code:
``TallCandles("threshold mult" = 5, "lookback length" = 30)``
This returned 249 stocks this morning

The study, of course, must be named TallCandles for that to work. ;-)

declare upper; input ThresholdMult = 3; input LookbackLength = 10; def AverageOverRange = SImpleMovingAvg(price = (high[1] - low[1]), length = lookbackLength); def CurrentRange = high - low; plot tallCandle = if CurrentRange >= (AverageOverRange * ThresholdMult) then 1 else double.nan; AssignPriceColor(if tallCandle then COLOR.MAGENTA else Color.CURRENT);

Mashume, thank you very much I appreciate it. To tell you the truth, I fairly new at this, the doctors say that this helps my memory, and keeps my mind active. I truly lost my memory 15 years. It took 6 weeks for me to learn a sentence. Till this day the doctors have said I only have 70%I use of what I was capable of. You are my savior.

What you supplied to me was great.

Is it possible add to the scan to include:
1st - to have 2 large RED candles back to back.
2nd - the 2 large RED candles are within the last 10 current candles

Mashume, thank you very much I appreciate it. To tell you the truth, I fairly new at this, the doctors say that this helps my memory, and keeps my mind active. I truly lost my memory 15 years. It took 6 weeks for me to learn a sentence. Till this day the doctors have said I only have 70%I use of what I was capable of. You are my savior.

What you supplied to me was great.

Is it possible add to the scan to include:
1st - to have 2 large RED candles back to back.
2nd - the 2 large RED candles are within the last 10 current candles

2 large red candles back to back. 2 red candles back to back is relatively simple:
Code:
``````BigCandles("threshold mult" = 5, "lookback length" = 30)
and
close < close[1] < close[2] within 10 bars``````

I'm not sure quite what your definition of large is here. But this may help a bit.

-mashume

2 large red candles back to back. 2 red candles back to back is relatively simple:
Code:
``````BigCandles("threshold mult" = 5, "lookback length" = 30)
and
close < close[1] < close[2] within 10 bars``````

I'm not sure quite what your definition of large is here. But this may help a bit.

-mashume

@mashume I'm trying to figure the scanner portion of this and I can't...is this a complete scan code or does anything else goes after or before this? I get an error...

@mashume I'm trying to figure the scanner portion of this and I can't...is this a complete scan code or does anything else goes after or before this? I get an error...

The code is up in post # 2. Copy / paste into a new indicator, or use the link below, but...

Name the indicator "BigCandles" and all should be well with the world.

https://tos.mx/oh4MmUG

-mashume

The code is up in post # 2. Copy / paste into a new indicator, or use the link below, but...

Name the indicator "BigCandles" and all should be well with the world.

https://tos.mx/oh4MmUG

-mashume
LOL...all is not well in my world...I saved the code from post #2 as a study. It does plot the Magenta Candles...on stocks that were pulled up by my other scanners.

What I don't understand is post #4 and post #7 conditions for the scanner. The link you shared is for the study...which the study plots with no issues...But how do I apply the conditions from post #4 and #7 to the actuals scanner?

The link is essentially this what is found in post #2:

Code:
``````declare upper;

input ThresholdMult = 3;

input LookbackLength = 10;

def AverageOverRange = SImpleMovingAvg(price = (high[1] - low[1]), length = lookbackLength);

def CurrentRange = high - low;

plot tallCandle = if CurrentRange >= (AverageOverRange * ThresholdMult) then 1 else double.nan;

AssignPriceColor(if tallCandle then COLOR.MAGENTA else Color.CURRENT);``````

But where does this go?

Code:
``````BigCandles("threshold mult" = 5, "lookback length" = 30)
and
close < close[1] < close[2] within 10 bars``````

When I just scanned using the link...and essentially the code from post #2 only 1 result came up. The only other conditions that I set was LAST \$15 and average daily volume of 500k...you had over 240 results...

LOL...all is not well in my world...I saved the code from post #2 as a study. It does plot the Magenta Candles...on stocks that were pulled up by my other scanners.

What I don't understand is post #4 and post #7 conditions for the scanner. The link you shared is for the study...which the study plots with no issues...But how do I apply the conditions from post #4 and #7 to the actuals scanner?

When I just scanned using the link...and essentially the code from post #2 only 1 result came up. The only other conditions that I set was LAST \$15 and average daily volume of 500k...you had over 240 results...
Don't worry.

I was probably trolling OTC penny equities before running that scan. Or I had set something else...

Last edited by a moderator:
mashume. Thanks for everything. Is there anything I can do for you?

Hi @mashume, I am looking for an indicator that simply alerts using an arrow, either up (for green candle) or red (for red candle) on candles greater than or = to 3. Does this thresholdMult code work for that or is there something else? Would appreciate any help. Thanks!

@Andygray8 I haven't looked at this code in a long time, but here goes:
Code:
``````declare upper;

input ThresholdMult = 3;
input LookbackLength = 10;

def AverageOverRange = SimpleMovingAvg(price = (high[1] - low[1]), length = lookbackLength);

def CurrentRange = high - low;

def tallCandle = if CurrentRange >= (AverageOverRange * ThresholdMult) then 1 else double.nan;

plot TallUpCandle = if tallCandle and Close > Open then 1 else double.nan;
TallUpCandle.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

plot TallDnCandle = if tallCandle and Close < Open then 1 else double.nan;
TallDnCandle.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);``````

Mashume

@Andygray8 You can also try this code:

Code:
``````# Big Candles
# Assembled by BenTen at UseThinkScript.com

input barHeight = 5;

def bigUp = close > open and high-low > barHeight;
def bigDown = close < open and high-low > barHeight;

plot upCandle = bigUp;
upCandle.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
upCandle.SetLineWeight(1);
upCandle.AssignValueColor(COLOR.CYAN);
plot downCandle = bigDown;
downCandle.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
downCandle.SetLineWeight(1);
downCandle.AssignValueColor(COLOR.MAGENTA);``````

@BenTen You's a straight up gangster thanks Ben!

@Andygray8 You can also try this code:

Code:
``````# Big Candles
# Assembled by BenTen at UseThinkScript.com

input barHeight = 5;

def bigUp = close > open and high-low > barHeight;
def bigDown = close < open and high-low > barHeight;

plot upCandle = bigUp;
upCandle.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
upCandle.SetLineWeight(1);
upCandle.AssignValueColor(COLOR.CYAN);
plot downCandle = bigDown;
downCandle.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
downCandle.SetLineWeight(1);
downCandle.AssignValueColor(COLOR.MAGENTA);``````
Hey Ben how would one go about putting this ema touch scanner query into a watchlist indicator?

def EMA = ExpAverage(close, 8);
plot scan = between(close, EMA-0.50, EMA+0.50);

Is there a way to determine the size of a candle, example the candle might be 10x the size of majority candles

I don't know if there is additional info needed.

Your help would be deeply appreciated

short code way
Code:
``ATR("length" = 1)> ATR("length" = 15)*10``

short code way
Code:
``ATR("length" = 1)> ATR("length" = 15)*10``
Hi @XeoNoX how should that be added to the code that BenTen wrote, because BenTen defines the candleheight with input barHeight = 5; how to use your code so the code looks to average in comparison with the other candles?

Last edited:

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