Skip to content
Algo Trade Analytics Docs

str.contains() - Pine Script Function

Returns true if the source string contains the str substring, false otherwise.

str.contains(source, str) → const bool
NameTypeDescription
sourceconst stringSource string.

True if the str was found in the source string, false otherwise.

//@version=6
indicator("str.contains")// If the current chart is a continuous futures chart, e.g “BTC1!”, then the function will
return true, false otherwise.var isFutures = str.contains(syminfo.tickerid, "!")
plot(isFutures ? 1 : 0)