PineCoders Squawk Box
3.87K subscribers
60 photos
166 links
News & Tips on TradingView's Pine programming language
Download Telegram
🌲 #newfeature
You now have access to a monospace font in labels, boxes and tables with:

text_font_family = font.family_monospace
🛠 #fix
There was a problem with scripts using chart.left/right_visible_bar_time where if the indicator's scale was manually adjusted, it reverted to auto-scaling when the chart changed. Expected behavior was restored.
🛠 #fix
The ordering of scripts in your user profile's SCRIPTS tab was inadvertently changed a few days ago, which made them appear in latest updated order. The previous order by publication date was restored. Apologies for the inconvenience.
🛠 #fix
When a plot style was used and script users changed it in the "Style" tab, and then changed an input value, the plot's style was reset. This no longer happens.
🌲 #newfeature
The formatting of the Editor's console messages was streamlined and timestamps were added to them. Remember that you can click on error messages to bring you to the offending code in your script.
🌲 #newfeature
`str.format_time(time, format, timezone)` allows you to convert a Unix timestamp into a formatted string, while also allowing its translation to a timezone:

//@version=5
indicator("str.format_time")
if timeframe.change("1D")
// Time in exchange tz.
formattedTime1 = str.format_time(time, "yyyy-MM-dd HH:mm", syminfo.timezone)
// Time in UTC tz using `str.format()`.
formattedTime2 = str.format("{0,time,yyyy-MM-dd HH:mm}", time)
// Time in UTC tz using `str.format_time()`.
formattedTime3 = str.format_time(time, "yyyy-MM-dd HH:mm", "UTC")
label.new(bar_index, high, formattedTime1 + "\n" + formattedTime2 + "\n" + formattedTime3)
🛠 #fix
math.round_to_mintick() used to return zero when used on na values. It now returns na in those cases.
🌲 #newfeature
The editor now has code snippets to help you with a few common constructs such as if, switch, for and while. More are planned.
🌲 #newfeature
When opening your script in a new window of the Editor, the size of the last-used window is remembered.
🌲 #newfeature
The Editor now has a "Settings" dialog box accessible from the "More" menu. Among other things, it allows you to disable autocomplete.
🌲 #newfeature
Pine Script now supports the equivalent of extension methods. Read about them in the usrman's new page on Pine methods.
🌲 #newfeature
A new `request.currency_rate()` function allows you to retrieve a rate to convert values between currencies.
🌲 #newfeature
The new array.every() and array.some() functions allow you to test if all or some elements of a "bool" array are true. They also work with "int" and "float" arrays.
💪 #tip
The "Strategy" section of the User Manual was vastly expanded. It contains much more details and code examples:
https://www.tradingview.com/pine-script-docs/en/v5/concepts/Strategies.html
🌲 #newfeature
In the Editor, you can now replace the "Add to chart" button with "Update on chart". This allows you to push changes to the chart's version of the script while creating only a minor revision number. Continue to use "Save" when you want to create a major revision.