Net Change from Opening dollar values

Platform
  1. Thinkorswim
This was posted earlier on the vip section, it had a error in it so removed it and revised it. This is a Net Change for the opening, not to confuse it from the Net change from yesterday closed I posted. reminder all indicator do lag a few seconds. So it not perfects, hope it helps out. Anyone that can make it better great. FYI


Code:
#Net Change from Opening
input aggregationPeriod = AggregationPeriod.DAY;
def prevPrice = open(period = aggregationPeriod)[-1];
def price = open(period = aggregationPeriod);
plot DailyOpen = if !IsNaN(prevPrice) then Double.NaN else price;

##### Net change from open XXXXXXXXXXXXXXXXXXXXXXXXXX
AddLabel(yes, AsText(close - DailyOpen, NumberFormat.TWO_DECIMAL_PLACES),
if close - DailyOpen > 0 then Color.Green else Color.RED);
 
Top