Draw high low wick high and low of a particular candle

mii

Member
VIP
Hi,

I am trying to draw lines on smaller aggregation based on higher aggregation candles.
Basically i want to input bar number and aggregation on the study and it should draw the lines on smaller aggregation.
I tried the code below and it doesnt draw anything on any aggregation chart

def barnum = if BarNumber() == 4 then hl2("SPY", AggregationPeriod.HOUR)else double.nan;
plot x = barnum;
x.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

I also tried using below line with barnumber. it doesnt work .
secondsFromTime(1200) >= 0
&& secondsFromTime(1330) <= 0;#

Please correct the code. Thank you.
 
Solution
Hi,

I am trying to draw lines on smaller aggregation based on higher aggregation candles.
Basically i want to input bar number and aggregation on the study and it should draw the lines on smaller aggregation.
I tried the code below and it doesnt draw anything on any aggregation chart

def barnum = if BarNumber() == 4 then hl2("SPY", AggregationPeriod.HOUR)else double.nan;
plot x = barnum;
x.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

I also tried using below line with barnumber. it doesnt work .
secondsFromTime(1200) >= 0
&& secondsFromTime(1330) <= 0;#

Please correct the code. Thank you.

what are 'the lines' you are talking about?

your first code works. it plots a line just on 1 bar.
it may be hard to see a 1...
Hi,

I am trying to draw lines on smaller aggregation based on higher aggregation candles.
Basically i want to input bar number and aggregation on the study and it should draw the lines on smaller aggregation.
I tried the code below and it doesnt draw anything on any aggregation chart

def barnum = if BarNumber() == 4 then hl2("SPY", AggregationPeriod.HOUR)else double.nan;
plot x = barnum;
x.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

I also tried using below line with barnumber. it doesnt work .
secondsFromTime(1200) >= 0
&& secondsFromTime(1330) <= 0;#

Please correct the code. Thank you.

what are 'the lines' you are talking about?

your first code works. it plots a line just on 1 bar.
it may be hard to see a 1 bar line

below is an image from SPY 15min chart

i added a bubble to verify a number. it has a number on bar #4.

Code:
#mtf_hl2_lines

def na = double.nan;
def bn = barnumber();

def barnum = if bn == 4 then hl2("SPY", AggregationPeriod.HOUR) else na;
plot x = barnum;
x.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

addchartbubble(0,low,
bn + "\n" +
barnum
, color.yellow, no);
#
 

Attachments

  • img1.JPG
    img1.JPG
    53.7 KB · Views: 19
Solution
it has to take 1 hour chart high and low of the candle along with candle body open and candle body close levels on 1 minute chart. is this possible?
I tried the code with the bubble,it is showing on hourly chart but need it on 1 minute chart
The picture shows the 1 hour candle 10 am to 11:am high and closes, these high or low lines needs to be drawn on 1 minute chart as well
View attachment 24285

Sorry for the confusion, i still dont see the bubble. earlier i have someother study that was showing a bubble. i removed all the studies and only have this one but still it doesnt show.
 
Last edited:

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