Please I need help on mql4 code for finding the biggest of 10 last bars just like iHighest() fuction
- code help
- what mean of the fuction code?
- Look Back Period.
int highest_bar; if(High[9]>High[10]){highest_bar=9;) if(High[8]>High[9]) {highest_bar=8;) if(High[7]>High[8]) {highest_bar=7;) if(High[6]>High[7]) {highest_bar=6;) if(High[5]>High[6]) {highest_bar=5;) if(High[4]>High[5]) {highest_bar=4;) if(High[3]>High[4]) {highest_bar=3;) if(High[2]>High[3]) {highest_bar=2;) if(High[1]>High[2]) {highest_bar=1;) if(High[0]>High[1]) {highest_bar=0;) Print(" Highest Bar: ",highest_bar);
I want the biggest bar among the 10 not the highest bar.
Use support and resistance levels. Like if high of last bar is > highest high of last 10 bars and low of last bar is < lowest low of last 10 bars.
gbenga Ayodele:
I want the biggest bar among the 10 not the highest bar.
If you want the bar with the biggest range, regardless if it's up or down candle, try this:
int iLargestBar=fnLargestBar(); int fnLargestBar() { double dBiggestRange=0.0, dThisBarRange=0.0; int iMyLargestBar=-1; for(int i=0;i<10;i++) { dThisBarRange=MathAbs(High[i]-Low[i]); if ( dThisBarRange > dBiggestRange ) { dBiggestRange=dThisBarRange; iMyLargestBar=i; } } return(iMyLargestBar); }
This assumes you want the current [0] bar and the last 9 bars. If you want the 10 bars prior to the current bar, change the for loop to this:
for(int i=1;i<=10;i++)
gbenga Ayodele:
Obviously then it will be High-Low.
I want the biggest bar among the 10 not the highest bar.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register