The TTM Trend indicator from ThinkorSwim doesn't have a source code to edit. Here is the TTM Trend replica that you guys can add and modify to your liking.
Code:
### TTM_Trend Replica ###
### Chatroom request ###
### DMonkey 7/5/2016 ###
input price = close;
input n = 16; #length
def h = high;
def l = low;
def c = close;
def na = double.nan;
def rangehigh = average(highest(h,n));
def rangelow = average(lowest(l,n));
def median = ((rangehigh + rangelow) / 2);
def uparrow = if c > median then l else na;
def downarrow = if c < median then h else na;
plot up_arrow = uparrow;
up_arrow.setpaintingStrategy(PaintingStrategy.ARROW_UP);
plot down_arrow = downarrow;
down_arrow.setpaintingStrategy(PaintingStrategy.ARROW_DOWN);
### End Code ###