• LIMITED TIME OFFER: use coupon code PRIMEDAY (case sensitive) at checkout to save $50 off VIP membership (down to $149 / year). Valid through Tuesday 6/22. Biggest discount this year!

TEMA Derivative Indicator for ThinkorSwim

WbKiki

New member
VIP
Someone in the Discord server had asked for an indicator to determine where the inflection points were on an EMA. I figured it would look interesting taking the derivative of the TEMA. I also added a bunch of them. Looks pretty interesting IMO.

Code:
#############################
# TEMA DERIVATIVE INDICATOR #
#############################

declare lower;

input price = close;
input length = 10;
plot zero = 0;

def ema1 = ExpAverage(price, length);
def ema2 = ExpAverage(ema1, length);
def ema3 = ExpAverage(ema2, length);

def TEMA = 3 * ema1 - 3 * ema2 + ema3;
#TEMA.SetDefaultColor(GetColor(0));

input length2 = 3;
def derivative = ((TEMA[0] - TEMA[length2]) / (length2));
#derivative.SetDefaultColor(CreateColor(255, 155, 255));
#derivative.SetLineWeight(1);
addCloud(derivative/6, zero, color.green, color.light_red, no);

input length3 = 3;
def derivative2 = ((derivative[0] - derivative[length3]) / (length3));
#derivative2.SetDefaultColor(CreateColor(255, 155, 255));
#derivative2.SetLineWeight(1);
addCloud(derivative2/2, zero, color.green, color.light_red, no);

input length4 = 3;
def derivative3 = ((derivative2[0] - derivative2[length4]) / (length4));
#derivative3.SetDefaultColor(CreateColor(255, 155, 255));
#derivative3.SetLineWeight(1);
addCloud(derivative3, zero, color.green, color.light_red, no);

input length5 = 3;
def derivative4 = ((derivative3[0] - derivative3[length5]) / (length5));
#derivative4.SetDefaultColor(CreateColor(255, 155, 255));
#derivative4.SetLineWeight(1);
addCloud(derivative4, zero, color.green, color.light_red, no);

input length6 = 3;
def derivative5 = ((derivative4[0] - derivative4[length6]) / (length6));
#derivative5.SetDefaultColor(CreateColor(255, 155, 255));
#derivative5.SetLineWeight(1);
addCloud(derivative5, zero, color.green, color.light_red, no);

input length7 = 3;
def derivative6 = ((derivative5[0] - derivative5[length7]) / (length7));
#derivative6.SetDefaultColor(CreateColor(255, 155, 255));
#derivative6.SetLineWeight(1);
addCloud(derivative6, zero, color.green, color.light_red, no);

input length8 = 3;
def derivative7 = ((derivative6[0] - derivative6[length8]) / (length8));
#derivative7.SetDefaultColor(CreateColor(255, 155, 255));
#derivative7.SetLineWeight(1);
addCloud(derivative7, zero, color.green, color.light_red, no);

input length9 = 3;
def derivative8 = ((derivative7[0] - derivative7[length9]) / (length9));
#derivative8.SetDefaultColor(CreateColor(255, 155, 255));
#derivative8.SetLineWeight(1);
addCloud(derivative8, zero, color.green, color.light_red, no);

input length10 = 3;
def derivative9 = ((derivative8[0] - derivative8[length10]) / (length10));
#derivative9.SetDefaultColor(CreateColor(255, 155, 255));
#derivative9.SetLineWeight(1);
addCloud(derivative9, zero, color.green, color.light_red, no);

input length11 = 3;
def derivative10 = ((derivative9[0] - derivative9[length11]) / (length11));
#derivative10.SetDefaultColor(CreateColor(255, 155, 255));
#derivative10.SetLineWeight(1);
addCloud(derivative10, zero, color.green, color.light_red, no);

Screenshot-7.png
 

Similar threads

Top