User Variables

Top  Previous  Next

User variables are special keywords that you as the user can set during your trading session. They represent pairs of "Name / Value", where "Name" is any combination of allowed symbols and "Value" is a number or string that you can assign to that name.


The allowed symbols for the name of a variable are:

- Latin letters A-Z, a-z. Example: Myvar

- Figures 0-9. Example: point1

- Space, underscore. Example: one_plus_2


You must make sure that your variable's name does not coincide with any other trigger variable's existing in X-Feeder.


The value of a variable can be:

- A number

- A sequence of letters, figures, spaces and other symbols

- An arithmetic expression supported by X-Feeder

- A function supported by X-Feeder

- Trigger variable

- A combination of the above


Please note: all arithmetic expression, formulae and variables will be evaluated prior to assigning a value to the variable. That is, a variable will hold the final value of this expression, not the expression itself.


If a user variable is not set, it is not parsed by the program and all references to this variables are not replaced by its value. For example, if you are going to use a variable "myvar", but have not executed a trigger which sets its value, then any expression containing this variable will not be evaluated correctly:


IF(back_price>2, 5, myvar)


This will return the same expression, without any change, because myvar is not defined yet. Beware that this may lead to loops, especially if you assign a variable the value containing a reference to this very variable. For example:


set user variable   var1   IF(last_bet_pl>0, var1+5, 0)


This will result in var1's value becoming "IF(last_bet_pl>0, var1+5, 0)". Next time when the same trigger action is performed, and if var1 is still not set, the value of this variable will become "IF(last_bet_pl>0, IF(last_bet_pl>0, var1+5, 0)+5, 0)" and so on. To avoid this, use a trigger condition that checks whether the variable has been already set.


User variables are designed to expand the functionality and range of trigger conditions available to check. For example, at some point in the game you can "remember" some parameter by writing it to your variable and later using this variable in your triggers.


You can insert user variables in trigger expressions and work with these expressions as you would do if they contained regular trigger variables. For example:


Trigger Expression myvar is greater than 0
Trigger Expression myvar/conseq_losses is less than 1
Trigger Expression back_price/(myvar1 + myvar2) is greater than h_1_back_price


You can also user them to "flag" some situation in the game. For example, if a certain trigger's conditions were met, you can set a variable "var1" to "1", and check it in another trigger's condition to find out if the first trigger has been executed.


You can set user variables' values manually, using the "View Variables" tool.


To quickly set up bulk user variables, you may as well use "User Constants".


Read more tips on working with user variables.