I have built an indicator that renders a status line without any formatting. For example, 100M is displayed as "100000000". How can I format the status line so it is displayed as "100.0M"?
I tried entering it into ChatGPT and the answers caused more errors. Here's some of the output it provided ... nonsense:
indicator("Test Indicator", overlay=false)
annualRevenue = input(100000000, "Annual Revenue")
formattedRevenue = str.format("{0:.1f}M", annualRevenue / 1000000)
// Set indicator's title and subtitle
indicator_title = "Test Indicator"
indicator_subtitle = "Annual Revenue: " + formattedRevenue
study(title = indicator_title, shorttitle = indicator_title, overlay = false)
label.new(x=bar_index, y=na, text=indicator_subtitle, style=label.style_none)
Thanks for your help!