While Loop – MQL4 for Complete Beginners Tutorial Part 5

Hi there, I think that you will find this tutorial rather exciting! Why? Because today we will be looking your very first while loop! If you have never ever used loops before, then don’t worry – I will explain everything in detail and as usual we will see how it all works in practice. However, if you are new to programming, I recommend paying detailed attention and making sure that you understand this tutorial before moving on with the course.

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

Code For This Tutorial

Tutorial5.mq4:
//+------------------------------------------------------------------+
//| Tutorial5.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()
{
Alert("Start of script");

int counter = 1;

while(counter < 3) //true?
{
Alert(counter);
counter = counter + 1;
}

Alert("Loop has finished");

}

 

What are you waiting for?

START LEARNING FOREX TODAY!

Tags:
share This:
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: