|
Properties can be used only when programming user Indicators. In any other circumstance it will be possible to use this tool otherwise the command interpreter will alert promptly.
Options are nothing else than "variables" that are used in formulae. There are very useful during the optimization phase (test) of the Trading System. This is because they can assume any value between a min and a max, and the range is defined by the user.
In practice the program will test the Trading System for the various combinations of all options. Because of this, it is recommended not to exceed a reasonable proportion of max, min, and increment. The calculation time could increase a lot. For additional information see the Trading Systems section.
The options have to be defined at module level, this means outside any function, usually on the top of the module along with the other module variables.
The correct syntax is:
Option "option_name" ( "minimum_value" , "maximum_value", "Increment" )
Here is an example:
Option Opt1 (2, 20, 2) Function Main() Return Close > CancMove(Close, Opt1) EndFunction
The program will execute with all the value of Opt1 from 2 to 20, incrementing every time by 2. In practice the portion of code will be executed 10 times.
Of course, as stated before, more than one option can be used.
Option Opt1 (2, 20, 2) Option Opt2 (1, 10, 1) Option Opt3 (6, 15, 1) Function Main () Return (Close(Opt2) > (CancMove(Close, Opt1) / Opt3)) EndFunction
In this case the program will test the code for all different combination of the 3 options (in practice 10 * 10 * 10 = 1000 combinations)
NB
-
Option can be only numeric and inside the functions can be used only with constant values. A line of code like this one, will give an error:
Opt1 = 10
Where "Opt1" is the option name.
-
Options can be the same name as variables (at module or at function levels) or arguments. The command interpreter when it finds the same name will give priority to modules variables, then at the functions variable, arguments, and at last options. If an option is used in a function with arguments of the same names it will be understood to be an argument, and not as an option.
|