Label for StochasticSlowD


Category:
0
0

Hi Pete!

I am trying to add a label to my 1-min chart that would show the value of the stochasticSlowD with color indication: green when its uptrending or red when its downtrending.

Thank so much for your help!

Marked as spam
Posted by (Questions: 2, Answers: 3)
Asked on September 16, 2020 4:35 pm
148 views
0
Private answer

StochasticFull is identical to StochasticSlow. I really wish Thinkorswim never published a study named StochasticSlow. So many folks are using that and don't realize it is exactly the same as StochasticFull.

So every solution I provide for Stochastic will use the StochasticFull.

input stochOB = 80;
input stochOS = 20;
input kPeriod = 10;
input dPeriod = 10;
input stochPriceHigh = high;
input stochPriceLow = low;
input stochPriceClose = close;
input slowingPeriod = 3;
input stochAverageType = AverageType.SIMPLE;
def lowestK = Lowest(stochPriceLow, kPeriod);
def changeOne = stochPriceClose - lowestK;
def changeTwo = Highest(stochPriceHigh, kPeriod) - lowestK;
def fastK = if changeTwo != 0 then changeOne / changeTwo * 100 else 0;
def fullK = MovingAverage(stochAverageType, fastK, slowingPeriod);
def fullD = MovingAverage(stochAverageType, fullK, dPeriod);
AddLabel(yes, "FullD Direction", if fullD > fullD[1] then Color.GREEN else Color.RED);

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on September 16, 2020 4:53 pm
0
Thank you very much Pete! I didnt realize Slow and Full were exactly the same. Thank you for teaching me this. :) Is it possible to add the value of the Stochastic on the Label instead of 'fullD'? Thank you very much.
( at September 16, 2020 5:05 pm)
0
Replace the last line of the code with the following: AddLabel(yes, fullD, if fullD > fullD[1] then Color.GREEN else Color.RED);
( at September 16, 2020 5:43 pm)
0
Thank you Pete, just 'Blowing my mind'! Have a great day.
( at September 17, 2020 9:41 am)