Hi there, I am trying to use AFL to process several stocks from a watch list and rank them, then perform a sum on the list.
The idea is to create my own index where each stock is weighted according to price*volume over a year. This is the code I have so far: TimeFrameSet(inWeekly); MedianPrice = (Open + Close) / 2; AnnualMoneyFlow = Sum(MedianPrice * Volume, 52); AnnualMoneyFlow represents the total dollars changing hands on a stock over the past 52 weeks. The higher this amount, the smaller the weight this stock is multiplied by, so that all stocks contribute fairly to the index. The final index is just the sum of all stocks multiplied by their respective weights. A few questions: 1) How can I do this in AFL? Backtesting or scanning doesn't seem to be the mode to perform comparative tasks across all stocks in a watch list? 2) Any suggestions or problems with this crude index approach? I just want a simple sector index and my data provider doesn't supply this from S&P. The indexes aren't available on Yahoo either. 3) Is it possible to write AFL that creates the index above then moves to the next watch list to run again, say 10 times for different industries? many thanks - Fog (Andy)
