Here is the code:
# TTM_Trend
# KumoBob
# 06 Dec 2009
# Green indicates that the average close of the prior 6 bars is in the top 50% of the true range.
# Begin
input length = 6;
def average_true_range = Average(TrueRange(high, close, low), length = length);
def Ave = Average(close, length);
def AVE_True_Range = close - (average_true_range / 2);
AssignPriceColor(if Ave < AVE_True_Range then color.green else color.red);
# End

Comment