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-31-2005, 01: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 9 - Preprocessors

Hi folks,

Welcome to my last theoretical lesson in this series.
In the next series of lessons we will start to build our first Customer Indicator,
So I recommend you to read all the nine lessons carefully before the real work starts.

Please download the lesson and enjoy it (I hope)
Attached Files
File Type: pdf Lesson9.pdf (50.9 KB, 5013 views)
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm

Last edited by forexts; 11-07-2005 at 09:55 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 11-03-2005, 08:00 AM
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
What the stacksize means?

When we are using indicator_chart_window, indicator_separate_window?

What is indicator_buffers? It may be up to 8 but what is that?

How to understand "indicator_minimum" and "indicator_maximum"? How to understand "the bottom border for the chart" and "the top border for the chart"? I know what chart is but where is the top (border) and bottom (border)?

What is indicator_colorN? I know that N can be displayed between 1 and 8 (color, number of the line ...)? What is 1 or 8? Which kind of data type is 1 in this case?

And the same question for indicator_levelN.
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 11-03-2005, 08:05 AM
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
I saw in the code of some EA this line:
#include <stdlib.mqh>

What is stdlib.mqh file?

Why we need to use it?
What is inside this file and how to check it?

Which functions?

Is it possible ti write our own library file with most usable pieces of the code?
Where to get custom library file?
May be somebody wrote it already ...
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 11-03-2005, 06:49 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 Just don't be in a hurry!

Quote:
Originally Posted by newdigital
What the stacksize means?

When we are using indicator_chart_window, indicator_separate_window?

What is indicator_buffers? It may be up to 8 but what is that?

How to understand "indicator_minimum" and "indicator_maximum"? How to understand "the bottom border for the chart" and "the top border for the chart"? I know what chart is but where is the top (border) and bottom (border)?

What is indicator_colorN? I know that N can be displayed between 1 and 8 (color, number of the line ...)? What is 1 or 8? Which kind of data type is 1 in this case?

And the same question for indicator_levelN.
Hi newdigital,

Thank you very much for your valuable questions.

Lesson 11 which I'm writing right now is going to answer all these questions and more, so wait for it.

__________________
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
  #5 (permalink)  
Old 11-04-2005, 07:07 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 .mqh Files and stdlib.mqh Functions

Quote:
Originally Posted by newdigital
I saw in the code of some EA this line:
#include <stdlib.mqh>

What is stdlib.mqh file?

Why we need to use it?
What is inside this file and how to check it?

Which functions?

Is it possible ti write our own library file with most usable pieces of the code?
Where to get custom library file?
May be somebody wrote it already ...
Hi newdigital,

At the beginning I’d like to explain to you the main idea behind my previous nine lessons. I wanted to present the programming in MQL4 in a simple way and without entering in a lot of minutiae which will distribute the reader’s concentration.

Now, let me answer your questions.

The file "stdlib.mqh" is a one of mqh files. And those kinds of files contain frequently used functions and variables or it contains the declarations of the functions of a library file.

Our file stdlib.mqh contains the declarations of the library file stdlib.mq4.

Those kinds of files used in your code when you use the include directive which tells the compiler to open the file and paste its content in your code. It’s very like manual opening of the file, copying its content then pasting it in your code.

If you have any code which you use it frequently you can put it in those files and you will have not to write it every time you want to use.
It’s very like the very popular .h header files used in c++ programming language.

Now, I’ll give you a full description of the content of the file stdlib.mqh.

You can find this file in you MetaTrader 4\experts\include path and if you double-clicked it you will see its content in MetaEditor.

You will find five functions declarations included in the stdlib.mqh and I’ll give you more details about each of them.

string ErrorDescription(int error_code);

This function takes an integer value and returns string value.
Its job is taking the error number and returns the string description of the error. For example:
ErrorDescription(65) will return the description Invalid account.
ErrorDescription(134) will return the description Not enough money.
You could ask me, and how can I get the error number?
You get the error number by using the function GetLastError, which will return an integer value, with the last error has occurred while the execution of you program.


int RGB(int red_value,int green_value,int blue_value);


This function takes three integer values and returns an integer value.
The three inputs are the values of red, green and blue of the color and its job to return the integer-valued representation of the color. For example:
RGB(255,255,255) will return 16777215 which is the integer-value of the White color.

bool CompareDoubles(double number1,double number2);

This function takes two doubles values and returns a Boolean value.
Its job is comparing the two double entries (from right to left), and return the result of the comparison. For example:
CompareDoubles(2.0,2.01) will return false
CompareDoubles(2.0,2.0) will return true.

string DoubleToStrMorePrecision(double number,int precision);


This function takes a double value and an integer value and returns a string value. Its job is returning a string contains the representation of the double number you entered as a first parameter with the number of the precisions you entered in the second parameter (up to 16 digits after decimal point).
For example:
DoubleToStrMorePrecision(2,10) will return “2.0000000000”
DoubleToStrMorePrecision(2.1234567890,5) will return “2.12346”

string IntegerToHexString(int integer_number);

This function takes one value of integer type and returns as string value.
Its job is converting the entered integer to a string contains the hexadecimal notation representation of the entered integer. For example:
IntegerToHexString(16777215) will return “00FFFFFF”

I hope I gave you a good description in this topic.
If you have any further questions in this topic I’ll be happy.
__________________
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
  #6 (permalink)  
Old 11-22-2005, 05:45 AM
Techguy's Avatar
Junior Member
 
Join Date: Nov 2005
Posts: 26
Techguy is on a distinguished road
Question Setting Stack Size

Quote:
Originally Posted by newdigital
What the stacksize means?
Codersguru:

I read your explanation in Lesson 11 about what the stacksize is:

"It's an integer value sets the memory size for every thread, the default is 16384. The data type of the property is integer."

How do we know what size this should be?
How many threads does MetaTrader spin off for 1 Expert Advisor?

Thank you for all your advice.
__________________
Kind Regards,

Techguy
Never Lose A Password
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 11-22-2005, 12:41 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

Quote:
Originally Posted by Techguy
Codersguru:

I read your explanation in Lesson 11 about what the stacksize is:

"It's an integer value sets the memory size for every thread, the default is 16384. The data type of the property is integer."

How do we know what size this should be?
How many threads does MetaTrader spin off for 1 Expert Advisor?

Thank you for all your advice.
Techguy,

I'm so happy for your questions

1- Each thread MT4 creates receives its own stacksize(memory space) internally, but you can set the stacksize value.

I think there's no need to change default stack_size (16384).

Note: I tried to set it to very big number
"#property stacksize 100000000000000000" and nothing has been changed and compiler didn't complain.


2- MT4 uses only one thread for the Expert Advisor.
__________________
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
  #8 (permalink)  
Old 05-18-2006, 09:26 PM
Junior Member
 
Join Date: Apr 2006
Posts: 9
anasugawa is on a distinguished road
Hello there Guru...

#define VariableName 1000

if the constant can have any type of value, how is it going to differentiate between numerical 1000 and ASCII 1000?
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 09-04-2009, 08:58 PM
Junior Member
 
Join Date: Sep 2009
Posts: 3
WHRoeder is on a distinguished road
Quote:
Originally Posted by anasugawa View Post
#define VariableName 1000

if the constant can have any type of value, how is it going to differentiate between numerical 1000 and ASCII 1000?
By the context where is is used.
Code:
int var=VariableName;
double var2=VariableName;
is equivalent to
Code:
int var=1000;
double var2=1000; // 1000.0
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
stdlib.mqh


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 2 - SYNTAX codersguru Lessons 12 08-08-2009 03:08 AM
Lesson 18 - Working with templates codersguru Metatrader 4 mql 4 - Development course 13 08-03-2008 02:39 AM
Need an OBJECT lesson ! CaptainVideo Tools and utilities 6 05-18-2006 11:42 PM
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 04:01 AM.



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