Indicator example that uses a Bars argument in constructor?
Author: Gostling
Creation Date: 7/22/2012 8:17 PM
profile picture


The Fidelity "under the hood" states ways of doing an indicator constructor:
public DataSeries(Bars bars, string description);
public DataSeries(DataSeries source, string description);

I have a working example of the the "DataSeries" version and want an example of the "bars" version.
The constructor using bars allows OHLC calcs to be done as you know, my motivation.

My Basic probleum with the Bars version is that I do not have an object or ref that WLP program is using for the current symbol with OHLC data series. The constructor requires this Bars info as an argument... how do I get it. This is a WLP object quiz not C# synatx....every WLP coder must know this, but I spent all day Sunday ...I am stuck

I tried chanaging the SMA example form the dataseries to the bars version...there is probable two lines of code before the constructor is called, what are they ??

I am building a code snipet to wrap around my indicators... for illustration: "Hi plus Low /2" would be a fine example.

I have looked at several community indicators source, they seem to be focused on algorithms, not the tiny encasing boiler plate I need. Other exaples are indicators in the "execute" routine and plot on a seperate pane, no help...

Can you help me ???

profile picture


There are literally dozens of classes that accept a Bars argument in constructor in our open source Indicator libraries:

Home - Community Indicators
Home - TASCIndicators

Log in to the Wiki, grab the attachments, and use any example that fits.
profile picture



The ZIP files do have the necessary examples, much more useful than the HTML doc. The boiler plate is simple and well illustrated.

The SMA example in the FI "under the hood" also had a section that looked in cache for existing indicator data or added the indicator dat to the cache. It implies that the indicator could passed and used by WLP thru cache? Is this cache code required or necessary? or just for efficiency because the constructor is the primary calc program path.

Thanks for helping a WLP newbie with quick and great support...ED
profile picture



Supporting Bars.Cache isn't required but you would not want to leave your indicator without this feature implemented because you'll notice a drastic slowdown.
profile picture


Ticket closed...I am armed and ready..
Thank You
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).