Looping thru a Dataset (SMA Issue)
Author: wycan
Creation Date: 12/19/2008 2:19 PM
profile picture



Would appreciate if someone could look at this code snipped and see what I may be doing wrong. I'm trying to loop thru a dataset and calculate the relative strength (RS) for each symbol in the list based on it's 126 SMA. The problem comes in for stocks that have less than 126 days. For some reason, Bars.Count always evaluates to the number of bars in the datapane (even after SetContext), so I am unable to skip those stocks. Further, somehow it calculates an erroneous SMA for those stocks. Any ideas ? Is there a better way to do this ? thx

Please log in to see this code.
profile picture



The "true" means that you're synching the symbol raw data to the primary series. (See the WealthScript Programming Guide: DataSeries > Accessing Secondary Symbols > Secondary Series Synchronization)

So, the answer is to calculate your RSs using the symbols' raw data (i.e., before synch) and then use the Synchronize command to synch the series to the chart.
profile picture


thx Cone.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).