// This Strategy/Indicator was Created by ©NoobSharks // if you use it and like it, send us some donation: BinancePay ID: 223731148 - Metamask: 0x82782b3ebD1d6bf7faa18a3943fA6f16EBBF3134 // (yes, I might be naive but I trully Believe you will support us) // For more information about this indicator check "https://www.youtube.com/@noobsharks" and give us a hand following us on YouTube // Daily Lives on Twitch at "https://www.twitch.tv/noobsharks" // Check also our website includeing strategies, free indicatores and technical analysis videos: https://www.noobsharks.com //@version=5 indicator('[NB] Indicator - Heikin Ashi as an Indicator with Alerts', overlay=false, shorttitle='NB.IND.HA.Ind') // ----- USER INPUTS factor = input.int(20, "Wick variance factor %", 1, 99, 1, tooltip = "Defines how different the upper and lower wick can be. Exemploe: if you choose 20, than the difference between upper and lower wick must be 20% or lower. BTW, 20% seams to work very nice") alertChange = input.bool(false, "Show alerts on candle color change?", "Send an alert if previous candle is red and candle close is green (and opposite)") alertIndecision = input.bool(false, "Show alerts when indecision candle is printed?") // ----- GET DATA TO PLOT HKA CANDLES ha_open = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open) ha_high = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high) ha_low = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low) ha_close = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) // ----- CANDLE PLOTTING bullColor = #26a69a bearColor = #ef5350 plotcandle(ha_open < ha_close ? ha_open : na, ha_high, ha_low, ha_close, title='Green Candles', color=bullColor, wickcolor=bullColor, bordercolor=bullColor) plotcandle(ha_open >= ha_close ? ha_open : na, ha_high, ha_low, ha_close, title='Red Candles', color=bearColor, wickcolor=bearColor, bordercolor=bearColor) // ---- MEASURING WICK SIZE COMPARED TO CANDLE BODY candleBody = 0.0 wickHigh = 0.0 wickLow = 0.0 if ha_open < ha_close candleBody := ha_close - ha_open wickHigh := ha_high - ha_close wickLow := ha_open - ha_low else candleBody := ha_open - ha_close wickHigh := ha_high - ha_open wickLow := ha_close - ha_low // ----- PLOT DIVERGENCE WHEN CONDITIONS TO INDEFINITION CANDLE ARE MET plot = false if wickHigh >= candleBody if wickLow >= candleBody if wickHigh/wickLow >= (1-(factor/100)) if wickHigh/wickLow <= (1+(factor/100)) plot := true plotshape(plot?close:na, "Plot Indecision", shape.circle, location.abovebar, color.white) // ----- ALERTS currCandle = ha_close > ha_open ? "BULL" : "BEAR" prevCandle = ha_close[1] > ha_open[1] ? "BULL" : "BEAR" // --- alerts in case of indecision candle if plot and alertIndecision alert("NB HeikinAshi Alert: " + syminfo.ticker + " on " + timeframe.period + " chart. An INDECISION CANDLE was plotted, current candle is " + currCandle + ", previous candle is " + prevCandle, alert.freq_once_per_bar_close) // --- alerts if candle color changed, possible trend reversal if currCandle != prevCandle and alertChange alert("NB HeikinAshi Alert: " + syminfo.ticker + " on " + timeframe.period + " chart. Current candle is " + currCandle + ", previous candle is " + prevCandle + ", possible trend reversal", alert.freq_once_per_bar_close)