29 June 2022

Snippet showing how to do division in PineScript. First I import close data from security, then divide the values by 1000 and print it out as a line on the chart. You can change the formula or use multiple securities at once as input. This is how you can "loop" through the series and change the value.

Source code viewer
  1. totllClose = request.security("FRED:TOTLL", timeframe.period, close)
  2. divideByThousand (x) => (x / 1000)
  3. plot(series=divideByThousand(totllClose))
Programming Language: Text