// 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 = true) //// Variables initialization length1 = input(50, "Hull HTF length", group="Hull HTF") //INPUT showEMA = input(false, "Show EMA and hide Hull Suite", group="General") showHullHTF = input.bool(true, "Show Hull HTF?", group="Hull HTF") lengthMult1 = input(1.0, title="Length multiplier (Used to view higher timeframes with straight band)", group="Hull HTF") useHtf1 = input(true, title="Show Hull MA from X timeframe? (good for scalping)", group="Hull HTF") src1 = input(close, title="Source", group="Hull HTF") modeSwitch1 = input.string("Hma", title="Hull Variation", options=["Hma", "Thma", "Ehma"], group="Hull HTF") htf = input("240", title="HTF Hull Length", group="Hull HTF") switchColor1 = input(true, "Color Hull according to trend?", group="Hull HTF") visualSwitch1 = input(true, title="Show as a Band?", group="Hull HTF") thicknesSwitch1 = input(1, title="Line Thickness", group="Hull HTF") transpSwitch1 = input.int(40, title="Band Transparency",step=5, group="Hull HTF") //// Colors //// hull_bullish1 = input.color(color.rgb(0, 204, 0), group="Hull HTF") hull_bearish1 = input.color(color.rgb(0, 204, 0, 60), group="Hull HTF") //// TimeFrame evaluation int chartTFInMinutes = timeframe.in_seconds() / 60 tf_minute = timeframe.isminutes ? true : false tf_h4 = tf_minute ? timeframe.multiplier == 240 ? true : false : false tf_hour = tf_minute ? timeframe.multiplier == 60 ? true : false : false tf15min = timeframe.isminutes and timeframe.multiplier == 15 ? true : false tf30min = tf_minute ? timeframe.multiplier == 30 ? true : false : false tf1h = timeframe.isminutes and timeframe.multiplier == 60 ? true : false //FUNCTIONS //HMA HMA(_src, _length) => ta.wma(2 * ta.wma(_src, _length / 2) - ta.wma(_src, _length), math.round(math.sqrt(_length))) //EHMA EHMA(_src, _length) => ta.ema(2 * ta.ema(_src, _length / 2) - ta.ema(_src, _length), math.round(math.sqrt(_length))) //THMA THMA(_src, _length) => ta.wma(ta.wma(_src,_length / 3) * 3 - ta.wma(_src, _length / 2) - ta.wma(_src, _length), _length) //SWITCH Mode(modeSwitch, src, len) => modeSwitch == "Hma" ? HMA(src, len) : modeSwitch == "Ehma" ? EHMA(src, len) : modeSwitch == "Thma" ? THMA(src, len/2) : na //OUT _hull1 = Mode(modeSwitch1, src1, int(length1 * lengthMult1)) HULL1 = request.security(syminfo.ticker, htf, _hull1) MHULL1 = HULL1[0] SHULL1= HULL1[2] //COLOR hullColor1 = switchColor1 ? (HULL1 > HULL1[2] ? hull_bullish1 : hull_bearish1 ) : #000000 //PLOT ///< Frame Fi1_ = plot(showEMA ? na : showHullHTF ? MHULL1 : na, title="MHULL1", color=hullColor1, linewidth=thicknesSwitch1) //Fi2_ = plot(showHullHTF ? SHULL1 : na, title="SHULL1", color=hullColor1, linewidth=thicknesSwitch1) alertcondition(ta.crossover(MHULL1, SHULL1), title="Hull trending up.", message="Hull trending up.") alertcondition(ta.crossover(SHULL1, MHULL1), title="Hull trending down.", message="Hull trending down.") ///< Ending Filler //fill(Fi1_, Fi2_, title="Band Filler", color=hullColor1) ////--------------------------------------------------- //// Hull LTF //show_mhull = timeframe.multiplier <= 60 and timeframe.isminutes ? true : false show_mhull = true show_shull = input(false, "Show SHULL LTF?") src = input(close, title="Source") modeSwitch = input.string("Hma", title="Hull Variation", options=["Hma", "Thma", "Ehma"]) //// length=20 is good in a 1H chart //length = input.int(70, title="Hull LTF Length(180-200 for floating S/R , 55 for swing entry)", group="Hull LTF") length = tf_hour ? 40 : tf_h4 ? 70 : 55 lengthMult = input(1.0, title="Length multiplier (Used to view higher timeframes with straight band)") switchColor = input(true, "Color Hull according to trend?") candleCol = input(false,title="Color candles based on Hull's Trend?") visualSwitch = input(true, title="Show as a Band?") thicknesSwitch = input(1, title="Line Thickness") transpSwitch = input.int(40, title="Band Transparency",step=5) //// Colors //// hull_bullish = input.color(color.rgb(153, 255, 51)) hull_bearish = input.color(color.rgb(153, 255, 51, 60)) candle_bullish = input.color(color.rgb(0, 153, 51)) candle_bearish = input.color(color.rgb(255, 51, 0)) //OUT _hull = Mode(modeSwitch, src, int(length * lengthMult)) HULL = _hull MHULL = HULL[0] SHULL = HULL[2] //COLOR hullColor = switchColor ? (HULL > HULL[2] ? hull_bullish : hull_bearish ) : #000000 //// Candle color col_candle_hull = (HULL > HULL[2] ? candle_bullish : candle_bearish ) //PLOT ///< Frame Fi1 = plot(showEMA ? na : MHULL, title="MHULL", color=hullColor, linewidth=thicknesSwitch) Fi2 = plot(show_shull ? SHULL : na, title="SHULL", color=hullColor, linewidth=thicknesSwitch) alertcondition(ta.crossover(MHULL, SHULL), title="Hull trending up.", message="Hull trending up.") alertcondition(ta.crossover(SHULL, MHULL), title="Hull trending down.", message="Hull trending down.") ///< Ending Filler fill(Fi1, Fi2, title="Band Filler", color=hullColor) ///BARCOLOR barcolor(color = candleCol ? (switchColor and timeframe.multiplier <= 60 ? col_candle_hull : na) : na) //// // EMA ema50 = ta.ema(close, 47) ema100 = ta.ema(close, 97) ema200 = ta.ema(close, 197) plot( showEMA ? ema50 : na, color=color.rgb(204, 204, 204)) plot( showEMA ? ema100 : na, color=color.rgb(255, 148, 77)) plot( showEMA ? ema200 : na, color=color.rgb(51, 153, 255))