Trying to make an indicator, for minute charts, that checks the previous day's prices for a high, then draws a line. Simple.
The logic is here:
for(int i = NumberofBars; i >= 1 ; i = i - 1)
{
if(High[i]> HighPrice)
{
HighPrice = High[i];
}
}
If the High, i bars ago is greater than HighPrice, then set HighPrice equal to the high i bars ago. Then move on, checking a 'newer' bar in the timeline. After all this is done, simply plot the HighPrice.
It is set to check every time at the 4:00PM bar, and I have it set so it doesn't bother trying if there aren't enough bars initially.
In order to set things in motion and to have a price to compare things to, HighPrice is set to the high of the leftmost bar.
The result is a line that never changes. I check the output, of High[i], and the result is one single price.
I inserted a simple print statement, and all my High[i]'s, from High[390] to High[1] are all returning the same price, the price I intially set HighPrice too.
I don't know what is going on here. For the life of me, I cannot understand how I can fail to program an indicator that draws a simple line.
Regards,
Dane.
Comment