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
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
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
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
VIP
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

HighBredCloud

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

Top