print(TO_HTML) is correct. I don't know the reason of your problem, but here's the code with which Z12 prints the cells of its algo result table - hope this helps:

Code:
print(TO_HTML,"<td");
if(NumWinLong+NumLossLong+NumWinShort+NumLossShort > 0) {
	if(NoLong || NoShort)
		print(TO_HTML," bgcolor="#FF0000"");
	else if(EquityLongF[0] + EquityShortF[0] > 0)
		print(TO_HTML," bgcolor="#00FF00"");
	print(TO_HTML,">%s:",Algo);
	if(!NoLong && NumWinLong+NumLossLong > 0) print(TO_HTML,"L");
	if(!NoShort && NumWinShort+NumLossShort > 0) print(TO_HTML,"S");
	print(TO_HTML," %+.0f",ProfitClosed+ProfitOpen);
} else
	print(TO_HTML,">");
print(TO_HTML,"</td>");