Adding to Bars Object
Author: grtrader
Creation Date: 11/28/2018 1:22 PM
profile picture


Is it possible to add some parameter to the Bars object itself instead of creating a new series? For example, lets say I want to have a series of the difference between the high and low. I can create a separate series. Could I instead add the "High - Low" as a member of the Bars object and call it hilodiff, so that I could reference it by Bars.hilodiff?
profile picture


Only static data providers are allowed to establish so called NamedSeries (i.e. named DataSeries) because they can serialize them with the Bars object when storing the data on your disk. A WealthScript Strategy generally cannot serialize Bars objects. Technically you can do it on demand (see Bars object > SaveToFile / LoadFromFile in the QuickRef) but loading them back would be pretty cumbersome (I mean, the user experience isn't that smooth). So I don't see a good reason to pursue this from a practical standpoint.
profile picture


Is it possible to add some parameter to the Bars object itself instead of creating a new series?
Just to clarify, your intent is to save this new "computed" series to disk rather than cache.... Right? As you probably know, a computed DataSeries is already cached in memory if you do not create it with the "new" operator.

On saving a computed DataSeries (or Bars object) to disk, I would estimate your computer could probably recompute that object much faster than it could read a copy off of a mechanical disk. Now if your computer is using a solid-state disk drive instead, then the time it takes to recompute the DataSeries verse reading a copy from the solid-state disk would be about the same. Bottom line, the speed of the FPU (floating-point unit) is probably about the same--if not faster--than processing it through the disk drive handler and the OS's I/O channels.
profile picture


I take my words back. Most importantly you cannot register a Named DataSeries with the Bars object (from a WealthScript Strategy) because it's locked for modifications:

Please log in to see this code.

You cannot do it. Period.
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).