Allow Only 10% Lower Wick for Shooting Star and Make Sure High of the Shooting Star is…
- User
Allow Only 10% Lower Wick for Shooting Star and Make Sure High of the Shooting Star is higher than last 10 Candle and allow user to change this number: //@version=5 indicator("Shooting Star with High Volume Detector", overlay=true)
// User inputs lookbackPeriod = input.int(5, title="Lookback Period", minval=1) shootingStarBodyRatio = input.float(0.35, title="Shooting Star Body Ratio") shootingStarWickMultiplier = input.float(3.0, title="Shooting Star Wick Multiplier")
// Calculate candle components realBody = math.abs(close - open) upperWick = high - math.max(close, open) lowerWick = math.min(close, open) - low candleRange = high - low
// Prevent division by zero by ensuring candleRange is not zero candleRange := candleRange == 0.0 ? 1e-10 : candleRange
// Calculate body ratio to candle range bodyRatio = realBody / candleRange
// Condition 1: Small real body relative to the candle range smallBody = bodyRatio <= shootingStarBodyRatio
// Condition 2: Upper wick is longer than lower wick upperWickLonger = upperWick > lowerWick
// Condition 3: Upper wick is at least 'shootingStarWickMultiplier' times the real body upperWickLongEnough = upperWick >= (shootingStarWickMultiplier * realBody)
// Condition 4: Volume higher than each of the last 'lookbackPeriod' candles maxVolumeLastN = ta.highest(volume[1], lookbackPeriod) highVolume = volume > maxVolumeLastN
// Condition 5: Prior uptrend over the lookback period uptrend = close > close[lookbackPeriod]
// Combine all conditions to identify a Shooting Star pattern isShootingStar = smallBody and upperWickLonger and upperWickLongEnough and highVolume and uptrend
// Plot a marker on the chart when a Shooting Star is detected plotshape(isShootingStar, title="Shooting Star", style=shape.labeldown, location=location.abovebar, color=color.red, text="Shooting Star", textcolor=color.white)
- Assistant