Join useThinkScript to post your question to a community of 21,000+ developers and traders.
declare lower;
input lookback= 1;
input over_bought = 80;
input over_sold = 20;
input KPeriod = 5;
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 2;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};
def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
def FullK = MovingAverage(averageType, FastK, slowing_period);
def FullD = MovingAverage(averageType, FullK, DPeriod);
def bull_cross = FullK crosses above FullD;
def bear_cross = FullK crosses below FullD;
def bull_lookback = highest(bull_cross, lookback);
def bear_lookback = highest(bear_cross, lookback);
plot signal = if bull_lookback then 2 else if bear_lookback then 1 else 0;
signal.AssignValueColor(if signal == 2 then Color.Dark_Green
else if signal == 1 then Color.Dark_Red else Color.Dark_Orange);
AssignBackgroundCOlor(if signal == 2 then Color.Dark_Green
else if signal == 1 then Color.Dark_Red else Color.Dark_Orange);
#######
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC – lowest_k;
def c2 = Highest(priceH, KPeriod) – lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
def FullK = MovingAverage(averageType, FastK, slowing_period);
def FullD = MovingAverage(averageType, FullK, DPeriod);
#plot OverBought = over_bought;
#plot OverSold = over_sold;
#FullK.SetDefaultColor(GetColor(5));
#FullD.SetDefaultColor(GetColor(0));
#OverBought.SetDefaultColor(GetColor(1));
#OverSold.SetDefaultColor(GetColor(1));
#AssignPriceColor (if Fullk > FullD then color.green else color.red);
AssignBackgroundColor(if Fullk > FullD then color.green else color.red);
plot value = FullK;
Yes, it is, but the numbers and setting is different between them, TS stochastic slow default setting is 14,3,3,1,20, TOS only has 10,10. Just couldn't find it anywhere, hopefully someone here has that script, thanks for your help.
Just change the settings to match and it should paint fairly close to the same as in TradeStation...Yes, it is, but the numbers and setting is different between them, TS stochastic slow default setting is 14,3,3,1,20, TOS only has 10,10. Just couldn't find it anywhere, hopefully someone here has that script, thanks for your help.
declare lower;
input over_bought = 80;
input sell_signal = 68;
input over_sold = 32;
input aggregationPeriod = AggregationPeriod.WEEK;
input KPeriod = 10;
input DPeriod = 3;
input slowing_period = 3;
#input slowk =10;
#input slowd = 3;
#input percentchg = close;
plot FullK = Average((close(period = aggregationPeriod) - Lowest(low(period = aggregationPeriod), KPeriod)) / (Highest(high(period = aggregationPeriod), KPeriod) - Lowest(low(period = aggregationPeriod), KPeriod)) * 100, slowing_period);
plot FullD = Average(Average((close(period = aggregationPeriod) - Lowest(low(period = aggregationPeriod), KPeriod)) / (Highest(high(period = aggregationPeriod), KPeriod) - Lowest(low(period = aggregationPeriod), KPeriod)) * 100, slowing_period), DPeriod);
plot OverBought = over_bought;
plot sellsignal = sell_signal;
plot OverSold = over_sold;
#plot close = ((dperiod / kperiod )-1) * 100;
plot xover = StochasticSlow("k period" = 5, "d period" = 1)."SlowK" crosses below 80;
xover.AssignValueColor(if xover == 1 then color.green else color.black);
AssignBackgroundColor(if xover == 1 then color.green else color.black);
#
# TD Ameritrade IP Company, Inc. (c) 2008-2020
#
declare lower;
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};
def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
plot FullK = MovingAverage(averageType, FastK, slowing_period);
plot FullD = MovingAverage(averageType, FullK, DPeriod);
plot OverBought = over_bought;
plot OverSold = over_sold;
def upK = FullK crosses above OverSold;
def upD = FullD crosses above OverSold;
def downK = FullK crosses below OverBought;
def downD = FullD crosses below OverBought;
plot UpSignal;
plot DownSignal;
switch (showBreakoutSignals) {
case "No":
UpSignal = Double.NaN;
DownSignal = Double.NaN;
case "On FullK":
UpSignal = if upK then OverSold else Double.NaN;
DownSignal = if downK then OverBought else Double.NaN;
case "On FullD":
UpSignal = if upD then OverSold else Double.NaN;
DownSignal = if downD then OverBought else Double.NaN;
case "On FullK & FullD":
UpSignal = if upK or upD then OverSold else Double.NaN;
DownSignal = if downK or downD then OverBought else Double.NaN;
}
UpSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");
DownSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");
FullK.SetDefaultColor(GetColor(5));
FullD.SetDefaultColor(GetColor(0));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
AssignPriceColor(if FullD >= 0 then CreateColor (128,0,106)
else if FullD >= 10 then CreateColor (204,0,68)
else if FullD >= 20 then CreateColor (255,0,0)
else if FullD >= 30 then CreateColor (255,102,25)
else if FullD >= 40 then CreateColor (255,170,0)
else if FullD >= 50 then CreateColor (170,255,0)
else if FullD >= 60 then CreateColor (43,255,0)
else if FullD >= 70 then CreateColor (0,255,170)
else if FullD >= 80 then CreateColor (0,213,255)
else if FullD >= 90 then CreateColor (221,204,255)
else CreateColor (255,255,25) );
#
# TD Ameritrade IP Company, Inc. (c) 2008-2020
#
declare lower;
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};
def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
plot FullK = MovingAverage(averageType, FastK, slowing_period);
plot FullD = MovingAverage(averageType, FullK, DPeriod);
plot OverBought = over_bought;
plot OverSold = over_sold;
def upK = FullK crosses above OverSold;
def upD = FullD crosses above OverSold;
def downK = FullK crosses below OverBought;
def downD = FullD crosses below OverBought;
plot UpSignal;
plot DownSignal;
switch (showBreakoutSignals) {
case "No":
UpSignal = Double.NaN;
DownSignal = Double.NaN;
case "On FullK":
UpSignal = if upK then OverSold else Double.NaN;
DownSignal = if downK then OverBought else Double.NaN;
case "On FullD":
UpSignal = if upD then OverSold else Double.NaN;
DownSignal = if downD then OverBought else Double.NaN;
case "On FullK & FullD":
UpSignal = if upK or upD then OverSold else Double.NaN;
DownSignal = if downK or downD then OverBought else Double.NaN;
}
UpSignal.SetHiding(showBreakoutSignals == showBreakoutSignals."No");
DownSignal.SetHiding(showBreakoutSignals == showBreakoutSignals."No");
FullK.SetDefaultColor(GetColor(5));
FullD.SetDefaultColor(GetColor(0));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
AssignPriceColor(if FullD <= 0 then CreateColor (128,0,106)
else if FullD >= 90 then CreateColor (221,204,255)
else if FullD >= 80 then CreateColor (0,213,255)
else if FullD >= 70 then CreateColor (0,255,170)
else if FullD >= 60 then CreateColor (43,255,0)
else if FullD >= 50 then CreateColor (170,255,0)
else if FullD >= 40 then CreateColor (255,170,0)
else if FullD >= 30 then CreateColor (255,102,25)
else if FullD >= 20 then CreateColor (255,0,0)
else if FullD >= 10 then CreateColor (204,0,68)
else CreateColor (255,255,25) );
# Cust_Stochastic_Full_ColorBars v1.1
# Coded using the StochasticFull code from TOS.
# Added the Color Bars to make spotting divergence in price action and Stochastic indicator easier to spot.
# Wallace Stochastic Full Color Bars
# Version 1.1
declare lower;
input KPeriod = 7;
input DPeriod = 2;
input slowing_period = 2;
input averageType = AverageType.SIMPLE;
input priceH = high;
input priceL = low;
input priceC = close;
input over_bought = 80;
input over_sold = 20;
input centerline = 50;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};
input l1 = 6;
input l2 = 12;
input l3 = 20;
input l4 = 28;
input l5 = 35;
input m1 = 46;
input m2 = 54;
input h1 = 65;
input h2 = 72;
input h3 = 80;
input h4 = 90;
input h5 = 94;
def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
plot FullK = MovingAverage(averageType, FastK, slowing_period);
plot FullD = MovingAverage(averageType, FullK, DPeriod);
plot OverBought = over_bought;
plot OverSold = over_sold;
plot CenterL = centerline;
def upK = FullK crosses above OverSold;
def upD = FullD crosses above OverSold;
def downK = FullK crosses below OverBought;
def downD = FullD crosses below OverBought;
plot UpSignal;
plot DownSignal;
switch (showBreakoutSignals) {
case "No":
UpSignal = Double.NaN;
DownSignal = Double.NaN;
case "On FullK":
UpSignal = if upK then OverSold else Double.NaN;
DownSignal = if downK then OverBought else Double.NaN;
case "On FullD":
UpSignal = if upD then OverSold else Double.NaN;
DownSignal = if downD then OverBought else Double.NaN;
case "On FullK & FullD":
UpSignal = if upK or upD then OverSold else Double.NaN;
DownSignal = if downK or downD then OverBought else Double.NaN;
}
UpSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");
DownSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");
FullK.SetDefaultColor(GetColor(5));
FullD.SetDefaultColor(GetColor(0));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
AssignPriceColor(
if FullD >= h5 then CreateColor (255,245,255)
else if FullD >= h4 then CreateColor (255,190,248)
else if FullD >= h3 then CreateColor (0,213,255)
else if FullD >= h2 then CreateColor (0,255,170)
else if FullD >= h1 then CreateColor (43,255,0)
else if FullD >= m2 then CreateColor (170,255,0)
else if FullD >= m1 then CreateColor (255,255,115)
else if FullD >= l5 then CreateColor (255,170,0)
else if FullD >= l4 then CreateColor (255,102,25)
else if FullD >= l3 then CreateColor (255,55,0)
else if FullD >= l2 then CreateColor (200,0,15)
else if FullD >= l1 then CreateColor (177,17,68)
else if FullD >= 0 then CreateColor (128,0,106)
else CreateColor (255,255,25) );
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
Elastic Stochastic for ThinkorSwim -Upper and Lower indicator | Indicators | 8 | ||
Stochastic Scalper for ThinkorSwim | Indicators | 12 | ||
Repaints Mobius Full Stochastic MTF for ThinkorSwim | Indicators | 4 | ||
M | Premier Stochastic Oscillator | Indicators | 91 | |
MoneyWave Stochastic Indicator for ThinkorSwim | Indicators | 8 |
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.