TradingView
MichelT
14 פבר׳ 2020 18:48

Store several numbers in a string 

Apple Inc.NASDAQ

תיאור

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.
תגובות
A_Traders_Edge
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?
Quansium
Side note, I don't really trust the barstate parameters, for barstate.isfirst I would rather use bar_index == 0.
MichelT
@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.
Quansium
@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.
Quansium
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 ?
Quansium
@Quansium, btw why isn't this a "Pine Wizard"? Amazing imagination, great documentation skills, and smooth coding abilities. #Respect
LucF
@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.
MichelT
@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.
LucF
@Quansium, All suggestions are welcome on the Trello board, and it's easier to document and discuss them there.
עוד