multiple arrays as function input ?

 

dear friends,

i need to break my code ... and for this i have to use another function than OnStart.

could i use as input for the function these kind of arrays?

double AUD1[10][4], AUD2[10][4], CAD1[10][4], CAD2[10][4], CHF1[10][4], CHF2[10][4], EUR1[10][4], EUR2[10][4], GBP1[10][4], GBP2[10][4], NZD1[10][4], NZD2[10][4], USD1[10][4], USD2[10][4], JPY2[10][4], XAU1[10][4],

string AUD1S[], AUD2S[], CAD1S[], CAD2S[], CHF1S[], CHF2S[], EUR1S[], EUR2S[], GBP1S[], GBP2S[], NZD1S[], NZD2S[], USD1S[], USD2S[], JPY2S[], XAU1S[];

AUD1[][4], AUD2[][], CAD1[][], CAD2[][], CHF1[][], CHF2[][], EUR1[][], EUR2[][], GBP1[][], GBP2[][], NZD1[][], NZD2[][], USD1[][], USD2[][], JPY2[][], XAU1[][], AUD1S[], AUD2S[], CAD1S[], CAD2S[], CHF1S[], CHF2S[], EUR1S[], EUR2S[], GBP1S[], GBP2S[], NZD1S[], NZD2S[], USD1S[], USD2S[], JPY2S[], XAU1S[], AUD1S[], AUD2S[], CAD1S[], CAD2S[], CHF1S[], CHF2S[], EUR1S[], EUR2S[], GBP1S[], GBP2S[], NZD1S[], NZD2S[], USD1S[], USD2S[], JPY2S[], XAU1S[];


...and how ?

note: these matrixes are loaded during OnStart computations.


very much appreciated !!

 
CB:

i need to break my code ... and for this i have to use another function than OnStart.

could i use as input for the function these kind of arrays?

...and how ?

note: these matrixes are loaded during OnStart computations.

I believe you could just define your function as:

void ProcessArray(<type> &arr[])

for one dimensional arrays... as for multi-dimensional ones, I don't know...

A quick and dirty way is to move the declaration of all these arrays to global - that way, you need not pass them as function parameters.

 
struct currency
{
     double a, b, c, d, e[];
} gbp1[10], gbp2[],
  aud1[10], aud2[],
  eur1[10], eur2[],
  csd1[10], cad2[];

Structures are easier to use

 

CB:

could i use as input for the function these kind of arrays?

note: these matrixes are loaded during OnStart computations.
  1. Perhaps you should read the manual.

  2. I agree, Structures are easier to use. Keep the double and the string together.
  3. Either initialize them with constants or read in a file
 
Konstantin Nikitin:

Structures are easier to use

can i declare multiple types in the struct in mql4 ? in C++ i know i can...


this was my initial hunch as well... I will have to work hard to test it.


appreciated !

 
You can state how much you need. And what you need.
 
CB: can i declare multiple types in the struct in mql4 ? in C++ i know i can...
Perhaps you should read the manual.
          Structures, Classes and Interfaces - Data Types - Language Basics - MQL4 Reference
 
Konstantin Nikitin:
You can state how much you need. And what you need.

thank you Konstantin !