Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

Stochastic indicator help for TOS

Posted by NMR 
NMR
Stochastic indicator help for TOS
March 21, 2014 07:39PM
Can a 'expert' TOS thinkscripter help me write some code to create a study? I am trying to write code for a Stochastic indicator (%K) for when it gets over 80, or below 20 where it turns the background a dark gray- I have started this, but cant seen to get it to work properly:

plot Data = close and StochasticSlow("k period" = 5, "d period" = 3)."SlowK" is greater than or equal to 80 and StochasticSlow("k period" = 5, "d period" = 3)."SlowK" is less than or equal to 20;

assignbackgroundColor(if "SlowK" is less than or equal to 20"SlowK" is less than or equal to 80 then color.gray else if close < lowerband then color.gray else color.current);

I'd love some suggestions !!!

Thank you in advance.
Re: Stochastic indicator help for TOS
March 21, 2014 08:14PM
def SlowK = StochasticSlow("k period" = 5, "d period" = 3)."SlowK";
def Condition = if SlowK >= 80 or SlowK <= 20 then 1 else 0;
assignbackgroundcolor(if Condition == 1 then color.gray else color.current);
NMR
Re: Stochastic indicator help for TOS
March 21, 2014 08:39PM
Thank you very much !
I really appreciate this.
Sorry, only registered users may post in this forum.

Click here to login