Hello,
I have several afl scripts that use watch lists, some do exports, some calculate indices, etc... I run them in a 'new analysis' window by selecting a formula, using 'apply to filter', then selecting a watch list and scanning.
My questions:
- I would like to be able to name the watch list in the script. How can I do that?
- I do these each day and would like to automate these tasks as much as possible. In general what is the best way to do this in a routine manner?
I've included an example script below. Comments on it and pointers to tutorial material gratefully accepted.
Best,
John
/* New Analysis, select watch list, scan */
/* required by scan mode */
Buy = Sell = Short = Cover = 0.0;
Filter = 1.0;
/* index symbol */
symbol = "~FAANG";
/* Get a data point to normalize with. */
startDate = "2012-05-18";
startVal = Lookup(Close, _DT(startDate), -1);
/* add data to our index OHLCV fields */
AddToComposite(Open / startVal * 100, symbol, "O" );
AddToComposite(High / startVal * 100, symbol, "H" );
AddToComposite(Low / startVal * 100, symbol, "L" );
AddToComposite(Close / startVal * 100, symbol, "C" );
AddToComposite(Volume, symbol, "V" );
/* Use the open interest field as a counter. */
AddToComposite( 1, symbol, "I" );
/* Create our Index */
graph0 = Foreign( symbol, "X" ) / Foreign( symbol, "I" );
/* That's all folks! */