♥ 0 |
Hi, Pete: is there a way to change how date labels appear? here’s a bit of code: # Prior date of indicator change The output from this is, for example: 20211216.00. It’d be much easier for my wee brain to sort it out if it read: 2021_12_16. Or even better: 12_16_2021. Or similar. Possible? Thanks. Keep up the awesome work!
Marked as spam
|
Private answer
The following solution has been submitted to me via email. The person presenting the solution was not able to log in and post the solution so I am doing it on their behalf.
Marked as spam
|
|
Private answer
There was a typo in your question title so I had to correct that. While making the correction I also decided to replace the title with one that more closes describes your request. These changes also break the original URL of the question you posted. So everyone that has subscribed to receive notifications of new posts will not be able to view your new question. Please be very careful when forming your question titles. They are probably the most important detail to include because it impacts the ability of the rest of our viewers to search for and locate your post. Now on to your question. This is yet one more variation of a question that has been asked repeatedly in this forum. How to display a user friendly date value in a chart label or a watchlist column. There are no easy solutions. The Thinkorswim language lacks any of the functions or data objects available in other languages to work with strings and dates. We cannot parse strings, nor can we format date objects. The following link provides the full list of functions available for working with dates on Thinkorswim: https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Date---Time You may find that you can concatenate several different data functions to assemble something that loosely resembles what you have requested. But it's not simple and would me much longer than the brief 15 minutes I allow for free solutions in the Q&A forum. Here is one example of concatenating the year with the month:
It is far from perfect, the year will include a comma. Once again, we cannot do anything about that in Thinkorswim because it lacks any string parsing functions. You can apply a function named "AsText()", however this will only remove the comma and add a decimal point and 2 zeros to the end of the year. This is "as good as it gets". Until the developers of Thinkorswim are sufficiently funded to finish building out their scripting language. And that will never happen if none of the users of Thinkorswim take the time to submit feature requests and demand important functionality such as parsing strings and formatting date/time values. Marked as spam
|
Please log in to post questions.