If Statement – MQL4 for Complete Beginners Tutorial Part 8

Finally! Today we are going to apply our knowledge to the Forex market and work with some real-time EURUSD prices. Very exciting stuff!

We will learn about the if statement and see how we can use it to add decision-making processes to our future FX Robots. Note that the next couple of tutorials will be building on top of this one, so make sure you follow the code in the video carefully! Luckily, in this course we learn by doing, so if you do happen to make an error somewhere – you will be able to pick it up right away.

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

Code For This Tutorial

Tutorial8.mq4:
//+------------------------------------------------------------------+
//| Tutorial8.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()
{
bool cond = 5 > 4; //true
bool con2 = 3 == 4; //false

//Alert(cond);
//Alert(con2);

/*
if(10 > 5)
{
Alert("The condition is true");
}
*/

Alert("Bid = " + string(Bid));

if(Bid < 1.37900)
{
Alert("The price is below 1.37900");
}

}

 

What are you waiting for?

START LEARNING FOREX TODAY!

Tags:
share This:
Muhammad Awais

Leave a Reply

Your email address will not be published.

What are you waiting for?

START LEARNING FOREX TODAY!

as seen on: