Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
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 04-06-2007, 03:46 PM
Junior Member
 
Join Date: Feb 2007
Posts: 7
clippertm is on a distinguished road
Arrow Arrays in MQL4

Hello Everyone!

I am trying to understand how to programme arrays in MQL4. Can you please let me know if my interpretations are correct?

Code:
int data_z[51];
the above declares a single dimension 52 element array of integers with default value 0.

Code:
int data_x[][6];
the above declares declares a two dimensional array, one dynamic, and one of 7 element array of integers with default value 0.

Many thanks,
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 04-07-2007, 01:14 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
slightly wrong: the declaration number is the size. So the first array is of 51 elements, and the second is an indefinite number as a multiple of 6; "dynamic" as you say.

You access elements by a zero based index, which would be 0-50 for the first array, and 0-5 for the second dimension of the second array.
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 04-07-2007, 06:59 PM
Junior Member
 
Join Date: Feb 2007
Posts: 7
clippertm is on a distinguished road
Hello Ralph!

Thank you very much for your reply!

So if my understanding is correct,

Code:
int data_z[51];
would result in:

0
.
.
.
50

and

Code:
 int x = 2 ;
int data_x[x][6];
would result in something like:
0 0
1 1
2 2
3 3
4 4
5 5


?
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 04-08-2007, 10:47 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
The first is right. The first element has index 0, second index 1, and so forth, with each n:th element having index n-1, up to the 51:st element.

The second is probably right thinking as well, assuming there is an invisible column heading of "0" for the first column and "1" for the second column. It's a fair enough interpretation to think of the first index as telling which column to look in, and the second index as telling which row (of that column).
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 04-12-2007, 10:35 PM
Junior Member
 
Join Date: Feb 2007
Posts: 7
clippertm is on a distinguished road
Hello Ralph!

Thank you again for your time. It is very helpful!
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 08-11-2008, 02:16 AM
Member
 
Join Date: Sep 2007
Posts: 69
Ronald Raygun is on a distinguished road
Working with Arrays

Here's what I'm trying to create:


I'm trying to create some sort of "price density" indicator. Which measures how many times in a given set of bars a specific price is reached. The bar rankings are associated with a specific color so that I would have a field of color helping me visualize a set of support and resistance lines, sort of like what you see attached.

The color is based on how many bars go through that line.

I realize that I would need some sort of two dimensional array to accomplish this. How do I go about putting together that array?
Attached Images
File Type: gif price density.gif (7.1 KB, 108 views)
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


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
Welcome to the MQL4 course codersguru Metatrader 4 mql 4 - Development course 124 10-12-2009 01:45 AM
Using Arrays to track info for All Open Orders deeforex Questions 6 09-12-2006 07:01 PM
www.mql4.com DeSt Metatrader 4 18 02-02-2006 12:59 AM


All times are GMT. The time now is 11:00 AM.



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