Carlos Romero
Carlos Romero

Reputation: 13

Regular session High Low Midline (50%) plus 25 and 75 percent lines

I am using a script that shows the regular trading day high, low and midline (50%). I am trying to include a 25% and 75% line in there as well but I am getting a Compilation error. Line 16: Cannot call 'operator +' with argument 'expr1'='m'. An argument of 'plot' type was used but a 'series float' is expected line 17: Cannot call 'operator +' with argument 'expr1'='m'. An argument of 'plot' type was used but a 'series float' is expected.

I have no clue how to go about this. Can anyone help please?

//@version=5

indicator("test 25 75 Regular Session High Low Mid", overlay=true)


D_High = request.security(syminfo.tickerid, 'D', high, lookahead = barmerge.lookahead_on) 
D_Low = request.security(syminfo.tickerid, 'D', low, lookahead = barmerge.lookahead_on) 

var float m = na

plot(timeframe.isintraday ? D_High : na, title="Reg Sess High", style=plot.style_circles, color=#ff0000,linewidth=1)
m = plot((D_High + D_Low) / 2, title="Reg Sess Mid", style=plot.style_circles, color=#ffeb3b, linewidth=1)
plot(timeframe.isintraday ? D_Low : na, title="Reg Sess Low", style=plot.style_circles, color=#ff0000,linewidth=1) 
s = plot((D_High + m) / 2, title="Reg Sess 75%", style=plot.style_circles, color=#ffeb3b, linewidth=1)
q = plot((D_Low + m) / 2, title="Reg Sess 25%", style=plot.style_circles, color=#ffeb3b, linewidth=1)

Upvotes: 1

Views: 311

Answers (1)

Bjorn Mistiaen
Bjorn Mistiaen

Reputation: 6905

//@version=5
indicator("test 25 75 Regular Session High Low Mid", overlay=true)

[D_High, D_Low, D_50, D_75, D_25] = request.security(syminfo.tickerid, 'D', [high, low, hl2, (high+hl2)/2, (low+hl2)/2], lookahead = barmerge.lookahead_on) 

plot(timeframe.isintraday ? D_High : na, title="Reg Sess High", style=plot.style_circles, color=#ff0000, linewidth=1)
plot(timeframe.isintraday ? D_50   : na, title="Reg Sess Mid",  style=plot.style_circles, color=#ffeb3b, linewidth=1)
plot(timeframe.isintraday ? D_Low  : na, title="Reg Sess Low",  style=plot.style_circles, color=#ff0000, linewidth=1) 
plot(timeframe.isintraday ? D_75   : na, title="Reg Sess 75%",  style=plot.style_circles, color=#ffeb3b, linewidth=1) 
plot(timeframe.isintraday ? D_25   : na, title="Reg Sess 25%",  style=plot.style_circles, color=#ffeb3b, linewidth=1) 

Upvotes: 1

Related Questions