Boolean Operations & Variables – MQL4 for Complete Beginners Tutorial Part 4

Hey there!

So, we have already learned about different types of variables including boolean variables. Today we will look at a variety of logical expressions. This is an important part of the decision-making process for automated trading system construction. In this short tutorial you will learn how to compare values using operators such as >, >=, <, <=, == and others, and assign and store the results in boolean variables. Let’s get straight into it!

Get the full course here: https://www.forexboat.com/learn-mql4

Code For This Tutorial

Tutorial4.mq4:
//+------------------------------------------------------------------+
//| Tutorial4.mq4 |
//| Copyright 2014, ForexBoat |
//| http://www.forexboat.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, ForexBoat"
#property link "http://www.forexboat.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//Boolean:
//true
//false

//Alert(4 < 5); //true
//Alert(10 > 100); //false
//Alert(2 == 3); //false

// ==
// !=
// <
// >
// <=
// >=

bool result = 4 < 5;
Alert(result);

}

 

What are you waiting for?

START LEARNING FOREX TODAY!

Avatar
Muhammad Awais

Leave a Reply

Your email address will not be published. Required fields are marked *

What are you waiting for?

START LEARNING FOREX TODAY!

as seen on: