- Copy the highs, sort them, get which ever you want. Or
- Go through them and find the highest and second. Not compiled, not tested, just typed.
int iFirst, iSecond; double first=0, second=0; for(int i=iBeg; i<iEnd; ++i){ double h=iHigh(_Symbol,_Period, i); if(h > first){ iSecond=iFirst; second=first; iFirst=i; first=h; } else if(h > second){ iSecond=i; second=h; } }
Not compiled, not tested, just typed.
-
if (timeStampCurrentCandle==timeStampLastCheck)newCandle=false; if (timeStampCurrentCandle!=timeStampLastCheck)newCandle=true;
Simplify your code.
Increase Order after stoploss - MQL4 programming forum #1.3 2017.05.29
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
I wonder if someone can assist? I'm looking to determine the second highest bar within a set number of bars. This is my code, but it does not produce the correct answer, as can be seen in the attached chart. The highest bar is H 1=16 (correct), reduce search range 1: from 1 to 15 H A=8(correct), reduce search range 2: from 17 to 30 H B=46(Incorrect). Chart attached, My Code: