Tradingview Pine Editor Error with ta macd

64 Views Asked by At

I'm trying to make a multi condition indicator/alert for my trading view account.

And i keep running into some issues. The error i keep getting is: 3:28:41 PM Error at 14:29 No value assigned to the siglen parameter in ta.macd()

Any help is appreciated. Thanks!

Here is my code:

//@version=5
indicator("My script")
plot(close)
//@version=5
indicator("Custom Forex Indicator", shorttitle="CFI", overlay=true, timeframe="5")

// MACD Signals
lengthMACD = input(12, title="MACD Length")

leng`your text`thSignal = input(9, title="Signal Length")

[macdLine, signalLine, _] = ta.macd(close, lengthMACD, lengthSignal)

isNewCandle = time[1] != time[0]

macdCrossOver = ta.crossover(macdLine, signalLine)

buySignalMACD = macdCrossOver and isNewCandle
sellSignalMACD = ta.crossunder(macdLine, signalLine) and isNewCandle

var bool buySignalMACDVar = na
var bool sellSignalMACDVar = na

buySignalMACDVar := buySignalMACDVar or (buySignalMACD and isNewCandle)
sellSignalMACDVar := sellSignalMACDVar or (sellSignalMACD and isNewCandle)

bgcolor(buySignalMACDVar ? color.new(color.green, 80) : na)
bgcolor(sellSignalMACDVar ? color.new(color.red, 80) : na)

plotarrow(buySignalMACDVar ? 1 : na, colorup=color.green)
plotarrow(sellSignalMACDVar ? -1 : na, colordown=color.red)

// Opening Candle Conditions
openingCandle = open[1] != open
openingCandleCondition = macdCrossOver and openingCandle

var bool openingCandleVar = na
openingCandleVar := openingCandleVar or (openingCandleCondition and isNewCandle)

bgcolor(openingCandleVar ? color.new(color.blue, 80) : na)
plotarrow(openingCandleVar ? 1 : na, colorup=color.blue)

// Schaff Trend Cycle Code
lengthSchaffTC = input(10, title="Schaff TC Length")

schaffTC = input(50, title="Schaff TC Value")  

buySignalSTC = close > schaffTC and isNewCandle
sellSignalSTC = close < schaffTC and isNewCandle

var bool buySignalSTCVar = na
var bool sellSignalSTCVar = na

buySignalSTCVar := buySignalSTCVar or (buySignalSTC and isNewCandle)
sellSignalSTCVar := sellSignalSTCVar or (sellSignalSTC and isNewCandle)

bgcolor(buySignalSTCVar ? color.new(color.green, 80) : na)
bgcolor(sellSignalSTCVar ? color.new(color.red, 80) : na)

plotarrow(buySignalSTCVar ? 1 : na, colorup=color.green)
plotarrow(sellSignalSTCVar ? -1 : na, colordown=color.red)

I've tried removing the 'ta.' but that isn't working

0

There are 0 best solutions below