Support

        Equilla Quick Start

Equilla Conditions

One of the most important aspects of programming indicators, strategies or other routines is the reaction to certain events, like calculation results or user inputs. Without the control, activation or deactivation of program parts depending on those events, no complex programming would be possible.

For all Equilla conditions, you can find additional information in TradeSignal. To display it, open the source code in the Equilla Editor. Then right-click on the operator in question, e.g. Else, and choose Lookup Equilla Function from the context menu. A window opens with information on the operators and links to related functions.

Simple Condition (If ... Then)

You can use the key words If...Then to encapsulate one or more conditions. Depending on the results, different actions are performed. The conditions can be combined by using the three operators And, Or and Xor (see the chapter Equilla Operators).

//No subchart
Meta:
    Subchartfalse );

//A list with two input parameters is declared

Inputs: 
    commodities( Silver, Gold );

//Query if the first list entry is selected
If Commodities = 0 Then
    Print"Silver price rises." )
Else //If not selected, the alternative is processed
    Print"Gold price rises." );


Conditions with Branching (If...Then...Else)

By entering an alternative command, your script can react to met and not met conditions likewise. When testing several cases at once, it is sensible to process them within the same context.

//No subchart
Meta:
    Subchartfalse );

//A list with three input parameters is declared

Inputs: 
    commodities( Silver, Gold, Platin );

//Query if the first list entry is selected
If Commodities = 0 Then
    Print"Silver price rises." )
Else //If not selected, the alternative is processed
    Print"Gold price rises." );

//Query if the first list entry is selected
If Commodities = 0 Then
    Print"Silver price rises." )
Else If Commodities = 1 Then //If not selected, the second alternative is checked
    Print"Gold price rises." )
Else //Is it not selected, only the last possibility is left. 
    Print"Platin price rises." );

Please note that the line before the Else statement must not end with a semi-colon.


Nested Conditions

You can put several statements into a block and nest queries. The following example shows how to write begin-end blocks and nested conditions.

//Important, this is not a working program. Do not attempt 
//to compile it in the editor.
//We check the cucumber and want to buy a really fresh one only 
If cucumber = green Then
    Begin 
        //The color meets our first condition, but is it also fresh?
        If ( cucumber = fresh ) Then 
            Begin
                //The cucumber is fresh, we use it
                "Cut in slices";
                "Add tomato slices";
                "Add dressing";
                //If it's Friday, add garlic
                If Today = Friday Then
                    "Put lots of garlic in the dressing"
                Else //If it's not Friday, do not use garlic
                    "Skip garlic";
            End
        Else //The cucumber was too soft and squashy, we try to buy another one.
            "Drive to another store";
    End;

 

BACK TO OVERVIEW      Equilla Quotations and Time Periods