What am I missing? Keep getting an error message. The code looks correct to me but I am missing something. Any assistance would be greatly appreciated. Trying to measure the body of candles in a given time period vs the wicks.
Ruby:
def bodymax = Max(open, close);
def bodymin = Min(open, close);
def rng = BodyHeight();
plot rng1 = rng;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;
plot DailyHigh = bodymax;
plot DailyLow = bodymin;
plot Mid;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailyHigh = Double.NaN;
DailyLow = Double.NaN;
} else {
DailyHigh = Highest(high(period = aggregationPeriod)[-displace], length);
DailyLow = Lowest(low(period = aggregationPeriod)[-displace], length);
}
Mid = (DailyHigh + DailyLow) / 2;
DailyHigh.SetDefaultColor(GetColor(4));
DailyHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyLow.SetDefaultColor(GetColor(4));
DailyLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Mid.SetDefaultColor(GetColor(4));
Mid.SetPaintingStrategy(PaintingStrategy.HORIZONTAL
Attachments
Last edited by a moderator: