Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 230

PineScript : const bool

$
0
0

Why does this code run:

// @version=5indicator(title="MA 1D", shorttitle="MA 1D", overlay=true) //, timeframe = "60", timeframe_gaps = false )var Grp_MA = "Using Moving Average on \"close\" source"int MAlength = input.int(3, minval=1, title="MA Length", group=Grp_MA, inline=Grp_MA)bool _display_MAlines = input.bool(title = "Display MA 1D lines", defval = false, group=Grp_MA)float MALine = request.security(syminfo.tickerid, "1D", ta.sma(close, MAlength))plot(MALine, title="MA Line", color=color.rgb(0, 255, 0), linewidth=1, style=plot.style_line, display= _display_MAlines ? display.pane : display.none )

but not this code?

// @version=5indicator(title="MA 1D", shorttitle="MA 1D", overlay=true) //, timeframe = "60", timeframe_gaps = false )get_parameters() =>    var Grp_MA = "Using Moving Average on \"close\" source"    int MAlength = input.int(3, minval=1, title="MA Length", group=Grp_MA, inline=Grp_MA)    bool _display_MAlines = input.bool(title = "Display MA 1D lines", defval = false, group=Grp_MA)    [MAlength, _display_MAlines][MAlength, _display_MAlines] = get_parameters()float MALine = request.security(syminfo.tickerid, "1D", ta.sma(close, MAlength))plot(MALine, title="MA Line", color=color.rgb(0, 255, 0), linewidth=1, style=plot.style_line, display= _display_MAlines ? display.pane : display.none )

Cannot call 'operator ?:' with argument 'expr0'='_display_MAlines'. An argument of 'simple bool' type was used but a 'const bool' is expected.

I can not find the way to fix the 'const bool'.I tried to used const at different places but it does not seem declared on PineScript,

I also tried different variants like using another bool after the input.bool or before the plot line,


Viewing all articles
Browse latest Browse all 230

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>