I need help in getting the highest point of biggest candle in a particular time range of any previous session irrespective of my current session.
Asked
Active
Viewed 491 times
1 Answers
0
You can take compare the current time t to input session range. If it is within session then keep saving the higher highs in a variable and plot it in a line.
//@version=5
indicator('Highest High of Previous Session', overlay=true,max_lines_count=500)
i_sess = input.session("1300-1700", "Session")
t = time(timeframe.period, i_sess)
var line l= na
var hi=-99999.0
var issessionend=false
var maxcandlength=0.0
if time==t
if issessionend
hi:=high
maxcandlength:=high-low
issessionend:=false
l:=line.new(bar_index,hi,bar_index,hi,color=color.blue)
if maxcandlength<high-low
hi:=high
maxcandlength:=high-low
line.set_x1(l,bar_index)
line.set_y1(l,hi)
line.set_y2(l,hi)
line.set_x2(l,bar_index)
else
issessionend:=true
bgcolor(time==t?color.new(color.blue,95):na)

Rohit Agarwal
- 1,258
- 1
- 3
- 9
-
bro you just didn't understood my question – ali hassan Jul 21 '22 at 10:36
-
can you explain bit more in question with image marked with what should be shown – Rohit Agarwal Jul 21 '22 at 10:40
-
https://ibb.co/dWn4nhw For example in this image green area is particular given date and time. and red circle is high point of "biggest" candle in this particular given date and time area (green area) and white line is drawn automatically on highest point of that candle. – ali hassan Jul 21 '22 at 13:53
-
And another way of doing that can be "without taking date and time draw a horizontal line on high point of biggest candle in last 52 candles of chart which is opened." – ali hassan Jul 21 '22 at 13:58
-
bro it is working very well but there are 2 things missing in it 1.) time input with date please so i can select bigger time frame 2.) i need line at high of biggest candle in that timeframe not in high point of that timeframe – ali hassan Jul 21 '22 at 14:54
-
https://ibb.co/ChcR87p As you can see in this pic blue line is at high point of green area but i want blue line at high point of biggest candle in this green area (call that green area timeframe or session) – ali hassan Jul 21 '22 at 15:02
-
And please do timeframe like this so i can select big times https://ibb.co/7yghbwj – ali hassan Jul 21 '22 at 15:10
-
i have edited answer to show biuggest candle high, please hire me from on fiverr for further changes (link in my profile) – Rohit Agarwal Jul 21 '22 at 17:15