OPEN-SOURCE SCRIPT

High Win-Rate Scalping Supply & Demand with Volume & Signals

//version=5
indicator("High Win-Rate Scalping Supply & Demand with Volume & Signals", overlay=true)

// === Input settings ===
length = input(50, title="Volume Lookback Length")
zoneLookback = input(20, title="Supply/Demand Zone Lookback")
showZones = input(true, title="Show Supply & Demand Zones")
showVolume = input(true, title="Show Volume Indicator")
showSignals = input(true, title="Show Buy/Sell Signals")
volumeThreshold = input(1.5, title="Volume Multiplier for Signal Confirmation") // Adjusts sensitivity

// === Calculate Volume ===
vol_ma = ta.sma(volume, length)

// === Identify Supply & Demand Zones (Dynamic) ===
pivotHigh = ta.highest(high, zoneLookback)
pivotLow = ta.lowest(low, zoneLookback)

// Dynamic Supply Zone (Resistance)
supplyZone = ta.valuewhen(ta.highestbars(high, zoneLookback) == 0, high, 0)
plot(showZones ? supplyZone : na, title="Supply Zone", color=color.red, linewidth=2, style=plot.style_stepline)

// Dynamic Demand Zone (Support)
demandZone = ta.valuewhen(ta.lowestbars(low, zoneLookback) == 0, low, 0)
plot(showZones ? demandZone : na, title="Demand Zone", color=color.green, linewidth=2, style=plot.style_stepline)

// === Buy/Sell Signals Based on Supply & Demand, Volume, and Price Action ===
bullishEngulfing = ta.crossover(close, demandZone) and close > open[1] and volume > vol_ma * volumeThreshold
bearishEngulfing = ta.crossunder(close, supplyZone) and close < open[1] and volume > vol_ma * volumeThreshold

// Buy Signal Conditions
buySignal = bullishEngulfing

// Sell Signal Conditions
sellSignal = bearishEngulfing

// Plot Buy/Sell Markers
plotshape(series=buySignal, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal", size=size.small)
plotshape(series=sellSignal, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal", size=size.small)

// === Volume Display ===
plot(showVolume ? vol_ma : na, title="Volume MA", color=color.blue, linewidth=2)

// === Alerts for Buy/Sell Signals ===
alertcondition(buySignal, title="Buy Alert", message="Strong Demand Zone Rejection with Volume - Buy Signal")
alertcondition(sellSignal, title="Sell Alert", message="Strong Supply Zone Rejection with Volume - Sell Signal")

إخلاء المسؤولية