// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © maruful_bd_yhoo //@version=5 indicator("", overlay = false, explicit_plot_zorder = true) //=== Features // CVD, Stoch, EMA cross. //_______ Colors _______ c1 = color.rgb(128,128,128) c2 = color.rgb(229,228,226) c3 = color.rgb(54,69,79) c4 = color.rgb(0,255,0) c5 = color.rgb(0,128,0) c6 = color.rgb(0,128,128) c7 = color.rgb(10,186,181) c8 = color.rgb(0,0,128) c9 = color.rgb(114, 184, 255) c10 = color.rgb(186,85,211) c11 = color.rgb(221, 95, 41) c12 = color.rgb(128,0,0) c13 = color.rgb(227,0,34) c14 = color.rgb(192,192,192, 30) c15 = color.rgb(211,211,211, 60) ema50 = ta.ema(close, 50) ema100 = ta.ema(close, 100) ema200 = ta.ema(close, 200) //plot(ema50, color = color.rgb(220,20,60), style=plot.style_stepline) //plot(ema100, color = color.rgb(0,255,127), style=plot.style_stepline) //plot(ema200, color = color.rgb(0,191,255)) ma50 = ta.alma(ema50, 12, 0.90, 6) ma100 = ta.alma(ema100, 12, 0.90, 6) //plotchar( ta.crossover(ema50, ma50), char = "▲", location = location.belowbar, size = size.tiny) //plotshape( ta.crossunder(ema50, ma50), style = shape.triangledown, location = location.abovebar, color=color.red, size = size.tiny) color_ema_crossover = ta.crossover(ema50, ma50) ? c4 : na color_ema_crossunder = ta.crossunder(ema50, ma50) ? c13 : na // Features of this script: // (1) Stochastic // (2) CVD // USE 1H chart for this script to give best signals. //_______ Inputs _______ l1 = input(4, "Smallest Base Lookback") l2 = l1 * 2 l3 = l1 * 3 l4 = int(l1 * 4.5) l5 = l1 * 5 l6 = l1 * 6 l7 = l6 * 3 l9 = l1 * 9 lookback = 0 ltf_delta = 0.0 buy = false, sell = false // Delta calculation delta_function() => vbuy=0.0, vsell=0.0, d=0.0 if close > open vbuy := volume * math.abs( open/close -1 ) if close < open vsell := volume * math.abs( open/close -1 ) d := ta.cum(vbuy - vsell) d //ltf_delta_ar = request.security_lower_tf(syminfo.tickerid, "3", delta_function(volume), false) //----Normalization Function n(s,l) => hi = ta.highest(s, l) lo = ta.lowest(s, l) n = (s - lo) / (hi - lo)+1 n // ************************************************************************************* //____________________ 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 //plot(dsStoch, color = color.rgb(244,196,48), linewidth=1, style = plot.style_line) // Stochastic stoch = ta.stoch(close, high, low, 12) stoch := stoch/100 //stoch_ma = ta.alma(stoch, 24, .85, 6) //bgcolor( color = stoch >= 0.8 ? color.rgb(195,33,72, 30) : stoch <= 0.2 ? color.rgb(152,251,152, 40) : na) 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 : 60 k_color = k_ma > k_rma ? c7 : c11 //fill ( plot(k_ma, title="Stoch K", color = color.new( c7, 0 ) ), plot(k_rma, title="Stoch K RMA", color = color.new( c11, 0 ), style = plot.style_line), color=k_color ) // Stochastic => 30 minutes stoch30 = ta.stoch(close, high, low, 6) // Stochastic => 2H stoch2h = ta.stoch(close, high, low, 24) color_stoch = stoch30>80 and stoch2h>80 ? color.rgb(206,255,0) : stoch30<20 and stoch2h<20 ? color.rgb(204,78,92) : na // Plot //bgcolor(sell_sig ? #FF5252 : buy_sig ? #00BCD4 : color.rgb(0,0,0)) //__________________________ () MACD ____________________________ [ macdLine_faster, signal_faster, _ ] = ta.macd(close, 12, 22, 7) color_macd = ta.rising(signal_faster, 3) ? color.rgb(60,179,113, 70) : color.rgb(254,40,162, 70) // ============= ============= ================ ================ ============== ltf_delta_ar = request.security_lower_tf(syminfo.tickerid, "3", delta_function(), false) delta = ltf_delta_ar.sum() delta := ( n(delta, 6) - 1.5 ) * 2 cvd_ma = ta.alma(delta, 30, 0.85, 6) //cvd_rma = ta.rma(cvd_ma, 3) //cvd_ema = ta.ema(delta, l4) //plot( cvd_ma, color = cvd_ma > cvd_rma ? color.lime : color.red) v00 = 0.0, b00 = 0.0, s00 = 0.0 d00 = 0.0 nd00 = 0.0 //____________ CVD _____________________ // H2 chart CVD h2 = 7 v00 := n(volume, h2) if close > open b00 := v00 * math.abs(open / close - 1) b00 if close < open s00 := v00 * math.abs(open / close - 1) s00 d00 := ta.cum(b00 - s00) nd00 := (n(d00, h2) -1.5)*2.0 ma_h2 = ta.alma(nd00,h2,0.95,6) transp_th = 80 transp_multiplier = 7 transparancy_rising = ma_h2>=0 ? transp_th - (ma_h2*10) * (transp_multiplier) : math.abs((ma_h2*10) * (transp_multiplier)) transparancy_falling = ma_h2<=0 ? transp_th - math.abs( (ma_h2*10) *(transp_multiplier)) : transparancy_rising cvd_rising = ta.rising(ma_h2, 2) ? true : false cvd_falling = ta.falling(ma_h2, 2) ? true : false cvd_color = cvd_rising ? color.rgb(0,250,154, transparancy_rising) : cvd_falling ? color.rgb(255,69,0, transparancy_falling) : ma_h2>0 ? color.rgb(0,250,154, 70) : color.rgb(255,69,0, 20) extreme_zone_value = 0.75 //cvd_color = ta.rising(ma_h2, 2) and ma_h2 > 0 ? color.rgb(0,255,0) : ta.falling(ma_h2, 2) and ma_h2>0 ? color.rgb(220,20,60, 50) : ta.falling(ma_h2, 2) and ma_h2<=0 ? color.rgb(220,20,60) : ta.rising(ma_h2, 2) and ma_h2<=0 ? color.rgb(0,255,0, 50) : ma_h2>0 ? color.rgb(0,255,0, 50) : color.rgb(220,20,60, 50) color_cvd_rising0 = ta.rising(ma_h2, 2) and ma_h2<=0 ? color.rgb(0,255,0, 50) : na color_cvd_rising1 = ta.rising(ma_h2, 2) and ma_h2 > 0 ? color.rgb(0,255,0) : na color_cvd_falling0 = ta.falling(ma_h2, 2) and ma_h2 >0 ? color.rgb(220,20,60, 50) : na color_cvd_falling1 = ta.falling(ma_h2, 2) and ma_h2<0 ? color.rgb(220,20,60) : na //plot(ma_h2, color = ta.rising(ma_h2, 2) and ma_h2 > 0 ? color.rgb(0,255,0) : ta.falling(ma_h2, 2) and ma_h2>0 ? color.rgb(220,20,60, 50) : ta.falling(ma_h2, 2) and ma_h2<=0 ? color.rgb(220,20,60) : ta.rising(ma_h2, 2) and ma_h2<=0 ? color.rgb(0,255,0, 50) : ma_h2>0 ? color.rgb(0,255,0, 50) : color.rgb(220,20,60, 50), style = plot.style_areabr) //_______ peckerponzi original rotation _______ //----Trigger Rotation lookback := l3 v00 := n(volume, lookback) if close > open b00 := v00 * math.abs(open / close - 1) b00 if close < open s00 := v00 * math.abs(open / close - 1) s00 d00 := ta.cum(b00 - s00) nd00 := (n(d00,lookback) -1.5)*2.0 nd00 := ta.alma(nd00,lookback,0.95,6) nd10 = ta.rma(nd00,2) //----Fast Rotation lookback := l9 v01 = n(volume,lookback) b01 = 0.0, s01 = 0.0 if close > open b01 := v01 * math.abs(open / close - 1) b01 if close < open s01 := v01 * math.abs(open / close - 1) s01 d01 = ta.cum(b01 - s01) nd01 = (n(d01,lookback) -1.5)*2.0 nd01 := ta.alma(nd01,lookback,0.90,6) nd11 = ta.rma(nd01,3) threshold = input(0.75,'Alert Threshold') long = ta.crossover(nd01,nd11) and nd01 <= - threshold and nd00 > nd10 short = ta.crossunder (nd01,nd11) and nd01 >= threshold and nd00 < nd10 cond = long or short bgcol = long ? #00BCD4 : short ? #FF5252 : na color1 = nd01 > nd11 ? color.rgb(245,245,245) : color.rgb(245,245,245, 70) //fill(plot(nd01,'Fast Rotation',color1),plot(nd11,'Smooth Fast Rotation',color1),color=color1) //hline_1 = hline(1,'1',#FF52528F,linestyle=hline.style_solid) //hline75 = hline(0.75,'0.75',#FF52528F,linestyle=hline.style_dotted) //fill( hline_1, hline75, color= nd00 < -0.75 and nd00 > nd10 ? #00BCD4CF : nd00 > 0.75 and nd00 < nd10 ? #FF5252CF : na) //hline(0,'0',#FFFFFF8F,linestyle=hline.style_solid) //hline_m1 = hline(-0.75,'-0.75',#00BCD48F,linestyle=hline.style_dotted) //hline_m75 = hline(-1,'-1',#00BCD48F,linestyle=hline.style_solid) //fill( hline_m1, hline_m75, color = color_macd ) //=== Hull MA pack length = input(55, title="Length(180-200 for floating S/R , 55 for swing entry)") lengthMult = input(1.0, title="Length multiplier (Used to view higher timeframes with straight band)") useHtf = input(false, title="Show Hull MA from X timeframe? (good for scalping)") htf = input("240", title="Higher timeframe") //EHMA EHMA(close, _length) => ta.ema(2 * ta.ema(close, _length / 2) - ta.ema(close, _length), math.round(math.sqrt(_length))) modeSwitch = EHMA(close, length) _hull = EHMA( close, int(length * lengthMult)) HULL = useHtf ? request.security(syminfo.ticker, htf, _hull) : _hull MHULL = HULL[0] SHULL = HULL[2] //COLOR hullColor = (HULL > HULL[2] ? color.rgb(135,206,235) : color.rgb(237,41,57) ) //=== Hull plot //hline_hull1 = hline(-0.10, "LS", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //hline_hull2 = hline(-0.15, "LS", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //fill(hline_hull1, hline_hull2, color=hullColor) plot(0.10, color = hullColor, style = plot.style_cross) //--- Long/short alert from "30 minutes rotation" hline_long = hline(0.40, "LS", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) hline_short = hline(0.50, "LS", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) fill(hline_long, hline_short, color=bgcol) //--- CVD line plot(0.30, color = cvd_color, style = plot.style_circles) //x1 = 0, x2 = 0.10 //hline_cvd = hline(x1, "CVD", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //hline_cvd2 = hline(x2, "CVD", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //fill(hline_cvd, hline_cvd2, color=color_cvd_rising0) //hline_cvd3 = hline(x1, "CVD", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //hline_cvd4 = hline(x2, "CVD", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //fill(hline_cvd3, hline_cvd4, color=color_cvd_rising1) //hline_cvd_falling = hline(x1, "CVD", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //hline_cvd2_falling = hline(x2, "CVD", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //fill(hline_cvd_falling, hline_cvd2_falling, color=color_cvd_falling0) //hline_cvd_falling2 = hline(x1, "CVD", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //hline_cvd2_falling2 = hline(x2, "CVD", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //fill(hline_cvd_falling, hline_cvd2_falling, color=color_cvd_falling1) //--- Stoch Lines price_lowest = ta.lowest(low, 24) //hline_k = hline(-0.30, "K", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //hline_k2 = hline(-0.40, "K", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //fill(hline_k, hline_k2, color=k_color) plot(-0.10, color = k_color, style = plot.style_circles) //--- EMA crossover line plot(-.25, color=ta.crossover(ema50, ma50) ? color_ema_crossover : ta.crossunder(ema50, ma50) ? color_ema_crossunder : na) //hline_ema = hline(-0.50, "EMA cross", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //hline_ema2 = hline(-0.60, "EMA cross", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //fill(hline_ema, hline_ema2, color=color_ema_crossover) //hline_ema_crossunder = hline(-.50, "EMA cross", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //hline_ema2_crossunder = hline(-0.60, "EMA cross", color=color.rgb(211,211,211, 100), linestyle = hline.style_solid) //fill(hline_ema_crossunder, hline_ema2_crossunder, color=color_ema_crossunder)