Mismatched input 'end of line without line continuation' expecting '_'

Viewed 522

Trying to define what "dema" is. For some reason, it's giving me the error in the title. I know that means there is something wrong with indentations, but don't know where it's wrong. Would appreciate the help!

dema = (indicator(title="Double EMA", shorttitle="DEMA", overlay=true, timeframe="", timeframe_gaps=true)
    length = input.int(200, minval=1)
    src = input(close, title="Source")
    e1 = ta.ema(src, length)
    e2 = ta.ema(e1, length)
    dema = 2 * e1 - e2
    plot(dema, "DEMA", color=#43A047))
1 Answers

There are two problems with your code.

The first problem is that you are trying to assign everything to the first dema, because of that start ( and the end ). That is not the right syntax for a Pine Script. You can't assign an indicator to a variable.

dema = (indicator( ... color=#43A047))

The second problem is that you have TAB in your code. Pine script is syntax sensitive about tabs and you only use them at specific places.

carrots = 10
    apples = 5

The code that has the right syntax is:

//@version=5
indicator(title="Double EMA", shorttitle="DEMA", overlay=true, timeframe="", timeframe_gaps=true)
length = input.int(200, minval=1)
src = input(close, title="Source")
e1 = ta.ema(src, length)
e2 = ta.ema(e1, length)
dema = 2 * e1 - e2
plot(dema, "DEMA", color=#43A047)
Related