Determine the size of a candle vs average candle size?

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:
@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);
Very cool @BenTen , how can you use this in the scanner so it shows the stocks with those long candles in last X amount of candles or something like that? Any idea?
 
Last edited:
@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
@mashume great code any idea how this code can be used in a scan to scan for example an x amount off candles on the chart , when I use init now it seems to only check the last candle stick on the chart , is there a way to scans for big candles in the last x amount of candles including after-hours and premarket ? Thanks for any help Im new to all this but its fun
 
perhaps this:
Code:
input bars_to_look_back = 3;
def TallDnCandle = if tallCandle and Close < Open then 1 else double.nan;
plot scan_result = if TallNdCandle == 1 within bars_to_look_back bars then 1 else double.nan;

But i'm not sure.

-mashume
 
input bars_to_look_back = 3; def TallDnCandle = if tallCandle and Close < Open then 1 else double.nan; plot scan_result = if TallNdCandle == 1 within bars_to_look_back bars then 1 else double.nan;
HI @mashume thanks for your reaction! Im really new to this so what I did was I took the code you wrote and placed it under the other code like below, but that gives some errors when I add a custom study in the scan. Any idea how I should place it? Thanks for any help :)

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

input bars_to_look_back = 3;
def TallDnCandle = if tallCandle and Close < Open then 1 else double.nan;
plot scan_result = if TallNdCandle == 1 within bars_to_look_back bars then 1 else double.nan;
 
@thinkandthink
I believe you're only allowed one plot in a scan script... others may know better (I don't use scans)
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);

input bars_to_look_back = 3;
def TallDnCandle = if tallCandle and Close < Open then 1 else double.nan;
plot scan_result = if TallNdCandle == 1 within bars_to_look_back bars then 1 else double.nan;

All I've done is comment out the extra two plot calls and the associated graphics settings for them (since you can't have that for a def statement.

I think this should be ok now, though it's Sunday and I won't start up ToS until just before globex hours begin for futures @3 pacific. :) Gotta stay sane.

-mashume
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
472 Online
Create Post

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.
Back
Top