Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Lessons
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 10-22-2005, 03:47 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Wink Lesson 3 - MQL4 Data types

Hi there!

Welcome to my third lesson in my MQL4 course.

I hope you enjoyed the “SYNTAX” lesson, which tried to give you the answers for:
• What format you can use to write MQL4 code?
• How to make the world better by commenting your code?
• What the Identifiers are, and what are the rules of choosing them?
• What are the MQL4 Reserved words?

If you didn’t read the “SYNTAX” lesson please download it from here:
http://forex-tsd.com/attachment.php?attachmentid=399
And you can download the “Welcome” lesson from here:
http://forex-tsd.com/attachment.php?attachmentid=372
Don’t forget to login first.

Now, let’s enjoy the DATA TYPES.

-----------------------------------------

Download the lesson to know more.
Attached Files
File Type: pdf Lesson3.pdf (97.4 KB, 6148 views)
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm

Last edited by forexts; 11-07-2005 at 09:36 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 10-30-2005, 12:41 PM
Administrator
 
Join Date: Sep 2005
Posts: 20,058
Blog Entries: 241
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
You described that we should write a null character after the last character of data in data type string.

But it was nothing in the examples:
string str1 = "Hello";

So no null.

May be it was for the explanation only?

Last edited by newdigital; 10-30-2005 at 05:11 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 10-30-2005, 01:36 PM
Administrator
 
Join Date: Sep 2005
Posts: 20,058
Blog Entries: 241
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
An other question.
double should be between 2.2e-308 to 1.8e308.
What is e?
Is it in hexadecimal format?

And an other question.
I know that somebody uses the letters before name of variables, for example:
int nSomeNumber = 12345;
bool bIsRightPlace = true;
double fCurrentPrice = 1.2344;
datetime tCurrentDate = D'2005.02.02. 8;00';
color cChartColor = Olive;
string sMyName = "Joel"


I mean n for int, b for bool, f for double, t for datatime, c for color and s for string. Is it still usable?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 10-30-2005, 03:56 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow Null-terminated strings

Quote:
Originally Posted by newdigital
You described that we should write a null character after the last character of data in data type string.

But it was nothing in the examples:
string str1 = "Hello";

So no null.

May be it was for the explanation only?
Hi newdigital,

Thank you very much for your question, it's an intelligent one.
This kind of strings (and it's the only kind MQL4 uses) called Null-terminated strings


The NULL has putted for you automatically when you used the "string" keyword to create a string type variable.

So you must not add NULL to the end of your string, because MQL4 will add it automatically.

string str1 = "Hello"; will be presented in the memory like that:

H e l l o NULL
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm

Last edited by newdigital; 10-30-2005 at 05:12 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 10-30-2005, 04:45 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow Exponential notation & Hungarian notation.

Quote:
Originally Posted by newdigital
An other question.
double should be between 2.2e-308 to 1.8e308.
What is e?
Is it in hexadecimal format?

And an other question.
I know that somebody uses the letters before name of variables, for example:
int nSomeNumber = 12345;
bool bIsRightPlace = true;
double fCurrentPrice = 1.2344;
datetime tCurrentDate = D'2005.02.02. 8;00';
color cChartColor = Olive;
string sMyName = "Joel"


I mean n for int, b for bool, f for double, t for datatime, c for color and s for string. Is it still usable?
Thank you newdigital for your intelligent questions.

Question 1:

2.2e-308 and1.8e308 are numbers wrote in exponential notation.
Exponential notation is a way of writing large numbers without having to write out a lot of zeros, for example, 1,000,000,000 can be written as 1.0E9.
The number followed the E is called the exponent and it indicates how many places the decimal point must be moved to change the number to the normal decimal notation.
The exponent can be positive or negative; the exponential number 6.35E-5 is equivalent to 0.0000635 in decimal notation.

Question 2:

Yes, this is very a good programming practice, and it called Hungarian notation.
Hungarian notation is a naming convention in programming, in which the name of a variable (or function) indicates its type or intended use.

You prefixed every variable name with the first letter of the variable type, and that's what Hungarian notation mean.
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm

Last edited by newdigital; 10-30-2005 at 05:10 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 10-30-2005, 09:19 PM
Administrator
 
Join Date: Sep 2005
Posts: 20,058
Blog Entries: 241
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
May exponential notation be used in the code?

for example:
double fCoefficient = 2.5E-4
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 10-31-2005, 12:00 AM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow Exponential notation can't be used in MQL4.

Quote:
Originally Posted by newdigital
May exponential notation be used in the code?

for example:
double fCoefficient = 2.5E-4
newdigital,

Your questions enrich the course. Thanks!

I've used the exponential notation in my lesson to tell you what the range of float data type is (2.2e-308 to 1.8e308), because I can't write these numbers in decimal notation.
Do you imagine 307 zeros in the right of the number 18 to present the number 1.8e308.

In MQL4, you can't use the exponential notation.

To present the number 2.5E-4 in MQL4 you have to write it in decimal notation like this:
double fCoefficient = 0.00025;
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm

Last edited by codersguru; 10-31-2005 at 01:59 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #8 (permalink)  
Old 11-27-2005, 05:33 PM
Junior Member
 
Join Date: Nov 2005
Posts: 2
mike is on a distinguished road
mike

Hi, I've found lessons 1 and 2 so no need to reply to my message about not being able to find them.

regards

mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #9 (permalink)  
Old 11-27-2005, 11:54 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Talking

Quote:
Originally Posted by mike
Hi, I've found lessons 1 and 2 so no need to reply to my message about not being able to find them.

regards

mike
Hi mike,

Welcome to my lessons, I hope you enjoy them.
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #10 (permalink)  
Old 12-16-2005, 09:52 PM
Junior Member
 
Join Date: Dec 2005
Location: Portland, Oregon, USA
Posts: 7
mcintyd1 is on a distinguished road
Quote:
Originally Posted by codersguru
...
Question 1:

2.2e-308 and1.8e308 are numbers wrote in exponential notation.
Exponential notation is a way of writing large numbers without having to write out a lot of zeros, for example, 1,000,000,000 can be written as 1.0E9.
The number followed the E is called the exponent and it indicates how many places the decimal point must be moved to change the number to the normal decimal notation.
The exponent can be positive or negative; the exponential number 6.35E-5 is equivalent to 0.0000635 in decimal notation....
Hmmm, so I think 2.2e-308 = 2.2 x 10 to the power of -308, and 1.8e308 = 1.8 x 10 to the power of 308.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
lesson


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Lesson 8 - Variables in MQL4 codersguru Lessons 18 05-07-2009 06:13 PM
mql4 tutorial - Where is Lesson 1, etc.? ftsdPadawan Metatrader 4 mql 4 - Development course 2 01-15-2007 09:36 PM
Lesson 4 - MQL4 Operations & Expressions codersguru Lessons 28 12-20-2006 08:25 AM
Lesson 17 - Your First Script codersguru Metatrader 4 mql 4 - Development course 0 01-05-2006 12:37 AM
Lesson 7 - Functions codersguru Lessons 2 11-02-2005 04:32 PM


All times are GMT. The time now is 10:58 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.