I updated the title of the question to include the name of this study as it exists in Thinkorswim. This should help those searching for this to locate it quickly.
Rather than adapting your own code I simply copied the source code for the one included with Thinkorswim added crossover signals and then configured the value and colors for the custom column. Value of 1 and color green for cross above, value of -1 and color red for cross below. All other conditions will print zero and leave the color as is.
input price = close;
input calculationMode = {default Normal, Alternate};
def fastLine;
switch (calculationMode) {
case Normal:
fastLine = Average(price, 3) - Average(price, 10);
case Alternate:
fastLine = Average(price - Average(price[3], 3), 2);
}
def slowLine = Average(fastLine, 16);
def crossAbove = fastLine[1] < slowLine[1] and fastLine > slowLine;
def crossBelow = fastLine[1] > slowLine[1] and fastLine < slowLine;
plot data = if crossAbove then 1 else if crossBelow then -1 else 0;
data.AssignValueColor(if data <> 0 then Color.BLACK else Color.CURRENT);
AssignBackgroundColor(if data > 0 then Color.GREEN else if data < 0 then Color.RED else Color.CURRENT);