Since you did not include any specific details you wanted to include I made up my own set of three conditions. The solution I am providing plots squares on the lower subgraph. (Histogram is something entirely different).
Rows are numbered 0 through 2. Row zero shows green for up bars and red for down bars. Row one displays green when there is a higher high and higher low, red when there is a lower high and lower low, and gray for all other conditions. Row 3 displays yellow for inside bars and gray for other conditions.
Here is the code:
declare lower;
def upBar = close > close[1];
def higherHighLow = high > high[1] and low > low[1];
def lowerHighLow = high < high[1] and low < low[1];
def insideBar = high < high[1] and low > low[1];
plot rowOne = if !IsNaN(close) then 0 else Double.NaN;
rowOne.SetPaintingStrategy(PaintingStrategy.SQUARES);
rowOne.SetLineWeight(4);
rowOne.AssignValueColor(if upBar then Color.GREEN else Color.RED);
plot rowTwo = if !IsNaN(close) then 1 else Double.NaN;
rowTwo.SetPaintingStrategy(PaintingStrategy.SQUARES);
rowTwo.SetLineWeight(4);
rowTwo.AssignValueColor(if higherHighLow then Color.GREEN else if lowerHighLow then Color.RED else Color.GRAY);
plot rowThree = if !IsNaN(close) then 2 else Double.NaN;
rowThree.SetPaintingStrategy(PaintingStrategy.SQUARES);
rowThree.SetLineWeight(4);
rowThree.AssignValueColor(if insideBar then Color.YELLOW else Color.GRAY);
Screenshot below shows what this looks like on the chart.
Edit: There is a comment below asking if there is a way to remove the spaces between the separate rows on the lower subgraph. Initially I did not believe it could be down. But later on the solution popped into my head out of the clear blue. Here it is:
declare lower;
def upBar = close > close[1];
def higherHighLow = high > high[1] and low > low[1];
def lowerHighLow = high < high[1] and low < low[1];
def insideBar = high < high[1] and low > low[1];
plot filler = if!IsNaN(close) then 0 else Double.NaN;
plot rowOne = if !IsNaN(close) then 1 else Double.NaN;
rowOne.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
rowOne.SetLineWeight(4);
rowOne.AssignValueColor(if upBar then Color.GREEN else Color.RED);
plot rowTwo = if !IsNaN(close) then 2 else Double.NaN;
rowTwo.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
rowTwo.SetLineWeight(4);
rowTwo.AssignValueColor(if higherHighLow then Color.GREEN else if lowerHighLow then Color.RED else Color.GRAY);
plot rowThree = if !IsNaN(close) then 3 else Double.NaN;
rowThree.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
rowThree.SetLineWeight(4);
rowThree.AssignValueColor(if insideBar then Color.YELLOW else Color.GRAY);