Download MetaTrader 5
To add comments, please log in or register
Do you know that MQL5 has structures?
Sinisa Zizic
114
Sinisa Zizic 2016.11.29 15:58 

Please help some experienced coder.

After compiling get error constant expression required.

Problem is in array, strenghts is in pips. My idea is to get stongest and weakest pairs.

Code:

                int num_array1[8] ={EURstrenght,USDstrenght,AUDstrenght,NZDstrenght,CADstrenght,GBPstrenght,CHFstrenght,JPYstrenght};

                int    maxval=ArrayMaximum(num_array1);

int    minval=ArrayMinimum(num_array1);

int    max=num_array1[maxval];

                int    min=num_array1[minval];

 

Get errors EURstrenght - constant expression required

                USDstrenght - constant expression required.... etc

Carl Schreiber
6120
Carl Schreiber 2016.11.29 16:04  

1) Please use the SRC-button if you post code (the SRC-icon of the top line of the online editor).

2) I guess (you don't post the whole code), that EURstrenght are valiables. You cant declare array using variables - you need to do that after that!

whroeder1
13929
whroeder1 2016.11.29 17:06  
int num_array1[8] ={EURstrenght,USDstrenght,AUDstrenght,NZDstrenght,CADstrenght,GBPstrenght,CHFstrenght,JPYstrenght};
That is only valid if EURstrength is a constant. You have to set the array elements specifically
int num_array1[8];
num_array1[0] =EURstrenght;
num_array1[1] =USDstrenght;
:
Sinisa Zizic
114
Sinisa Zizic 2016.11.30 15:26  
That´s it!  There is no error after this correction. Thank you for help.
/
To add comments, please log in or register