using two moving average line to set Bar's Color?

 
plot two moving average, for example, ma(100) and ma(200),
if Close>max(ma(100),ma(200)),set the bar color to Red, if Close<min(ma(100),ma(200)),set the bar color to Blue. and if the close between max(ma(100),ma(200)) and min(ma(100),ma(200)), set the bar color to the same as the previouse bar.

How to implement the method in MQL4 and Mql2.

Thx.