TTM Trend Source Code

dolomick

Member
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   ###
 

rive7579

New member
Hello fellow swimmers...

Looking for TTM_TREND alerts when indicator changes color in next bar... Maybe is here & I just don't see it.

Thanks. Moises
 

rive7579

New member
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   ###
Thanks so much! Does anyone know how to edit it for bar color change alerts?
 

Similar threads

Top