I am trying to create a swing indicator based on certain periods that I've created. I've used the MAX() and MIN() to determine the highs and lows of these periods. Does anyone know how to then find the specific bar number for those highs and lows?
if (down period)
{
endBarsAgo1 = CurrentBar;
startBarsAgo = CurrentBar;
lowest_Low = MIN(Low, endBarsAgo1 - startBarsAgo1 )[1];
}
if(up period)
{
startBarsAgo1 = CurrentBar;
endBarsAgo = CurrentBar;
highest_High = MAX(High, endBarsAgo - startBarsAgo)[1];
}

Comment