Download - Tradesignal
Transcript
:: www.tradesignal.com EQUILLA OPERATORS An important part of the scripts is the calculation of values. Often only basic arithmetic is necessary for these calculations, but sometimes the tasks are more complex. Equilla places many operators for calculating and comparing values at your disposal. CALCULATIONS BASIC ARITHMETICS For calculating values, the four basic arithmetic operations are available. These are used most often. Variables: myFirstVar, mySecondVar, myThirdVar; //Adding two values myFirstVar = mySecondVar + myThirdVar; //Subtracting two values myFirstVar = mySecondVar myThirdVar; //Multiplying two values myFirstVar = mySecondVar * myThirdVar; /* When dividing two values, care has to be taken that no division by zero occurs (which may happen if price series are faulty and include a zero). In this case, Tradesignal instantly reports an error and stops the calculation. After a simple example for a division, two examples are given that are designed to prevent a division by zero. */ //Simple Division myFirstVar = mySecondVar / myThirdVar; //Query if Divisor = NULL If myThirdVar <> 0 Then myFirstVar = mySecondVar / myThirdVar //If myThirdVar is zero, the result of the //preceding trading period is used. //The alternative block starting with 'Else' //may be left out Else myFirstVar = myFirstVar [ 1 ]; Tradesignal GmbH Page 314 Version 7.0