Fair enough; let me elucidate:
For research purposes, it's often useful to control the input to a process in able to learn more about the process itself. With an indicator, the input is price, but price is whatever it is, and can't (we hope!) be controlled. I would like to be able to use this technique to get a better understanding of various indicators and indicator ideas, and to do this I need to be able to supply input data of my own, rather than price.
The best case scenario would be to gin up a stream of data - say, in a spreadsheet - then import that into ToS as an equity, so I could just get the artificial data into the indicator that way. If there's any chance that ToS allows this, I've love to hear about it. I used to do such things with another charting package I used years ago (MT4, maybe?), but I doubt that ToS would accommodate me.
Failing that, I could just mathematically create the desired data input right inside an indicator code, and then use that variable as the input to the indicator itself - something like this:
Code:
def MyData = <code that creates the data>;
plot testchart = Average(MyData, 25);
I believe that something like that should work, if I can get the data created in the first place. In the code above, I've tried to create the data by defining a variable to hold it and using code to increment then decrement the value from 50 to 100 and back, ad nauseum generating a triangle wave. As a first test, I would just plot the data raw, to see if it works, and of course, it doesn't. After some more searching, I suspect that it needs something like a test for NaN, which I read about in the (remarkably sparse) thinkScript documentation, but my every attempt makes the TS Editor cough up errors. I clearly don't understand how to get it done!
One thing I'd like to do with this method is to feed a sine wave of various wavelengths into an indicator to see how strongly it is filtered out. The frequency response curve of any price analog (i.e., moving average, etc.) could be determined this way, which could prove useful. In particular, since moving averages are in essence digital filters, this method could be used to determine the impulse response of any moving average by convolving it with a pulse input (running a data stream with a single positive spike value through it), and I personally think that would be at least fascinating... if I can figure/find out how to get past the peculiarities of thinkScript.