I'm trying to create a function, and the generated template created by the editor has hooks for Create(), StartCalc(), and CalcBar() - no problem I can understand most of that......When I look at the MC.net supplied code in their indicators on how they are using functions, the caller simply makes a call to them within the indicators CalcBar() method...something like this:
Code: Select all
...
if (PublicFunctions.DoubleGreater(Bars.High[0], PublicFunctions.Highest(Bars.High, length, 1))){
...
Code: Select all
public sealed class IsWithinTimeRange : FunctionSimple<System.Boolean>
{
public IsWithinTimeRange(CStudyControl _master) : base(_master) { }
public IsWithinTimeRange(CStudyControl _master, int _ds) : base(_master, _ds) { }
protected override void Create()
{
// create variable objects and function objects
}
protected override void StartCalc()
{
// assign inputs
}
protected override System.Boolean CalcBar()
{
// function logic
return default(System.Boolean);
}
}
1) In MC.net's example above, the object is never constructed, instead it almost looks as though it is static.
2) How do I assign inputs within the function provided template via StartCalc?
I'm really confused by this. Either there is magi happening in the background or I can't see how the builtin indicators using functions matches with the template that is generated. Yes, I could install the beta and get access to the source code but I never like running beta trading software ever. Often just ends up being a headache as it is beta for a reason.
Any insights are warmly received - thank you.
With kind regards,
MK