What you're looking for is perhaps something like the following Peak and Dip functions, which deliver a highest or lowest over a range of nStart +/- nWidth, up to a maximum of nLookbck bars, or -1 if not found
double Peak(int nWidth, int nLookback, int nStart) { for (int i=nStart+nWidth ; i<nStart+nLookback ; i++) { int nHighest = iHighest(Symbol(),0,MODE_HIGH,i,nStart); if (nHighest >= nStart+nWidth && nHighest <= i-nWidth) return(High[nHighest]); } return(-1); }
double Dip(int nWidth, int nLookback, int nStart) { for (int i=nStart+nWidth ; i<nStart+nLookback ; i++) { int nLowest = iLowest(Symbol(),0,MODE_LOW,i,nStart); if (nLowest >= nStart+nWidth && nLowest <= i-nWidth) return(Low[nLowest]); } return(-1); }
Paul

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
Hi Every body, little help needed just
im usign this to find a high/low
iHighest(NULL,0,MODE_HIGH,BarsHistoryCount,1) or ....
any one have any idea to find a better high/low (previously)?
BarsHistoryCount is always changing, i need a better way to find previous high/low specialy on TF-5min
help plz,