MQL4 Programming Variables – MQL4 for Complete Beginners Tutorial Part 3

MQL4 Programming

Operations With Variables

In this tutorial I will explain how to use basic MQL4 programming techniques with variables such integers, doubles, strings, and others. We also touch on simple operations: addition, subtraction, multiplication, and division. Finally, we learn how to concatenate strings.All illustrations are supported with working examples using the Alert() statement.

If even after the video tutorial you are still curious, then you can always find additional information on the official MQL4 website.

MQL4 Programming Video

This video is short, sharp and to the point. We learn by doing and there’s lots of practice. Also, you can write your own test code as much as you want! In fact, I encourage you to do so, because there is no better way to learn MQL4 Programming than by trying!

As always, the code for this tutorial is located underneath the video. Feel free to post any questions and / or feedback in the comments section at the end of the post. I am interested to hear from you!

Code For This Tutorial

Tutorial3.mq4:
//+------------------------------------------------------------------+
//| Tutorial3.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()
{
int A = 10;
int B = 5;
int C;

double var1 = 2.5;
double var2 = 4;
double result = var1 / var2;

string greeting = "Hello";
string space = " ";
string name = "Bob";
string message;

C = A + B;

message = "Value of A is: " + string(A);

Alert(message);

//Alert(C);
//Alert(result);
//Alert(message);

}
 

What are you waiting for?

START LEARNING FOREX TODAY!

Tags:
share This:
Muhammad Awais

2 Responses to “MQL4 Programming Variables – MQL4 for Complete Beginners Tutorial Part 3”

August 06, 2014 at 4:18 am, fix it said:

Hi there I am so excited I found your weblog, I really found you by error, while I was browsing on Bing for something else,
Regardless I am here now and would just like to say many thanks for a tremendous
post and a all round thrilling blog (I also love the theme/design), I don’t
have time to go through it all at the moment but I have
bookmarked it and also added your RSS feeds, so when I have time
I will be back to read a lot more, Please do
keep up the fantastic job.

Reply

August 18, 2014 at 10:01 pm, Kirill said:

Thanks for the fantastic feedback, “fix it”!

Regards,
Kirill

Reply

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: