Script help: Previous candle close price minus current price

drbdanish

New member
Can someone make a label for me which shows the price change from previous 1 hour candle to current price please.
Label can look something like this:

FtlyPl2.png


I want the label to show the price change not percentage please.

I will appreciate it.
 

BenTen

Administrative
Staff
VIP
@drbdanish Here you go:

Code:
# Difference between previous Hourly candle and current price
# Assembled by BenTen at UseThinkScript.com

input aggregationPeriod = AggregationPeriod.HOUR;
def prev_close = close(period = aggregationPeriod)[1];
input priceType = PriceType.LAST;
def LastPrice = close(priceType = priceType);
def difference = prev_close - LastPrice;

AddLabel(yes, Concat("Difference=", difference), Color.YELLOW);
 

Similar threads

Top