2

Is it possible to convert String into Float or int in PineScript?

We can use str.tostring to convert float to string, but is there a way to go from string to float or int?

I want to try this as a workaround to offset value to the left. As I cant find a way to offset a value to the left, only to the right, I would like to see If I can achieve it by going from Float to String in July/2021 and from String to Float in May/2021.

Lenon Fernandes
  • 33
  • 1
  • 1
  • 5

1 Answers1

7

There is a built-in function for that in Pine v5. See str.tonumber()
It was also already there in Pine v4. See tonumber()

Bjorn Mistiaen
  • 6,459
  • 3
  • 18
  • 42