AlexeyFirsov

ForNataly

Stochastic Indicator on Chart
Remove from Favorite Scripts Add to Favorite Scripts
study(title="ForNataly", shorttitle="ForNataly", overlay=true)
len = 14
smoothK = 3
smoothD = 3
upLine = 80
lowLine = 20

sbc = true
sbh = false 
sch = false
sl = true
sac = false
sacl = false

//Stoch formula
k = sma(stoch(close, high, low, len), smoothK)
d = sma(k, smoothD)

//Necessary for Highlight Bars
//aboveline = OverBought, belowline = Oversold Definitions
aboveLine = k > upLine ? 1 : 0
belowLine = k < lowLine ? 1 : 0 

//Only Necessary if you want you want Stochastic Croses
//Definition for Cross when Above High-Low lines
crossUp = (k[1] < d[1] and k[1] < lowLine[1]) and (k > d)  ? 1 : 0
crossDn = (k[1] > d[1] and k[1] > upLine[1]) and (k < d) ? 1 : 0

//Only Necessary if you want you want Stochastic Croses
//Definition for Cross that doesn't have to be above or below High and Low line.
crossUpAll = (k[1] < d[1] and k > d) ? 1 : 0
crossDownAll = (k[1] > d[1] and k < d) ? 1 : 0

overBought() => sbc and aboveLine 
overSold() => sbc and belowLine 


//Not Necessary if you just want Highlight Bars  - Extra Feature
//These are just the Letters B and Sell Based on Crosses
plotchar(sl and crossUp ? crossUp : na, title="Строгое соответствие на покупку", char='↑', location=location.belowbar, color=lime, transp=0, offset=0)
plotchar(sl and crossDn ? crossDn : na, title="Sell Signal Strict Criteria", char='↓', location=location.abovebar, color=red, transp=0, offset=0)
plotchar(sacl and crossUpAll ? crossUpAll : na, title="Buy Signal Any Cross Up", char='↓', location=location.belowbar, color=lime, transp=0, offset=0)
plotchar(sacl and crossDownAll ? crossDownAll : na, title="Sell Signal Any Cross Down", char='↑', location=location.abovebar, color=red, transp=0, offset=0)
This script was updated: ForNataly
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out