Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

a #1593

Copy link
Copy link
@massiddiqi

Description

@massiddiqi
Issue body actions

// @Version=5
indicator("UNIVERSAL - Enhanced", overlay=true, max_lines_count=500, max_boxes_count=500)

// === Inputs for user customization ===
// ... [Your original inputs] ...

// === CORE CALCULATIONS (Must come first!) ===
// ATR for size filter & dynamic width - MOVED TO TOP
atr = ta.atr(14)

// EMA 200 (Red)
ema200 = ta.ema(close, 200)
plot(ema200, title="EMA 200", color=color.rgb(255, 0, 0), linewidth=2)

// VWAP (Black, Daily Reset)
var float vwapsum = 0.0
var float volumesum = 0.0
startDay = request.security(syminfo.tickerid, "D", time)
newSession = ta.change(startDay) != 0
vwapsum := newSession ? hl2 * volume : nz(vwapsum[1]) + hl2 * volume
volumesum := newSession ? volume : nz(volumesum[1]) + volume
myvwap = volumesum != 0 ? vwapsum / volumesum : na
plot(myvwap, title="VWAP", color=color.rgb(0, 0, 0), linewidth=2)

// === NEW INPUTS for Head & Wick Logic ===
showHeadWickSignals = input.bool(true, "◎ Show Head & Wick Signals")
wickMinStrength = input.float(1.5, "Wick-to-Body Min Ratio", minval=1.0, maxval=3.0, step=0.1)
confirmationMinStrength = input.float(0.5, "Confirmation Candle Min Size (ATR)", minval=0.3, maxval=1.5, step=0.1)

// === HEAD & WICK CONFIRMATION DETECTION ===
// STEP 1: IDENTIFY THE SETUP CANDLE (The Wick)
lowerWickSize = math.min(open, close) - low
bodySizeSetup = math.abs(close - open)
hasStrongWick = (lowerWickSize >= bodySizeSetup * wickMinStrength) and (lowerWickSize > 0)

// STEP 2: IDENTIFY THE CONFIRMATION CANDLE (The Head)
confirmationBodySize = close - open
confirmationBodySizeAbsolute = math.abs(confirmationBodySize)
isStrongBullishCandle = close > open and
confirmationBodySizeAbsolute > (atr * confirmationMinStrength) and
(high - close) < (confirmationBodySizeAbsolute * 0.33)

// STEP 3: COMBINE THE SIGNALS
headWickBuySignal = hasStrongWick[1] and isStrongBullishCandle

// === PLOT THE HIGH-PROBABILITY SIGNAL ===
plotshape(showHeadWickSignals and headWickBuySignal,
title="Head & Wick Buy",
location=location.belowbar,
color=color.rgb(0, 200, 0),
style=shape.labelup,
size=size.normal,
text="HEAD\nWICK",
textcolor=color.white)

bgcolor(showHeadWickSignals and headWickBuySignal ? color.new(color.green, 90) : na)
alertcondition(showHeadWickSignals and headWickBuySignal, title="Head & Wick Buy Alert", message="Head & Wick Buy signal detected!")

// === NOW CONTINUE WITH YOUR ORIGINAL CODE ===
// Engulfing candles 4-color logic (now can use 'atr' safely)
bullEngulfGreen = open[1] > close[1] and close > open and close >= open[1] and open <= close[1] and (close - open) > (open[1] - close[1]) and (close - open) > atr * 0.5
bullEngulfMagenta = open[1] > close[1] and close > open and close >= open[1] and open <= close[1] and (close - open) > (open[1] - close[1]) and (close - open) <= atr * 0.5
bearEngulfBlack = close[1] > open[1] and open > close and open >= close[1] and close <= open[1] and (open - close) > (close[1] - open[1]) and (open - close) > atr * 0.5
bearEngulfGrey = close[1] > open[1] and open > close and open >= close[1] and close <= open[1] and (open - close) > (close[1] - open[1]) and (open - close) <= atr * 0.5

// ... [The rest of your original code: Bar colors, Strong Candle, BO Signals, Liquidity Raids, Boxes, etc.] ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.