When the new candle generates, I would like to get the last one and last two iHighest.
My code is
if(Close>lasthi2 && Close > lasthi1)
But it seems I can get last one iHighest but cannot get the last 2 iHighest.
Is there anybody could give me a hand ?
Thanks a lot.
Maybe create an array of the last 50 Highs
Find the highest in the array and assign its value to your first variable.
Then set the value of that call in the array to 0
Scan the array for the highest again, and this time you will find the second highest.
You can use