In programming, variables are used to store data that may be accessed and changed in a computer program. In this framework, Variable objects serve as a placeholder to inform the framework to grab the corresponding variable from the context object provided. For example,
Variable("Var1", 'bounded', 'double', min(data{:, 'Var1'}), max(data{:, 'Var1'}))Given a program with the following pseudocode
IF Var1 > 50
...
ELSE
...
ENDIF
and the current context object contains
env.Var1 = 25When reaching the first line, the program needs the current value of Var1 in order to determine whether Var1 is greater than 50. Then, the framework will inform the program to grab the value from the context object env.
The constructor for environment variables
| Argument | Description |
|---|---|
fieldName |
The name of the field. The identifier that is used to locate the environment variable from the context structure. |
valuesType |
The type of the environment variable. Can be either none, enumerated, or bounded. |
returnType |
The return type. Could be any type that the environment variable returns. |
arg1 |
A shared variable. When valuesType is set to enumerated, the field should contain the list of allowed values. When the field valuesType is set to bounded, the lower bound of the variable's range should be provided. |
arg2 |
Only need to be specified when the field valuesType is set to bounded. In such case, provide the upper bound of the variable's range. |
requiredTags |
A cell of tags required for object to present in the tree. See more on tag system. |
The type of the environment variable. Can be either none, enumerated, or bounded. The following table explains the difference between the three.
| Type | Description |
|---|---|
none |
When growing the parse tree, there won't be a Value object created to the right-hand side of the Variable object. |
enumerated |
Enumerated list of variables may be created to the right-hand side of the Variable object. |
bounded |
Values between specified ranges may be created to the right-hand side of the Variable object. |
Variable("MACDSignal", 'none', 'double');Variable("Signal", 'enumerated', 'string', {"Buy", "Hold", "Sell"});Variable("RSI", 'bounded', 'double', 0, 100);You may also retrieve the range from your dataset.
Variable("MACD", 'bounded', 'double', min(data{:, 'MACD'}), max(data{:, 'MACD'}));Note: It is recommended that the data only contain the training set.
This project, including the documentation, is licensed under the MIT license. Copyright (c) 2022 Bohui WU.