MrPoopzALot
New member
- Platform
-
- Thinkorswim
Hello Traders, Here I found this great code for a Super Smooth Stochastic. I would like to plot the 21 period exponential average of the K line, but I do not know how to do it. I'm sure its a simple thing to do. Could anyone here help me solve this riddle. Much blessings would come your way. Thank you
This is the original code with original notes.

This is the original code with original notes.
Ruby:
#Here's a Super Smooth Stochastic written for a trading room. As Volatility increases and so does intraday range oscillators will become useful signals again.
#Mobius: The above code is particularly good at short aggs like 2min with futures using good Risk management - Risk Off trades
# Super Smooth Stochastic
# Mobius
# V01.02.2018
#Hint: Suggest 13 and above for Daily and 8 or less for Intraday
input length = 8; #hint length: Good starting points 13 Daily, 8 Intraday
input Arrows = no;
declare lower;
script g {
input data = close;
def w = (2 * Double.Pi / 20);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / 10) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def G = Power(alpha, 4) * data +
4 * (1 – alpha) * G[1] – 6 * Power( 1 - alpha, 2 ) * G[2] +
4 * Power( 1 - alpha, 3 ) * G[3] - Power( 1 - alpha, 4 ) * G[4];
plot Line = G;
}
def o = g(data = open);
def h = g(data = high);
def l = g(data = low);
def c = g(data = close);
def RSV = ((c - Lowest(l, length)) / (Highest(h, length) - Lowest(l, length))) * 100;
plot K = g(data = RSV);
K.SetDefaultColor(color.green);
plot D = g(data = K);
D.SetDefaultColor(color.red);
plot OB = if isNaN(c) then double.nan else 80;
OB.SetDefaultColor(Color.Gray);
OB.HideBubble();
OB.HideTitle();
plot OS = if isNaN(c) then double.nan else 20;
OS.SetDefaultColor(Color.Gray);
OS.HideBubble();
OS.HideTitle();
AddCloud(K, D, color.green, color.red);
plot upArrow = if Arrows and K < OS and K crosses above D
then K
else double.nan;
upArrow.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
upArrow.SetDefaultColor(Color.Green);
upArrow.HideBubble();
upArrow.HideTitle();
plot dnArrow = if Arrows and K > OB and K crosses below D
then K
else double.nan;
dnArrow.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
dnArrow.SetDefaultColor(Color.Red);
dnArrow.HideBubble();
dnArrow.HideTitle();
# End Code Stochastic Super Smooth
Last edited: