Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register FAQ Members List Calendar Today's Posts


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2006, 01:25 PM
intelligent_14's Avatar
intelligent_14 intelligent_14 is offline
Junior Member
 
Join Date: Mar 2006
Location: Tehran/Iran
Posts: 24
intelligent_14 is on a distinguished road
Unusual Functions

Hi everybody

I'm wondering how i can define one special function that returns an Array
All definable function only return one variable not Array!

can anyone help me?

Thanks
__________________
there wil be nothig for a person exept his efforts (Emam Ali Alayhesalam)
M.A.Gh
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-23-2006, 02:46 PM
elihayun's Avatar
elihayun elihayun is offline
Senior Member
 
Join Date: Jan 2006
Posts: 350
elihayun is on a distinguished road
Quote:
Originally Posted by intelligent_14
Hi everybody

I'm wondering how i can define one special function that returns an Array
All definable function only return one variable not Array!

can anyone help me?

Thanks
As far as I know there is no way to return an array, but u can use the following technique

double MyFunc(int shift)
{
static double a[100];
static bool firstTime = true;
if (firstTime)
{
firstTime = false;
<fill up the array>
}
return a[shift];
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-23-2006, 07:16 PM
intelligent_14's Avatar
intelligent_14 intelligent_14 is offline
Junior Member
 
Join Date: Mar 2006
Location: Tehran/Iran
Posts: 24
intelligent_14 is on a distinguished road
Quote:
Originally Posted by elihayun
As far as I know there is no way to return an array, but u can use the following technique

double MyFunc(int shift)
{
static double a[100];
static bool firstTime = true;
if (firstTime)
{
firstTime = false;
<fill up the array>
}
return a[shift];
}
thanks Elihayun, but this function return only one number (a[shift]) i wants it to return all of "a[]" array not a[shift]
__________________
there wil be nothig for a person exept his efforts (Emam Ali Alayhesalam)
M.A.Gh
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-23-2006, 11:20 PM
elihayun's Avatar
elihayun elihayun is offline
Senior Member
 
Join Date: Jan 2006
Posts: 350
elihayun is on a distinguished road
Quote:
Originally Posted by intelligent_14
thanks Elihayun, but this function return only one number (a[shift]) i wants it to return all of "a[]" array not a[shift]
U can use it this way


for (int i=0; i<100; i++)
{
double d = MyFunc(i);
<do what u need to do with the return value>
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
MT4 Files Functions Replacement. codersguru Tools and utilities 95 05-17-2008 05:32 PM
File Functions intelligent_14 Questions 6 07-11-2006 08:37 PM
Lesson 7 - Functions codersguru Lessons 2 11-02-2005 03:32 PM


All times are GMT. The time now is 09:09 PM.