// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © maruful_islam //@version=5 indicator("") show_stochK = input(true, "Show Stoch K?") show_stochDS = input(true, "Show Double Smooth Stoch?") bullish = input.color(color.rgb(253, 253, 253), "Bullish color") bearish = input.color(color.rgb(248, 54, 232), "Bearish color") //____________________ 1. Stochastic ___________________________________________________ // Double smoothed stoch lowest_low = ta.lowest(12) x = close - lowest_low ema00 = ta.ema(x, 12) ema0 = ta.ema(ema00, 12) highest_high = ta.highest(12) y = highest_high - lowest_low ema01 = ta.ema(y, 12) ema1 = ta.ema(ema01, 12) dsStoch = ema0 / ema1 dsStoch := dsStoch * 100 plot( show_stochDS ? dsStoch : na, color = dsStoch>dsStoch[2] ? color.aqua : color.rgb(247, 169, 53), linewidth=1, style = plot.style_line, display = display.all - display.status_line) // Stochastic stoch = ta.stoch(close, high, low, 12) //stoch := stoch/100 stoch_ma = ta.alma(stoch, 24, .85, 6) //plot(stoch_ma, color = color.lime, style = plot.style_circles) // Overbought or Oversold ? overbought = stoch >= 80 ? true : false oversold = stoch <= 20 ? true : false l14 = ta.lowest(14), h14 = ta.highest(14) k = (close - l14) / (h14 - l14) d = ta.sma(k, 3) k_ma = ta.ema(k, 12) k_rma = ta.rma(k_ma, 2) k_transparency = k_ma > k_rma ? 0 : 30 k_color = k_ma > k_rma ? bullish : bearish plot( show_stochK ? k_ma : na, title="Stoch K", color = k_color ) //plot( show_stochK ? k_rma : na, title="Stoch K RMA", color = color.new( c11, 0 ), style = plot.style_line) //fill ( plot(k_ma, title="Stoch K", color = color.new( c7, 0 ), display = display.none ), plot(k_rma, title="Stoch K RMA", color = color.new( c11, 0 ), style = plot.style_line), color=k_color ) //=== Stoch K //plot( show_stochK ? 1 : na, title = "K", color = k_color, linewidth = 1, style = plot.style_cross, display = display.none)