I developed this script to be used in debug mode (i.e. using PrintDebug) to review an entire library for stable indicators. I thought this would be helpful for reviewing the Community.Indicators library as it changes fairly frequently. I developed it for my own use, but I thought I'd post it here in case it is helpful to others.
This script will call the "Series" method of each indicator in the library using the default values specified in its IndicatorHelper class. The script needs to run twice with different range settings: 1) Build first set of results; 2) Build second set of results and generate a report in the debug window of the comparison of the results. The comparison goes on the assumption that the last bar should have the same value no matter what the range is. If the last bar value is not the same, the script will flag the indicator as Stable = FALSE.
There were a lot of Stable = FALSE on my first test with the values differing by an extremely small amount. I determined that I wanted to set a tolerance so values that were off by a very small amount would not be flagged as FALSE. The parameter "Tolerance Exp" can be used to adjust this amount. A -4 will set a tolerance value of 0.0001 -- which will be treated as 0.01% difference. If the difference between two backtests with different ranges is less the 0.0001 then the values will be considered equal. A tolerance of -5 will be 0.00001 (smaller difference allowed) which may result in more Stable = FALSE.
Obviously some indicators will always fail this test, but could still be stable. Any indicator that returns a bar value will almost always fail this test as the bar index will change for each range.
Sometimes the default period for an indicator is large. This may cause an error running the Series method with a period larger than the data range specified for the test. An error will cause the indicator to be dropped from the comparison. I've found that I need at least 60 bars for "WealthLab.Indicators" and 255 bars for "Community.Indicators" or some indicators will be dropped.
The report in the debug window is difficult to read. It is designed to copy all the contents and paste into a spreadsheet (I use Excel). This makes it easier to read the results and filter it as you wish.
CODE:
Please log in to see this code.
For my test, the script is set to scan the "WealthLab.Indicators" library for review. My test was done with 60 and 70 bars.
There were a few indicators that appeared to be unstable which were not specified in help: AccumDist, ADXR, KST, Parabolic. Should these be considered unstable or are there reasons for the difference?