Nyle Samuels
Nyle Samuels

Reputation: 1

I'm writing Pine Script in Trading View but I keep getting this error

//Erroneous Script [diPlus, diMinus, adx] = ta.dmi(close, 14) //14-period length

This string was to replace a previous error where "ta.adx", is no longer in use in v6. Function is to reference Average Directional Index indicator, which is supposedly "built-in", but can't be found.

//Error Cannot call 'ta.dmi' with argument 'diLength'='close'. An argument of 'series float' type was used but a 'simple int' is expected.

The previous script apparently didn't have the correct use of ta.dmi() with price series and length.

Upvotes: -2

Views: 190

Answers (1)

vitruvius
vitruvius

Reputation: 21332

The first argument of the ta.dmi() is length which expects a simple int. You are using close which is series float for this parameter. That is what the error message is telling you.

You should be passing two simple ints.

For example:

[diplus, diminus, adx] = ta.dmi(14, 21)

Upvotes: 0

Related Questions