In my previous article, I’ve discussed the common data types you’ll be needing in creating an expert advisor. This time, let’s take a look at how we can combine these in forming operations and giving commands to your forex robot. Here are the basic ones you need to know:

### 1. Arithmetic

If you’re guessing that arithmetic operations simply refer to your good ol’ mathematical operations such as addition, subtraction, multiplication, and division, then give yourself a pat on the back. Your elementary school teachers would be proud!

But while addition and subtraction make use of the plus (+) and minus (-) signs, you should remember that multiplication and division use the special symbols asterisk (*) and slash (/) respectively. Don’t ask, that’s just how we roll in the robot world.

More complex arithmetic operations such as the modulo (remainder after division), double addition sign, and double subtraction sign exist but these are rarely used. We’ll be covering these advanced operations much later on.

### 2. Assignment

The most commonly used assignment operation is the equal sign (=), which basically assigns a value to a variable. This is often used along with arithmetic operations in order to assign the sum, difference, product, or quotient to a variable such as x or y. Of course these variables have to be properly declared and initialized beforehand!

There are a few more interesting assignment operations, which can involve adding or subtracting the value of a variable from its old value and reassigning it to the same variable. These *Inception*-esque operations won’t be of much use in basic EA coding but we’ll look more into these eventually.

### 3. Relational

Relational operations are used to compare values. These include the double equal sign (==) to see if the value of one variable is equal to another, the greater-than sign (>), and the less-than sign (<).

Also included under this category are the greater-than-or-equal-to sign (>=) and the less-than-or-equal-to sign (<=). You can use these to create conditions (ex: open price must be greater than previous candle high or closing price must be below the 50 SMA) before certain commands or operations are performed.

### 4. Logical

Logical operations can also be used in setting the conditions that must be met before an action is executed. If you need to have two conditions met before performing an operation, you can use the logical conjunction operation (&&). If you need to have either of any conditions met before performing an operation, you can use the logical disjunction operation (||).

### 5. Comma

The comma operation denotes a sequence of expressions which are read by the forex robot from left to right. This basically tells the program to do one thing after another.

In my next article, I’ll give you a few examples on how each of these operation types can be used in a forex EA. Stay tuned!