QUOTE:
During [the indicator creation] process, I noticed that I do not have access to functions like DrawLabel, DrawPolygon, SetSeriesBarColor etc.
That's because these functions are part of "
WealthScript" which MyStrategy
inherits from as defined in the code below:
CODE:
Please log in to see this code.
In contrast, an indicator definition inherits from
DataSeries, not
WealthScript, so it doesn't have these functions (e.g. DrawLabel).
QUOTE:
Does this mean that wealth lab can only create simple indicators and any complex cosmetic stuff has to be handled in the Strategy?
In other words, you're asking if your indicator can inherit from
WealthScript instead of
DataSeries. That "might" be possible, but I would
not do that--bad design. The intent of an indicator is to create a simple
static C# datatype for high speed execution, and inheriting from DataSeries facilities that. Also, the indicator you create has to be a static function (i.e., not passed by reference) to work with the WL GUI.
Step 1) What I would do is create your indicator inheriting from DataSeries the way you would normally do. That finishes that.
Step 2) Next, create custom library function where you pass an instance of WealthScript into this function (which you would call from MyStrategy). Now you can reference WealthScript functions from that instance that you passed into your custom function.
Step 3) Within your custom function, include a
using statement referencing your indicator code library so you can call your indicator from inside your custom function.
I do this all the time in my code with one exception: I avoid Step 3 altogether. Instead, I call my custom indicator from MyStrategy
directly (not through a custom function), then to dress it up, I then call my custom function from MyStrategy later on. By only calling my indicators and custom functions from MyStrategy
directly (not chaining internally), I achieve more flexibility at the MyStrategy level.