Stophunt Wick
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KiLA-WHALE
// What's a Stophunt Wick? It's that fast stophunting wick that cucks everyone by triggering their stoploss. 
// This indicator is dedicated to my friend Alexandru who saved me from getting liquidated by one of these scam wicks which almost liquidated me. 
// Alexandru is one of the best scalpers out there and he always nails his entries at the tip of these wicks. This inspired me to create this indicator.
//@version=5
// Declare indicator name
indicator('Stophunt Wick', overlay=true)
// Define variables
Wick_Ratio = input(2.0,'Wick Ratio',tooltip = 'Candle wick to body size ratio.')
Candle_Ratio = input(0.5, 'Candle Ratio', tooltip = 'Percentage of current price.')
AlertCandleSize = input(5,'Alert Candle Size',tooltip = 'Size stophunt candle used for alert')
Bull_Candle_Colour = input(color.green, 'Bull Candle Colour',tooltip = 'Colour of the bullish stophunt candle.')
Bear_Candle_Colour = input(color.red, 'Bear Candle Colour',tooltip = 'Colour of the bearish stophunt candle.')
AlertCandlePrice =  (Candle_Ratio * close) / 100
// Display the result on the chart
plot(AlertCandlePrice, title="Stophunt Candle Size")
// Calculate the size of the body of a candle
body = math.abs(close - open)
// Calculate the size of the upper wick of a candle
upper_wick = high - math.max(open, close)
// Calculate the size of the lower wick of a candle
lower_wick = math.min(open, close) - low
// Find bull Stophunt by calculating size of the wick and body
BullStophunt = body + upper_wick + lower_wick >= (Candle_Ratio * close) / 100 and (upper_wick > (body + lower_wick) * Wick_Ratio)
// Find bear Stophunt by calculating size of the wick and body
BearStophunt = body + upper_wick + lower_wick >= (Candle_Ratio * close) / 100 and (lower_wick > (body + upper_wick) * Wick_Ratio)
// Highlight Stophunt Wick with the specified colours
Stophunt_Wick = (BullStophunt ? Bull_Candle_Colour : BearStophunt ? Bear_Candle_Colour : na)
// Highlight Stophunt candles and Stophunt Wicks
barcolor(BullStophunt ? Bull_Candle_Colour : BearStophunt ? Bear_Candle_Colour : na)
// Find the current candle
Current_Candle = barstate.islast ? 1 : 0
// Get the closing price of the current 5 minute candle
ClosePrice = request.security(syminfo.tickerid, str.tostring(AlertCandleSize), close)
// Find current bull Stophunt
CurrentBullStophunt = ClosePrice - open > (Candle_Ratio * close) / 100
// Find current bear Stophunt 
CurrentBearStophunt = math.abs(ClosePrice - open) > (Candle_Ratio * close) / 100
// Highlight Stophunt Wick with the specified colours
Stophunt_Current = (CurrentBullStophunt ? Bull_Candle_Colour : CurrentBearStophunt ? Bear_Candle_Colour : na)
// Apply the color to 5 minute candles only
barcolor(Current_Candle and timeframe.multiplier == AlertCandleSize and  timeframe.isintraday ? Stophunt_Current : na)
// Calculate current candle size
CurrentCandleSize = math.abs(ClosePrice - open) 
// Alert if stophunt is currently underway
if  CurrentCandleSize > (Candle_Ratio * close) / 100 and Current_Candle and timeframe.multiplier == AlertCandleSize and  timeframe.isintraday
    alert("Price has moved " + str.tostring(CurrentCandleSize) + " in last "+ str.tostring(AlertCandleSize) + "minutes")