Overloading custom indicators
Author: streak
Creation Date: 4/5/2012 3:15 AM
profile picture

streak

#1
Hi

Have noticed that indicators can be overloaded as per RevEngMACD. However, in its source code (TASCIndicators 2011.12.0.2) the extra parameter does not seem to be catered for in the Helper Class... and not available when selecting the indicator from the tools menu (ver2012.4.0.0).

Do I have it correct that the extra parameters in indicator overloads cannot be offered through their Helper classes?

Also if the helper class can only provide one set of parameters, can the coded helper parameters be from the overload with the most options, and can the additional parameters be offered as optional?

Thanks
profile picture

Eugene

#2
Hi,
QUOTE:
Do I have it correct that the extra parameters in indicator overloads cannot be offered through their Helper classes?

Yes, that's right. The helper class can only provide one set of parameters.
QUOTE:
can the coded helper parameters be from the overload with the most options, and can the additional parameters be offered as optional?

It's up to you to define which parameter set will be used as default.
profile picture

streak

#3
ok thanks Eugene
profile picture

streak

#4

RevEngMACD is the only sample I've been able to find that implements an overloaded constructor among the available indicator source code.

In WLD the following will compile;
CODE:
Please log in to see this code.
however, an overloaded
CODE:
Please log in to see this code.
will not compile, throwing the err; "No overload for method 'Series' takes '4' arguments" The series method that first checks cache only takes 3 arguments(?).

Have only been trying to learn from RevEngMACD having had the idea of using some overloads with a custom indicator. Do I have it correct that attempting to create a custom indicator library with overloads is not going to workout?

Also, it seems that indicators generally only have 2 return methods (.Series and sometimes .Value). Is it possible to have other return methods? Eg, would like a bool method for a swing indicator that functions like;
CODE:
Please log in to see this code.



profile picture

Eugene

#5
QUOTE:
will not compile, throwing the err; "No overload for method 'Series' takes '4' arguments"

There is no reason to not trust the C# compiler: indeed, there is no overload taking 4 arguments. Take a look at the Wealth-Lab Version 6 (.NET) Development Guide, "Create an Indicator Library". According to it, one would create a new DataSeries like this:
CODE:
Please log in to see this code.

Based on RevEngMACD Syntax and the official Indicator API guide, "Using Indicators in WealthScript Code".
QUOTE:
Do I have it correct that attempting to create a custom indicator library with overloads is not going to workout?

There can be only one static method returning Series, otherwise the IndicatorHelper will not work. Create as much constructors with as much parameters as you'd like - RevEngMACD is an illustration - but the indicator properties dialog, supported by the IndicatorHelper, is limited to one .Series call.
QUOTE:
Is it possible to have other return methods?

No.
profile picture

streak

#6
Thanks Eugene,

I didn't think of 'new' to create an instance, but should have noticed a telltale (forgetting what I've been leaning!).