Hello, any reason why is not recognizing FullK? ThanksYou can color any plot using the AssignValueColor() function.
Ruby:FullK.AssignValueColor( if FullK > FullK[1] then Color.GREEN else if FullK < FullK[1] then Color.RED else Color.GRAY );
Hello, any reason why is not recognizing FullK? ThanksYou can color any plot using the AssignValueColor() function.
Ruby:FullK.AssignValueColor( if FullK > FullK[1] then Color.GREEN else if FullK < FullK[1] then Color.RED else Color.GRAY );
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
plot FullK = reference StochasticFull().FullK ;
FullK.AssignValueColor(
if FullK > FullK[1] then Color.GREEN
else if FullK < FullK[1] then Color.RED
else Color.GRAY
);
declare lower;
# Base code by TD Ameritrade IP Company, Inc. (c) 2008-2021
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;
# signal
def fullKCrossesFromoverbought= FullK[1] > 80 and FullK < 80;
def fullKCrossesBelowFullD = FullK[1] > FullD[1] and FullK < FullD;
plot signaldown = fullKCrossesFromoverbought and fullKCrossesBelowFullD;
signaldown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down);
signaldown.SetDefaultColor(Color.magenta);
def fullKCrossesFromoversold = FullK[1] < 20 and FullK > 20;
def fullKCrossesAboveFullD = FullK[1] < FullD[1] and FullK > FullD;
plot signalup = fullKCrossesFromoversold and fullKCrossesAboveFullD;
signalup.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signalup.SetDefaultColor(Color.cyan);
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
def stoch = StochasticFull(over_bought = over_bought, over_sold = over_sold, KPeriod = KPeriod, slowing_period = slowing_period, averageType = averageType).FullK;
def StoK = reference round(StochasticFull.FullK);
def StoD = reference round(StochasticFull.FullD);
DefineGlobalColor("Neutral", Color.GRAY);
DefineGlobalColor("Overbought", Color.DARK_RED);
DefineGlobalColor("Oversold", Color.DARK_GREEN);
DefineGlobalColor("Mix", Color.YELLOW);
AddLabel(Yes, "Stoch(" +Kperiod + "):" + round(stoch, 1) if stoch > over_bought then GlobalColor("Overbought") else if stoch < over_sold then GlobalColor("Oversold") else if StoD < StoK then if stoch > 60 then GlobalColor("Mix") else GlobalColor("Neutral") else GlobalColor("Neutral"));
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
def stoch = StochasticFull(over_bought = over_bought, over_sold = over_sold, KPeriod = KPeriod, slowing_period = slowing_period, averageType = averageType).FullK;
def StoK = reference StochasticFull.FullK;
def StoD = reference StochasticFull.FullD;
DefineGlobalColor("pretrend", CreateColor(50, 200, 255)) ;
DefineGlobalColor("TrendBEGIN", CreateColor(0, 0, 255)) ;
DefineGlobalColor("rising", CreateColor(0, 165, 0)) ;
DefineGlobalColor("TrendEnd", CreateColor(255, 204, 0)) ;
DefineGlobalColor("maxxed", CreateColor(255, 139 ,61)) ;
DefineGlobalColor("falling", CreateColor(225, 0, 0)) ;
DefineGlobalColor("neutral", CreateColor(204, 204, 204)) ;
AddLabel(yes,
if StoK < over_sold and StoK crosses above StoD then "Stoch Buy" else
if StoK > over_bought and StoK crosses below StoD then "Stoch Sell" else
if Stoch < over_sold then "Stoch pre-trend " +round(Stoch,0) else
if Stoch > over_bought then "Stoch maxxed " +round(Stoch,0) else
if Stoch crosses above over_sold then "Stoch TREND BEGIN!" else
if Stoch crosses below over_bought then "Stoch TREND END!" else
if Stoch >= Stoch[1] then "👍 " + Round(Stoch, 0) else
if Stoch < Stoch[1] then "👎 " + Round(Stoch, 0) else
"Stoch Neutral " +round(Stoch,0),
if StoK < over_sold and StoK crosses above StoD then color.cyan else
if StoK > over_bought and StoK crosses below StoD then color.magenta else
if Stoch < over_sold then GlobalColor("pretrend") else
if Stoch > over_bought then GlobalColor("maxxed") else
if Stoch crosses above over_sold then GlobalColor("TrendBEGIN") else
if Stoch crosses below over_bought then GlobalColor("TrendEND") else
if Stoch > Stoch[1] and Stoch>40 then color.Dark_green else
if Stoch < Stoch[1] and Stoch<40 then color.Dark_red else
if Stoch > Stoch[1] then GlobalColor("rising") else
if Stoch > Stoch[1] then GlobalColor("falling")
else GlobalColor("neutral")) ;
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
def stoch = StochasticFull(over_bought = over_bought, over_sold = over_sold, KPeriod = KPeriod, slowing_period = slowing_period, averageType = averageType).FullK;
def StoK = reference StochasticFull.FullK;
def StoD = reference StochasticFull.FullD;
AddLabel(yes,
if StoK < over_sold and StoK crosses above StoD then "BUY" else
if StoK > over_bought and StoK crosses below StoD then "SELL" else
if Stoch < over_sold then "pre-trend " + Round(Stoch, 0) else
if Stoch > over_bought then "maxxed " + Round(Stoch, 0) else
if Stoch crosses above over_sold then "TREND BEGIN!" else
if Stoch crosses below over_bought then "TREND END!" else
if Stoch >= Stoch[1] then "👍 " + Round(Stoch, 0) else
if Stoch < Stoch[1] then "👎 " + Round(Stoch, 0) else "Neutral " + Round(Stoch, 0),
if Stoch crosses above over_sold then color.white else
if Stoch > Stoch[1] and Stoch>40 then color.white else
if Stoch < Stoch[1] and Stoch<40 then color.white else
color.black );
AssignBackgroundColor(
if StoK < over_sold and StoK crosses above StoD then color.cyan else
if StoK > over_bought and StoK crosses below StoD then color.magenta else
if Stoch < over_sold then CreateColor(50, 200, 255) else
if Stoch > over_bought then CreateColor(255, 139 ,61) else
if Stoch crosses above over_sold then CreateColor(0, 0, 255) else
if Stoch crosses below over_bought then CreateColor(255, 204, 0) else
if Stoch > Stoch[1] and Stoch>40 then color.Dark_green else
if Stoch < Stoch[1] and Stoch<40 then color.Dark_red else
if Stoch > Stoch[1] then CreateColor(0, 165, 0) else
if Stoch < Stoch[1] then CreateColor(225, 0, 0) else
CreateColor(204, 204, 204)) ;
Thank you so much for the reply! I will give it a shot, I appreciate you taking the time, did you write this?@TTs_MikeC These Stochastic Label and WatchList scripts may have more than you asked but it has all the pieces you need to customize to your needs.
The watchlist is so you can see the various labels and modify as needed.
View attachment 766
Shared Chart Labels: http://tos.mx/XBbftQb Click here for --> Easiest way to load shared links
Shared WatchList Labels: http://tos.mx/2wmem9E
Here is the Script for Chart Labels:
Here is the Script for WatchList Column:Ruby:input over_bought = 80; input over_sold = 20; input KPeriod = 10; input slowing_period = 3; input averageType = AverageType.SIMPLE; def stoch = StochasticFull(over_bought = over_bought, over_sold = over_sold, KPeriod = KPeriod, slowing_period = slowing_period, averageType = averageType).FullK; def StoK = reference StochasticFull.FullK; def StoD = reference StochasticFull.FullD; DefineGlobalColor("pretrend", CreateColor(50, 200, 255)) ; DefineGlobalColor("TrendBEGIN", CreateColor(0, 0, 255)) ; DefineGlobalColor("rising", CreateColor(0, 165, 0)) ; DefineGlobalColor("TrendEnd", CreateColor(255, 204, 0)) ; DefineGlobalColor("maxxed", CreateColor(255, 139 ,61)) ; DefineGlobalColor("falling", CreateColor(225, 0, 0)) ; DefineGlobalColor("neutral", CreateColor(204, 204, 204)) ; AddLabel(yes, if StoK < over_sold and StoK crosses above StoD then "Stoch Buy" else if StoK > over_bought and StoK crosses below StoD then "Stoch Sell" else if Stoch < over_sold then "Stoch pre-trend " +round(Stoch,0) else if Stoch > over_bought then "Stoch maxxed " +round(Stoch,0) else if Stoch crosses above over_sold then "Stoch TREND BEGIN!" else if Stoch crosses below over_bought then "Stoch TREND END!" else if Stoch >= Stoch[1] then "👍 " + Round(Stoch, 0) else if Stoch < Stoch[1] then "👎 " + Round(Stoch, 0) else "Stoch Neutral " +round(Stoch,0), if StoK < over_sold and StoK crosses above StoD then color.cyan else if StoK > over_bought and StoK crosses below StoD then color.magenta else if Stoch < over_sold then GlobalColor("pretrend") else if Stoch > over_bought then GlobalColor("maxxed") else if Stoch crosses above over_sold then GlobalColor("TrendBEGIN") else if Stoch crosses below over_bought then GlobalColor("TrendEND") else if Stoch > Stoch[1] and Stoch>40 then color.Dark_green else if Stoch < Stoch[1] and Stoch<40 then color.Dark_red else if Stoch > Stoch[1] then GlobalColor("rising") else if Stoch > Stoch[1] then GlobalColor("falling") else GlobalColor("neutral")) ;
Ruby:input over_bought = 80; input over_sold = 20; input KPeriod = 10; input slowing_period = 3; input averageType = AverageType.SIMPLE; def stoch = StochasticFull(over_bought = over_bought, over_sold = over_sold, KPeriod = KPeriod, slowing_period = slowing_period, averageType = averageType).FullK; def StoK = reference StochasticFull.FullK; def StoD = reference StochasticFull.FullD; AddLabel(yes, if StoK < over_sold and StoK crosses above StoD then "BUY" else if StoK > over_bought and StoK crosses below StoD then "SELL" else if Stoch < over_sold then "pre-trend " + Round(Stoch, 0) else if Stoch > over_bought then "maxxed " + Round(Stoch, 0) else if Stoch crosses above over_sold then "TREND BEGIN!" else if Stoch crosses below over_bought then "TREND END!" else if Stoch >= Stoch[1] then "👍 " + Round(Stoch, 0) else if Stoch < Stoch[1] then "👎 " + Round(Stoch, 0) else "Neutral " + Round(Stoch, 0), if Stoch crosses above over_sold then color.white else if Stoch > Stoch[1] and Stoch>40 then color.white else if Stoch < Stoch[1] and Stoch<40 then color.white else color.black ); AssignBackgroundColor( if StoK < over_sold and StoK crosses above StoD then color.cyan else if StoK > over_bought and StoK crosses below StoD then color.magenta else if Stoch < over_sold then CreateColor(50, 200, 255) else if Stoch > over_bought then CreateColor(255, 139 ,61) else if Stoch crosses above over_sold then CreateColor(0, 0, 255) else if Stoch crosses below over_bought then CreateColor(255, 204, 0) else if Stoch > Stoch[1] and Stoch>40 then color.Dark_green else if Stoch < Stoch[1] and Stoch<40 then color.Dark_red else if Stoch > Stoch[1] then CreateColor(0, 165, 0) else if Stoch < Stoch[1] then CreateColor(225, 0, 0) else CreateColor(204, 204, 204)) ;
input OB = 70 ;
input OS = 30 ;
def StochFullD = reference StochasticFull("over bought" = 70, "over sold" = 30, "k period" = 5, "d period" = 3)."FullD" ;
def StochFullK = reference StochasticFull("over bought" = 70, "over sold" = 30, "k period" = 5, "d period" = 3)."FullK" ;
def SMA = SimpleMovingAvg()."SMA" ;
plot SMA20 = SimpleMovingAvg("length" = 20)."SMA" ;
def BidTrigger = close(priceType = PriceType.BID) is greater than SMA20 and
StochFullD is less than or equal to OB and
StochFullK is greater than or equal to StochFullD ;
def AskTrigger = close(priceType = PriceType.ASK) is less than SMA20 and
StochFullD is greater than OS and
StochFullK is less than or equal to StochFullD and
SMA is less than or equal to SMA20;
plot BidArrow = if BidTrigger then high else double.NaN ;
BidArrow.SetPaintingStrategy(paintingStrategy.ARROW_down);
plot AskArrow = if AskTrigger then low else double.NaN ;
AskArrow.SetPaintingStrategy(paintingStrategy.ARROW_UP);
AddLabel(yes, "Bid: " +close(priceType = PriceType.BID) +" | " +"Ask: " +close(priceType = PriceType.ASK), color.blue);
Alert(BidTrigger, "BidTrigger", Alert.Bar, Sound.Ding);
Alert(BidTrigger, "AskTrigger", Alert.Bar, Sound.Ring);
How would I change this to daily.I was looking for the exact same scan and found this great tutorial on youtube
I ended up with this - It combines stochastic slow + macd
The scan is designed for a Weekly timeframe
Enjoy
Ruby:# Courtesy of Hahn-Tech, LLC # https://www.youtube.com/watch?v=VOJwH9U0aL0 # macd scan input fastLength = 12; input slowLength = 26; input MACDLength = 9; input averageTypeMACD = AverageType.EXPONENTIAL; input showBreakoutSignals = no; def Value = MovingAverage(averageTypeMACD, close, fastLength) - MovingAverage(averageTypeMACD, close, slowLength); def Avg = MovingAverage(averageTypeMACD, Value, MACDLength); def Diff = Value - Avg; # stochastic slow scan input over_bought = 80; input over_sold = 20; input KPeriod = 14; input DPeriod = 7; input priceH = high; input priceL = low; input priceC = close; input averageTypeStoch = AverageType.SIMPLE; input showBreakoutSignalsStoch = {default "No", "On SlowK", "On SlowD", "On SlowK & SlowD"}; def SlowK = reference StochasticFull(over_bought,over_sold,KPeriod,DPeriod,priceH,priceL,priceC,3,averageTypeStoch).FullK; def SlowD = reference StochasticFull(over_bought,over_sold,KPeriod,DPeriod,priceH,priceL,priceC,3,averageTypeStoch).FullD;; # Establish crossover of slowd (SMA) above slowk (high/low prices period) plot Scan = (SlowK[1] < SlowD[1]) and (SlowK > SlowD) # Only look at slowk value under oversold value of 20 and (lowest(SlowK[1], 3) < 20) # Macd should be rising and (Diff[1] > Diff[2]);
We don't have anything like what you describe on the forum. There is a ToS Double Smoothed Stochastic is also a smoothed Stochastic as you describe but it is calculated differently. Maybe you can make it work for you.Hello,
I was wondering if anyone could help make a stochastic scanner for the details provided below.
I want the %K line to be passing through the lower band length of 32 on the stochastic and preferably the %D line also passing through it. I was wondering if we could limit it to show no stocks with those lines higher than 50.
This would be on a daily time length and my settings on are all provided in the pictures above.
Thanks in advance guys!
ToS does not have an indicator called "StochasticWithSignals".I like the "StochasticWithSignals" indicator and was wanting help in deconstructing how it worked.
When it comes to the signals, I get how crossing the overbought and oversold lines generate signal arrows, but I am lost on what kind of event triggers the up and down arrows between the overbought and oversold zones.
I had assumed it was perhaps when a fast k crossed a slow d or vice versa, but comparing it to other Stoch indicators that show crossovers, none seem to match the middle zone signal events.
Any insights would be most welcome. Thank you.
| 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.