General Programming Principles Using the Algo Assembly

The Algo assembly is used to work with the Calculation Algorithms extension. Programming in Fore using this assembly consists in a consecutive setup of calculation algorithm.

Before getting started with calculation algorithm:

  1. Make sure that you have installed the Calculation Algorithms extension.

  2. In the development environment add links to the Algo system assembly and to the Calculation Algorithm Core custom assembly, which is included in the Calculation Algorithms component:

After the operations are executed, classes and application functions of the Calculation Algorithm Core custom assembly are available to get started with calculation algorithm.

Getting Started with Calculation Algorithm

To get started with calculation algorithm:

  1. Get a repository object of the Indicators Calculation Algorithm type using the CalcObjectFactory class and the CreateCalcObject application function, which are implemented in the Calculation Algorithm Core custom assembly.

Syntax of the CreateCalcObject function:

CreateCalcObject(descr: IMetabaseObjectDescriptor, [OpenForEdit: Boolean = true]): ICalcObject;

Parameters:

  1. Cast the obtained object to the ICalcAlgorithm interface.

The example of getting calculation algorithm with the ALGORITHM identifier for edit:

Sub UserProc;
Var
    MB: IMetabase;
    Algo: ICalcAlgorithm;
Begin
    MB := MetabaseClass.Active;
    Algo := CalcObjectFactory.CreateCalcObject(MB.ItemById(
"ALGORITHM"), TrueAs ICalcAlgorithm;
    
//...
End Sub UserProc;

The following objects are used in calculation algorithm setup:

Calculation algorithm setup is executed according to the scheme:

For details about interaction of assembly interfaces see the Algo Assembly Hierarchy section.

See also:

About the Algo Assembly | Algo Assembly Interfaces | Algo Assembly Enumerations