MichelT

Store several numbers in a string

A method to store a bunch of numbers in one string.

Using my method of translating a string to a number, we can put several values in one string and then pop them up when we need.

To store the values I use a semicolon as a separator, so the format of the string is next one:

NUMBER:NUMBER:NUMBER:NUMBER

I don't see any useful application of this method (maybe, to pass some additional info to the script in one string), but maybe it'll be helpful to someone.
Skript med en öppen källkod

I sann TradingView-anda har författaren till detta skript publicerat det som öppen källkod, så att handlare kan förstå och verifiera det. Skål för författaren! Du kan använda den gratis men återanvändning av den här koden i en publikation regleras av våra Ordningsregler. Du kan göra den till favorit för att använda den i ett diagram.

Vill du använda det här skriptet i ett diagram?

Kommentarer

You know how only one plot can be passed to another script through the input.source method. Do you think your method would allow for mult variables/plots to be passed through that single input.source method?
Svara
Side note, I don't really trust the barstate parameters, for barstate.isfirst I would rather use bar_index == 0.
Svara
MichelT Quansium
@Quansium, same do I have that faint feeling that barstate can potentially create some troubles in the code. Especially, barstate.isnew, which is not obvious in use. And the functions barstate.ishistory/barstate.isrealtime could provoke some issues because of repainting. But barstate.isfirst is simple and I've never had any problems with it.
Svara
Quansium MichelT
@MichelT, glad you see my point, i had some awful experiences with certain TV proprietary functions/variables. They have behave strange while new data is being added in real-time. Back on the AutoView days when you had to let the chart open on a VPS 24/7 weird things tended to happen.
Svara
Use case: imagine having your strategy settings compiled into one single string that can be inserted into the study script to eliminate the need for double inputs. What do you think Mr. @LucF ?
Svara
Quansium Quansium
@Quansium, btw why isn't this a "Pine Wizard"? Amazing imagination, great documentation skills, and smooth coding abilities. #Respect
+1 Svara
LucF Quansium
@Quansium, He is amazing. But he's also on the Pine team ) He is also a good illustration of the level this team is operating at. We don't get to see most of what's going on behind the scenes, but there is truly remarkable skill, ingenuity and coding behind Pine and the runtime environment.
Svara
@LucF, Thank you, Luc! But I used to be on the Pine team till the last Friday and since yesterday I'm creating exchanges, where the trades actually happens. In last few weeks I published my ideas, because I knew that I would lose most of my knowledge in the nearest time and if I don't share my ideas then they and all my experience would be lost for good. And to preserve at least part of it I put those idea here in case it might be helpful for anyone in any way. Most of the ideas are mostly useless, but maybe someone will be inspired with by them and create something useful for the pine society.
Svara
LucF Quansium
@Quansium, All suggestions are welcome on the Trello board, and it's easier to document and discuss them there.
Svara