Determine the size of a candle vs average candle size?

lee-I-O=coke-A

New 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:

mashume

Well-known member
VIP
Lifetime
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:

mashume

Well-known member
VIP
Lifetime
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. ;-)
 

lee-I-O=coke-A

New member
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);
 

lee-I-O=coke-A

New member
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.

But can I ask you for some additional help.
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

Well-known member
VIP
Lifetime
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.

But can I ask you for some additional help.
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
 

HighBredCloud

Well-known member
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

Well-known member
VIP
Lifetime

HighBredCloud

Well-known member
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...
 

mashume

Well-known member
VIP
Lifetime
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...
5FUVRY7.png

RjUhhrh.png
 
Last edited by a moderator:

Andygray8

Member
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!
 

mashume

Well-known member
VIP
Lifetime
@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);

Happy Trading,
Mashume
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
@Andygray8 You can also try this code:

Code:
# Big Candles
# Assembled by BenTen at UseThinkScript.com
# Converted from https://www.tradingview.com/script/e2fWFUIo-Big-Candles-v1/

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);
 

Andygray8

Member
@Andygray8 You can also try this code:

Code:
# Big Candles
# Assembled by BenTen at UseThinkScript.com
# Converted from https://www.tradingview.com/script/e2fWFUIo-Big-Candles-v1/

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);

Appreciate any help you can provide and hopefully you had a great first week of trading this new year!
 

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

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?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top