Ok, then yes. The script statement in Thinkorswim is very much like a function or a procedure, as they are called in other languages. And it is designed to facilitate reusable bits of code to reduce meaningless repetitions in your code. To ‘clean things up’, so to speak.
Let me say here that for the average user of Thinkorswim this is an extremely advanced topic. So if your head starts to spin while reading this post, please don’t let it worry you. For computer programers, this is a very basic topic. One that is commonly used to streamline code and make it more readable.
I’m not sure of your background. But I can probably come up with some more helpful analogies to explain things further. Or direct you to some other resources to increase your understanding of how these things are used.
In basic terms, you have one or more inputs that are defined at the beginning. Then the code within the script statement performs calculations on the data from those inputs, while also having access to any variables previously declared. The final line of code within the script statement is the output value.
This is very much like a common function in an Excel spreadsheet…. Data in, data out.
Once the script has been created, you can call to it multiple times, passing different parameters as inputs each time. There happens to be a bug in this feature of Thinkscript. I ran across it while trying to reduce lines of code in my multiple timeframe studies. I submitted my findings to Thinkscript support and they confirmed it does not behave correctly if you are using it in more than one higher time.
Hope this helps. Please feel free to provide more details and I will do what I can to increase your understanding.
I need a bit more clarification. Are you talking about this: http://toslc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/script.html
that’s it. the example doesn’t show much. I want to pass a plot in to modify parameters or have it directly plot an output to the chart or return a plot that it created so i can plot the returned plot.
barring that, other than knowing how to use the command, i want to keep from duplicating code for n-different plots that only differ in name, color and value. -thanks Stephen