'An argument of 'series string' type was used but a 'simple string' is expected when comparing close and vwap

When trying this code:

strategy.risk.allow_entry_in(close > ta.vwap(hlc3) ? strategy.direction.long : strategy.direction.short)

I get this error:

An argument of 'series string' type was used but a 'simple string' is expected

It happens from this:

close > ta.vwap(hlc3)

I am just trying to say that it should return true if the close is above vwap. What am I doing wrong here?

Sorry I'm new to pine and this is my first script.



Solution 1:[1]

simple string means the variable's value should never change during the execution of the script.

You are passing your parameter with the ternary operator so its return value can change.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vitruvius