Comparing current price with open?


New member

I have a newbie question. Is it possible to compare the current price (not a previous close but what it actually is at this exact time) to the open price for that particular bar? In otherwords, how much that candle has increased?

I wrote this code but not sure about the second line. Is PriceType.LAST the current price?

#in theory this should scan for candle that has grown 5% since
#it has opened
input percentIncrease = 1.05; #5% increase
input priceType = PriceType.LAST; #in theory, report current price???????
def currentPrice = close(priceType=priceType);
plot scan = (currentPrice * percentIncrease) > open;
Last edited by a moderator:


Well during trading hours, close, open, high, and low all refer to the current bar. So assuming you're looking for a scan, here's how I might do it
input percentIncrease = 5;

def percentChange = (close - open) / close * 100;
plot scan = percentChange > percentIncrease;

Similar threads