简体   繁体   中英

Trading View Pinescript v5 : Hline not plotting inside indicator

Hline not plotting inside indicator.

All conditions are met.

What is simple float? How do i solve the issue

//@version=5

indicator(title='RSI_RS horizontal', shorttitle='RSI_RS horizontal', overlay=false, format=format.price)

rsi = ta.rsi(close, 14)

//RSI PLOT
plot(rsi, title='RSI', style=plot.style_line, linewidth=1, color=color.new(color.black, 0))


//====================================================================================
//HORIZONTAL MOVING LINES

//shortma = input(3, minval=2,type=input.integer, title="RSI MINI LENGTH")

horizontal = input.string(title='HORIZONTAL MOVING LINES TYPE', defval='60/40', options=['60/40', '80/40', '60/20', '80/20'])

var float top_h_line = 0.0
var float bottom_h_line = 0.0

if horizontal == '60/40'
    top_h_line := 60
    bottom_h_line := 40
else
    if horizontal == '80/40'
        top_h_line := 80
        bottom_h_line := 40
    else
        if horizontal == '80/20'
            top_h_line := 60
            bottom_h_line := 20
        else
            top_h_line := 80
            bottom_h_line := 20


hline(top_h_line)

//====================================================================================






ERROR: line 45: Cannot call 'hline' with argument 'price'='top_h_line'. An argument of 'simple float' type was used but a 'input float' is expected

It means that it's value must be known at compile time.

You can use the lines instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM