-1

Can anyone kindly tell me what im doing wrong when I try to merge two Indicators on Tradingview? One indicator code is V5 and the other is V1. Why is it not possible to merge them into one indicator? I have no idea what I'm doing as I'm new to all this. Below are the codes for both indicators that I am copy-pasting with all the logic that was written so far.

//@version=5

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

indicator(title='SUPER TREND CANDLES', overlay=true, shorttitle='STC')
src = close
len = input.int(8, minval=1, title='Length')
up = ta.rma(math.max(ta.change(src), 0), len)
down = ta.rma(-math.min(ta.change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)

//coloring method below``
src1 = close
len = input.int(8, minval=1, title='Length')
src2 = close
len2 = input.int(50, minval=1, title='DownLevel')
   rsi > len1
isdown() =>
   rsi < len2
isdown_1 = isdown()
barcolor(isup() ? color.green : isdown_1 ? color.red : an)

//study('buy/sell arrows', overlay=true)

out = ta.sma(close, 50)
data = rsi > len1 ? open[1] > close[1] ? close > open ? close >= open[1] ? close[1] >= open ? close - open > open[1] - close[1] ? high > out : na : na : na : na : na : na
data1 = rsi < len2 ? close[1] > open[1] ? open > close ? open >= close[1] ? open[1] >= close ? open - close > close[1] - open[1] ? low < out : na : na : na : na : na : an


ema1 = input(34, minval=1, maxval=300, title="EMA UpTrend")
shema = input(true, title="Show EMA Trend is Based On?")

usedEma = ema(close, ema1)

emaUpColor() => hlc3 >= usedEma
emaDownColor() => hlc3  < usedEma


col = hlc3  >= usedEma ? lime : hlc3  < usedEma ? red : white

barcolor(emaUpColor() ? lime: emaDownColor() ? red : an)
plot(shema and usedEma ? usedEma : na, title="EMA", style=line, linewidth=3, color=col

When I try to merge these two code to a single indicator I get the following error....

Add to Chart operation failed, reason: line 34: The arguments 'maxval', 'minval', and 'step' cannot be used with the input() function. You can use the input.int() or input.float() functions to specify a range of input data values.

Pls help me solve this before I start breaking my computer. Thanks guys.

1 Answers1

0

The error message is telling you the solution. If you want to use minval or maxval arguments, you cannot use the plain input() function.

You should use input.int() or input.float() instead.

ema1 = input.int(34, minval=1, maxval=300, title="EMA UpTrend")

vitruvius
  • 15,740
  • 3
  • 16
  • 26