Label to display wick%

vanwooten

New member
Brand new to this. The following script is intended to show a label to display a moving average of the wick percent of candles. It runs but it is clearly using the current candle only when it should use only the previous x number of candles (avglength). I clearly don't understand offset.

input avgType = averageType.Simple;
input avgLength = 5;
input avgOffset = 1;

def rg = absvalue(high - low);
def cb = absvalue(open - close);
Def wProp = ((rg-cb)/rg)*100;
def avg= movingaverage(avgType, wprop,avgLength)[avgOffset];

Addlabel( yes, "Wick%: " + wProp, Color.White );
 
Solution
I have this from another indicator I wrote up once upon a time:
Code:
declare upper;

input lookback = 5;
def range = high - low;
def body_top = max(open, close);
def body_bot = min(open, close);
def upper_wick = high - body_top;
def lower_wick = body_bot - low;

def upper_ratio = round(upper_wick / range * 100, 0);
def lower_ratio = round(lower_wick / range * 100, 0);

addLabel(yes, " LAST Upper Wick:  " + upper_ratio[1] + " %  vs  " + average(upper_ratio[1], lookback) + "   ", color.dark_green);
addLabel(yes, " LAST Lower Wick:  " + lower_ratio[1] + " %  vs  " + average(lower_ratio[1], lookback) + "   ", color.dark_red);

This one shows the last wick as a percentage vs the average percentage of the last n candles. It looks at the...
I have this from another indicator I wrote up once upon a time:
Code:
declare upper;

input lookback = 5;
def range = high - low;
def body_top = max(open, close);
def body_bot = min(open, close);
def upper_wick = high - body_top;
def lower_wick = body_bot - low;

def upper_ratio = round(upper_wick / range * 100, 0);
def lower_ratio = round(lower_wick / range * 100, 0);

addLabel(yes, " LAST Upper Wick:  " + upper_ratio[1] + " %  vs  " + average(upper_ratio[1], lookback) + "   ", color.dark_green);
addLabel(yes, " LAST Lower Wick:  " + lower_ratio[1] + " %  vs  " + average(lower_ratio[1], lookback) + "   ", color.dark_red);

This one shows the last wick as a percentage vs the average percentage of the last n candles. It looks at the previous candle though, not the current (as the current hasn't closed)

perhaps that helps you get where you want to go.

-mashume
 
Solution

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

I have this from another indicator I wrote up once upon a time:
Code:
declare upper;

input lookback = 5;
def range = high - low;
def body_top = max(open, close);
def body_bot = min(open, close);
def upper_wick = high - body_top;
def lower_wick = body_bot - low;

def upper_ratio = round(upper_wick / range * 100, 0);
def lower_ratio = round(lower_wick / range * 100, 0);

addLabel(yes, " LAST Upper Wick:  " + upper_ratio[1] + " %  vs  " + average(upper_ratio[1], lookback) + "   ", color.dark_green);
addLabel(yes, " LAST Lower Wick:  " + lower_ratio[1] + " %  vs  " + average(lower_ratio[1], lookback) + "   ", color.dark_red);

This one shows the last wick as a percentage vs the average percentage of the last n candles. It looks at the previous candle though, not the current (as the current hasn't closed)

perhaps that helps you get where you want to go.

-mashume
I actually love this wick% label as it relates to the previous candle. I am wondering is there a way to code an alert when the candle wick% closes above 50% in either direction??
 
Hello! Trying to develop a scan that returns instances when 1 candle back from current candle has a wick (top and/or bottom wick) that is greater than or equal to 3 times the size of the body.

Searching around, I found components that could possibly be a part of the script, but I have no idea how to integrate and do the wick/body comparison calculation:

Code:
def UpperWick = high - Max(open, close);
def LowerWick = Min(open, close) - low;

def CandleBody = bodyheight();
def range = High - low;
def cond = range == highest(range,x);

Would sure appreciate help with this. (p.s. I did see the Dec 4, 2022 post by 73maro, but couldn't see a solution in that for what I'm looking for, maybe I missed something).

Thanks!
 
from this post and modified:
https://usethinkscript.com/threads/label-to-display-wick.14130/

Code:
def range = high - low;
def body_top = max(open, close);
def body_bot = min(open, close);
def upper_wick = high - body_top;
def lower_wick = body_bot - low;

def upper_ratio = round(upper_wick / range * 100, 0);
def lower_ratio = round(lower_wick / range * 100, 0);

plot eureka = if upper_ratio >= 3.0 OR lower_ratio >= 3.0 then 1 else double.nan;

Or something like that... I've just whipped the last bit up here at UTS.

-mashume
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
461 Online
Create Post

Similar threads

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