Displaying wicks values on the candles

us3r001

New member
Hey, if it's not too much I'd ask your help for this study.
I'd like to see the value of the wicks (high and low values of a candle) painted on the chart for the last 3 candles.

Goat Mobius came up with these lines:

input n = 3;

def x = barNumber();

def x0 = if(isNaN(close[-1]) and !isNaN(close), x, x0[1]);

def xn = highestAll(x0) - (n-1);

def wick = high - Max(close, open);

plot data = if(x >= xn, wick, double.nan);

data.SetPaintingStrategy(PaintingStrategy.Values_Above);


Unfortunately, it looks like this : https://ibb.co/RjvC1qR
I like very much the numbers on top (avoiding labels).
A) But I see only one bar wick as correct, the first one.
B) Also, I'd like to display the down wicks too.

Thank you all )
 
Hey, if it's not too much I'd ask your help for this study.
I'd like to see the value of the wicks (high and low values of a candle) painted on the chart for the last 3 candles.

Goat Mobius came up with these lines:

input n = 3;

def x = barNumber();

def x0 = if(isNaN(close[-1]) and !isNaN(close), x, x0[1]);

def xn = highestAll(x0) - (n-1);

def wick = high - Max(close, open);

plot data = if(x >= xn, wick, double.nan);

data.SetPaintingStrategy(PaintingStrategy.Values_Above);


Unfortunately, it looks like this : https://ibb.co/RjvC1qR
I like very much the numbers on top (avoiding labels).
A) But I see only one bar wick as correct, the first one.
B) Also, I'd like to display the down wicks too.

Thank you all )


this version will display wick heights for the top and bottom wicks.
there is a test bubble you can turn on to see the full value.
some prices are at 3 or 4 decimal places.
the values above/below round numbers to 2 digits, so they may not display the numbers you expect.
i changed the code so it isn't complex.


Code:
# last_ xbars_wick_hts

#https://usethinkscript.com/threads/displaying-wicks-values-on-the-candles.15447/
#Displaying wicks values on the candles
# Mobius - original code

input n = 3;
def bn = barNumber();
def na = double.nan;
def x = (!isNaN(close[0]) and isNaN(close[-n]));
#def bodytop = max(close, open);
def topwick = high - Max(close, open);
def botwick = Min(close, open) - low;
plot topdata = if(x, topwick, na);
topdata.SetPaintingStrategy(PaintingStrategy.Values_Above);
topdata.setdefaultcolor(color.white);
plot botdata = if(x, botwick, na);
botdata.SetPaintingStrategy(PaintingStrategy.Values_below);
botdata.setdefaultcolor(color.white);

#-------------------------
input test_bubbles = no;
addchartbubble(test_bubbles and x, low*0.999,
topwick + "\n" +
botwick
, color.yellow, no);
#
 
I tweaked this way.
I'd like to display 0.xx as .xx , but I'm quite fine now.
Thanks to you and Mobius for the heavy lifting.



input n = 3;
def bn = barNumber();
def na = double.nan;
def x = (!isNaN(close[0]) and isNaN(close[-n]));
#def bodytop = max(close, open);
def topwick = high - floor(high) ;
def botwick = low - floor(low) ;
plot topdata = if(x, topwick, na);
topdata.SetPaintingStrategy(PaintingStrategy.Values_Above);
topdata.setdefaultcolor(color.white);
plot botdata = if(x, botwick, na);
botdata.SetPaintingStrategy(PaintingStrategy.Values_below);
botdata.setdefaultcolor(color.white);
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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