Need help whether lowest or highest bar comes first to determine fibo levels

 

Hi all,

In my EA I would to calculate fıbo levels automatıcly. I wrote the code below and altough I search a lot I coundn't fınd out how to determıne if it is a down trend or up trend. I appriciate if someone can help me regarding this. Thanks in advance. (I wrote "low bar is earlier" refers to the function that I couldn't find)

double Fibo1, Fibo2, Fibo3, Fibo4, Fibo5, Fibo6;

double lowbar = iLowest("EURUSD", PERIOD_D1, MODE_LOW,BarsBack,StartBar);

double highbar = iHighest("EURUSD", PERIOD_D1, MODE_HIGH,BarsBack,StartBar);


if ("lowbar is earlier") {

Fibo1 = highbar;
Fibo6 = lowbar;
Fibo5 = (Fibo1 - ((Fibo1 - Fibo6) * 0.618));
Fibo4 = (Fibo1 - ((Fibo1 - Fibo6) * 0.5));
Fibo3 = (Fibo1 - ((Fibo1 - Fibo5) * 0.618));
Fibo2 = (Fibo1 - ((Fibo1 - Fibo3) * 0.618));

} else {

Fibo1 = highbar;
Fibo6 = lowbar;
Fibo5 = (Fibo6 + ((Fibo1 - Fibo4) * 0.618));
Fibo4 = (Fibo6 + ((Fibo1 - Fibo2) * 0.618));
Fibo3 = (Fibo6 + ((Fibo1 - Fibo6) * 0.5));
Fibo2 = (Fibo6 + ((Fibo1 - Fibo6) * 0.618));

}

 
Cosan:
double lowbar = iLowest("EURUSD", PERIOD_D1, MODE_LOW,BarsBack,StartBar);
double highbar = iHighest("EURUSD", PERIOD_D1, MODE_HIGH,BarsBack,StartBar);

  1. Read the definitions of iLow and iLowest, and you'll have your answer.
 
WHRoeder:

  1. RTFM, there is no function called iLowest.
  2. Read the definitions of iLow and Lowest, and you'll have your answer.

2. RTFM you must, iLowest ( https://docs.mql4.com/series/iLowest )

3. RFTM, there is no function called Lowest.


Cosan

... fınd out how to determıne if it is a down trend or up trend.

Good luck in finding that, that what we - as a trader - do.

2 cent in coding, may helpfull to look longer than average bar in higher TF . Just 2 cents.

 
onewithzachy:

2. RTFM you must, iLowest ( https://docs.mql4.com/series/iLowest )

Apparently I MUST. I just looked at my outmoded pdf and saw
double val=Low[Lowest(NULL,0,MODE_LOW,10,10)];
and didn't think further.
Reason: