Question about comparing previous price to current price.

 

How exactly do you compare for example if the two(or how many ever) previous bars are lower or higher than the current bar? I guess basically what I need to do is compare previous prices with current prices to generate a buy or sell signal.


I thought I could do it this way, but it doesn't seem to work:

close0 = iClose(NULL, 0, 0); //Current
close1 = iClose(NULL, 0, 1); //Previous