Join useThinkScript to post your question to a community of 21,000+ developers and traders.
spy, 20 min and 1 hour timeframe@Katsu On what ticker? Timeframe?
Thank you it works on the daily and weekly. Thanks@Katsu Did you try the indicator on another ticker and timeframe? The best way to find out if the script is working or not is to switch between multiple timeframes and tickers.
#WT_LB Short Name TV
declare lower;
input Channel_Length = 10; #10
input Average_Length = 21; #10
def ap = hlc3;
def esa = ExpAverage(ap, Channel_Length);
def d = ExpAverage(AbsValue(ap - esa), Channel_Length);
def ci = (ap - esa) / (0.015 * d);
def tci = ExpAverage(ci, Average_Length);
def wt1 = tci;
def wt2 = SimpleMovingAvg(wt1, 4);
#def zero = 0;
def wt1_1 = wt1;
def wt2_1 = wt2;
plot mean = inertiaAll((wt1+wt2)/2);
def dev1 = (stdevAll(wt1)+stdevAll(wt2))/2;
plot up = wt1_1+ dev1*2;
plot down = wt1_1- dev1*2;
down.SetDefaultColor(Color.green);
down.SetLineWeight(3);
up.SetDefaultColor(Color.red);
up.SetLineWeight(3);
#WT_LB Short Name TV
#DEVIATION
declare lower;
input Channel_Length = 10; #10
input Average_Length = 21; #10
def ap = hlc3;
def esa = ExpAverage(ap, Channel_Length);
def d = ExpAverage(AbsValue(ap - esa), Channel_Length);
def ci = (ap - esa) / (0.015 * d);
def tci = ExpAverage(ci, Average_Length);
def wt1 = tci;
def wt2 = SimpleMovingAvg(wt1, 4);
#plot zero = 0;
#zero.setDefaultColor(color.gray);
plot lineaA = 150;
lineaA.setStyle(2);
plot lineaB = -150;
lineaB.setStyle(2);
def wt1_1 = wt1;
def wt2_1 = wt2;
#plot avg = (wt1_1-wt2_1);
plot mean = inertiaAll((wt1+wt2)/2);
mean.setDefaultColor(color.cyan);
def dev1 = (stdevAll(wt1)+stdevAll(wt2))/2;
plot up = wt1_1+ dev1*2;
plot down = wt1_1- dev1*2;
plot avg2 =(up-down/up+down)-mean;
avg2.setDefaultColor(createcolor(200,10,40));
#plot avgA =(up/down-up+down);
plot avg3 = 1.0* (up+down/up+down)-dev1;
avg3.setDefaultColor(color.white);
#plot a23 = (avg2+avg3);
down.SetDefaultColor(Color.RED);
down.SetLineWeight(2);
plot DNSignall = if down CROSSES BELOW -148 then down
else Double.NaN;
DNSignall.SetPaintingStrategy(PaintingStrategy.POINTS);
DNSignall.SetLineWeight(4);
DNSignall.SetDefaultColor(Color.YELLOW);
up.SetDefaultColor(Color.GREEN);
up.SetLineWeight(2);
plot UpSignall = if UP CROSSES ABOVE 148 then UP
else Double.NaN;
upSignall.SetPaintingStrategy(PaintingStrategy.POINTS);
UpSignall.SetLineWeight(4);
UPSignall.SetDefaultColor(Color.YELLOW);
#..................................................
#........................................................
#DIVERGENCE
input fastPeriod = 12; #9/18/6 for 5m
input slowPeriod = 26;
input signalPeriod = 9;
input price = close;
input show = yes;
def fastEma = ExpAverage( price, fastPeriod );
def slowEma = ExpAverage( price, slowPeriod );
def periodOK = fastPeriod < slowPeriod;
AddLabel( !periodOK, "ERROR: fastPeriod MUST be less than slowPeriod" );
def _ppo = if periodOK then ((fastEma - slowEma) / slowEma) * 100 else 0;
def _signal = ExpAverage( _ppo, signalPeriod );
# generic plots wiht colors
def pmain = _ppo;
def mainEma = _signal;
#diff as histogram
def diff = _ppo - _signal;
#mobius divergence calc
def pmainh = CompoundValue(1,
if pmain < 0 then Double.NaN
else if pmain crosses above 0 then pmain
else if pmain > 0 and pmain > pmainh[1]
then pmain else pmainh[1], 0);
def Valueh = CompoundValue(1,
if pmain < 0 then Double.NaN
else if pmain crosses above 0 then high
else if pmain > 0 and high > Valueh[1] then high
else Valueh[1], 0);
plot divLowSignal = if pmain > 0 and high > Valueh[1] and pmain < pmainh[1] then DOWN
else Double.NaN;
divLowSignal.SetPaintingStrategy(PaintingStrategy.SQUARES);
divLowSignal.SetLineWeight(2);
divLowSignal.SetDefaultColor(Color.dark_orange);
def pmainL = CompoundValue(1, if pmain > 0 then Double.NaN
else if pmain crosses below 0 then pmain
else if pmain < 0 and pmain < pmainl[1] then pmain
else pmainl[1], 0);
def ValueL = CompoundValue(1, if pmain > 0 then Double.NaN
else if pmain crosses below 0 then low
else if pmain < 0 and low < Valuel[1] then low
else Valuel[1], 0);
plot ARRSignall = if pmain < 0 and low < Valuel[1] and pmain > pmainl[1] then UP
else Double.NaN;
ARRSignall.SetPaintingStrategy(PaintingStrategy.SQUARES);
ARRSignall.SetLineWeight(2);
ARRSignall.SetDefaultColor(Color.BLUE);
#END
This indicator repaints when plotted on top of price
It changes when I scroll the chart back and forth, prices that were below ,become above the indicator and vice versayeah i notice that the other version made at the end might repaint because the mean is constantly changing. is that what you mean @henry1224
yeah possibly some versions of it might because i seen we are using the average but i dont believe this one does https://tos.mx/4ZOTEp6, check it out you might know better than me but i have been scrolling and i havent had that issue, im not sure.It changes when I scroll the chart back and forth, prices that were below ,become above the indicator and vice versa
# WT_LB Short Name TV
# Modidied into an MTF version by BenTen at UseThinkScript.com
declare lower;
input aggregationPeriod = AggregationPeriod.DAY;
def close = close (period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
input Channel_Length = 10; #10
input Average_Length = 21; #10
input over_bought_1 = 60;
input over_bought_2 = 53;
input over_sold_1 = -60;
input over_sold_2 = -53;
input show_bubbles = yes;
input show_sec_bbls = no;
input show_alerts = yes;
def ap = (High + Low + Close) / 3;
def esa = ExpAverage(ap, Channel_Length);
def d = ExpAverage(AbsValue(ap - esa), Channel_Length);
def ci = (ap - esa) / (0.015 * d);
def tci = ExpAverage(ci, Average_Length);
def wt1 = tci;
def wt2 = SimpleMovingAvg(wt1, 4);
#def zero = 0;
plot zero = 0;
zero.SetDefaultColor( Color.GRAY );
plot obLevel1 = over_bought_1;
obLevel1.SetDefaultColor(Color.RED);
plot osLevel1 = over_sold_1;
osLevel1.SetDefaultColor(Color.GREEN);
plot obLevel2 = over_bought_2;
obLevel2.SetDefaultColor(Color.RED);
obLevel2.SetStyle(Curve.SHORT_DASH);
plot osLevel2 = over_sold_2;
osLevel2.SetDefaultColor(Color.GREEN);
osLevel2.SetStyle(Curve.SHORT_DASH);
plot wt1_1 = wt1;
wt1_1.SetDefaultColor(Color.GREEN);
plot wt2_1 = wt2;
wt2_1.SetDefaultColor(Color.RED);
wt2_1.SetStyle(Curve.POINTS);
plot wt3 = (wt1 - wt2);
wt3.SetDefaultColor(Color.BLUE);
wt3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
def signal1 = wt1 crosses above wt2 and wt1 < over_sold_2;
plot Signal = if signal1 then (signal1 * over_sold_2) else Double.NaN;
Signal.SetDefaultColor(Color.GREEN);
Signal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Signal.SetLineWeight(3);
Signal.HideTitle();
def signal2 = wt1 crosses below wt2 and wt1 > over_bought_2;
plot Signal2_ = if signal2 then (signal2 * over_bought_2) else Double.NaN;
Signal2_.SetDefaultColor(Color.RED);
Signal2_.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Signal2_.SetLineWeight(3);
Signal2_.HideTitle();
# WT_LB Short Name TV
#deviation_blue_wave
#MTF
declare lower;
input aggregationPeriod = AggregationPeriod.DAY;
def close = close (period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
input Channel_Length = 10; #10
input Average_Length = 21; #10
input over_bought_1 = 60;
input over_bought_2 = 53;
input over_sold_1 = -60;
input over_sold_2 = -53;
input show_bubbles = yes;
input show_sec_bbls = no;
input show_alerts = yes;
def ap = (High + Low + Close) / 3;
def esa = ExpAverage(ap, Channel_Length);
def d = ExpAverage(AbsValue(ap - esa), Channel_Length);
def ci = (ap - esa) / (0.015 * d);
def tci = ExpAverage(ci, Average_Length);
def wt1 = tci;
def wt2 = SimpleMovingAvg(wt1, 3);
#def zero = 0;
def wt1_1 = wt1;
#wt1_1.SetDefaultColor(Color.GREEN);
def wt2_1 = wt2;
#wt2_1.SetDefaultColor(Color.RED);
#wt2_1.SetStyle(Curve.POINTS);
#plot wt3 = (wt1 - wt2);
#wt3.SetDefaultColor(Color.YELLOW);
#wt3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#addcloud(wt3, 0, color.yellow);
#........................................
plot mean = inertiaAll((wt1+wt2)/2);
mean.setDefaultColor(color.cyan);
def dev1 = (stdevAll(wt1)+stdevAll(wt2))/2;
plot up = wt1_1+ dev1*2;
plot down = wt1_1- dev1*2;
plot avg2 =(up-down/up+down)-mean;
avg2.setDefaultColor(createcolor(250,10,10));
avg2.setDefaultColor(COLOR.PINK);
plot avg3 = 1.0* (up+down/up+down)-dev1;
avg3.setDefaultColor(color.white);
up.SetDefaultColor(Color.GREEN);
up.SetLineWeight(2);
down.SetDefaultColor(Color.RED);
down.SetLineWeight(2);
AddCloud(0, tci[0], createcolor(20,170,240), createcolor(20,170,240));
AddCloud(0, tci[0], createcolor(20,170,240), createcolor(20,170,240));
AddCloud(0, tci[0], createcolor(20,170,240), createcolor(20,170,240));
AddCloud(0, tci[0], createcolor(20,170,240), createcolor(20,170,240));
AddCloud(WT1, WT2, Color.white, Color.RED);
AddCloud(WT1, WT2, Color.white, Color.RED);
AddCloud(wt1, 0, CreateColor(40, 82, 248), CreateColor(30, 82, 248));
AddCloud(wt1, 0, CreateColor(40, 82, 248), CreateColor(30, 82, 248));
def W1 = if wt1 < wt2 then wt2 else wt1;
def W2 = if wt1 > wt2 then wt2 else wt2;
AddCloud(W1, W2, Color.WHITE, Color.WHITE);
AddCloud(W1, W2, Color.WHITE, Color.WHITE);
AddCloud(W1, W2, Color.WHITE, Color.WHITE);
AddCloud(W1, W2, Color.WHITE, Color.WHITE);
#END
#WT_LB Short Name TV
declare lower;
input Channel_Length = 10; #10
input Average_Length = 21; #10
input over_bought_1 = 60;
input over_bought_2 = 53;
input over_sold_1 = -60;
input over_sold_2 = -53;
input show_bubbles = yes;
input show_sec_bbls = no;
input show_alerts = yes;
def ap = hlc3;
def esa = ExpAverage(ap, Channel_Length);
def d = ExpAverage(AbsValue(ap - esa), Channel_Length);
def ci = (ap - esa) / (0.015 * d);
def tci = ExpAverage(ci, Average_Length);
def wt1 = tci;
def wt2 = SimpleMovingAvg(wt1, 4);
def zero = 0;
plot obLevel1 = over_bought_1;
obLevel1.SetDefaultColor(Color.RED);
plot osLevel1 = over_sold_1;
osLevel1.SetDefaultColor(Color.GREEN);
plot obLevel2 = over_bought_2;
obLevel2.SetDefaultColor(Color.RED);
obLevel2.SetStyle(Curve.SHORT_DASH);
plot osLevel2 = over_sold_2;
osLevel2.SetDefaultColor(Color.GREEN);
osLevel2.SetStyle(Curve.SHORT_DASH);
plot wt1_1 = wt1;
wt1_1.SetDefaultColor(Color.GREEN);
plot wt2_1 = wt2;
wt2_1.SetDefaultColor(Color.RED);
wt2_1.SetStyle(Curve.POINTS);
def signal1 = wt1 crosses above wt2 and wt1 < over_sold_2;
plot Signal = if signal1 then (signal1 * over_sold_2) else Double.NaN;
Signal.SetDefaultColor(Color.GREEN);
Signal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Signal.SetLineWeight(3);
Signal.HideTitle();
def signal2 = wt1 crosses below wt2 and wt1 > over_bought_2;
plot Signal2_ = if signal2 then (signal2 * over_bought_2) else Double.NaN;
Signal2_.SetDefaultColor(Color.RED);
Signal2_.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Signal2_.SetLineWeight(3);
Signal2_.HideTitle();
#Name: DonchianChannel
#Programmed By: Chris Ball ([email protected]) on 10/23/08
#Posted At: http://chartingwithchris.blogspot.com
#Description: This is a channel system that is used frequently for trend trading. Google the term "turtle trader" for more information.
#Modified 2020-06-10 by rad14733 to utilize AddCloud()
input length_donchian = 34;
plot upperBand = Highest(wt1_1[1], length_donchian);
plot lowerBand = Lowest(wt1_1[1], length_donchian);
plot middleBand = (upperBand + lowerBand) / 2;
upperBand.SetDefaultColor(Color.DARK_GRAY);
lowerBand.SetDefaultColor(Color.DARK_GRAY);
middleBand.SetDefaultColor(Color.Orange);
AddCloud(upperBand, lowerBand, Color.DARK_GRAY, Color.WHITE);
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
![]() |
L3 Banker Fund Flow Trend Oscillator for ThinkOrSwim | Indicators | 37 | |
C | Bull Bear Power VOID Oscillator For ThinkOrSwim | Indicators | 21 | |
M | SuperTrend Oscillator [LUX] For ThinkOrSwim | Indicators | 7 | |
![]() |
Klinger Volume Oscillator for ThinkorSwim | Indicators | 5 | |
F | Savage Oscillator for ThinkorSwim | Indicators | 143 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.