Assuming you're working on a day chart, this should get you going:
Code:
declare lower;
plot data = open - close[1];
plot zero = 0;
We can use the bracket notation to reference previous candles, so that [1] indicates "1 bar ago". There is an implicit [0] with the open as I used it. That is, if you don't put a number in brackets, it automatically assumes the last candle:
Code:
open == open[0]
and
close == close[0]
You can reference future bars using negative numbers, but be aware that this is the largest single culprit for repainting studies and un-produceable results in backtests. It has uses, but just be careful that [1] is one bar ago and [-1] is one bar from now.
happy trading,
mashume