If you leave the ds.Description term out in the "hash" description below ...
CODE:
Please log in to see this code.
then you run the risk of creating two cache entries for SMA(...) which are derived from
different base indicators. For example, SMA(Median(...)...) would look like SMA(DX(...)...) so one cached entry would clobber the other and get confused. I have ran into this problem on a couple TASC indicators, but this issue wasn't serious enough to return wrong answers.
I think it's okay to mess with the "hash" (description) line provided you can
guarantee uniqueness in all cache lookups. Also, for some of my indicators, I create a more "descriptive" description line, but follow strict guidelines when creating the hash description for cache lookups.
CODE:
Please log in to see this code.
The concern here is that the hashKey description needs to be as terse as possible to speed cache lookups and conform to indicator standards so everything is compatible with other indicator calls, but the description itself can be anything. Note that it's unnecessary to include the bars.Symbol in the hashKey because you're caching into a Bars object which already
uniquely identifies the bars.Symbol attribute.
In contrast, if your indicator is caching into a DataSeries object, which doesn't have a bars.Symbol attribute, then you should probably include the bars.Symbol in the hashKey for uniqueness. And yes, the Object Browser on Visual Studio does show a Dictionary datatype with a Cache property on the DataSeries definition. Check it out.