Hi friends, Happy Holidays! I wrote a function to find the 2nd highest value in the last X bars like this:
void secondHighestValue()
{
for(int n=0;n<=maxBars;n++)
{
if((High[iHighest(NULL,0,MODE_HIGH,maxBars,n)] < highestValue) && (High[iHighest(NULL,0,MODE_HIGH,maxBars,n)] > thirdHighest))
{
secondHighest = High[iHighest(NULL,0,MODE_HIGH,maxBars,n)];
}
}
}
Is there an easier or more efficient way to do this? i.e. find the 2nd or 3rd etc highest candle value.
Thanks guys!
void secondHighestValue()
{
for(int n=0;n<=maxBars;n++)
{
if((High[iHighest(NULL,0,MODE_HIGH,maxBars,n)] < highestValue) && (High[iHighest(NULL,0,MODE_HIGH,maxBars,n)] > thirdHighest))
{
secondHighest = High[iHighest(NULL,0,MODE_HIGH,maxBars,n)];
}
}
}
Is there an easier or more efficient way to do this? i.e. find the 2nd or 3rd etc highest candle value.
Thanks guys!