Count median of variables

 

Hi, how do i calculate the median of these values

double g1 = 2;
double g2 = 2;
double g3 = 4;
double g4 = 5;
double g5 = 6;
double g6 = 6;

How to compare them and find the median (witch is g3 and g4.  g3+g4/2  the result should be 4,5) via mql4 code?

 
QL Capital:

Hi, how do i calculate the median of these values

How to compare them and find the median (witch is g3 and g4.  g3+g4/2  the result should be 4,5) via mql4 code?

You should use a array. What have you tried ?

 

Nothing, i didn't know what to do.

How do i insert variables to an array?

 
QL Capital:

Nothing, i didn't know what to do.

How do i insert variables to an array?

https://book.mql4.com/
MQL4 Tutorial
MQL4 Tutorial
  • book.mql4.com
Nowadays, a personal computer became indispensable for everybody. The rapid development of Internet and performance of modern computers opened up new vistas in many fields of human activities. As early as ten years ago, the financial market trade was available only for banks and for a limited community of specialists. Today, anybody can join...
 
Alain Verleyen:
https://book.mql4.com/
Haha thnx for the info
Reason: