OPEN-SOURCE SCRIPT

AI Liquidity Confirmation Framework [Signals + RR]

326
//version=6
indicator("AI Liquidity Confirmation Framework [Signals + RR]", overlay=true)

// ----------------------
// Inputs
// ----------------------
atrLen = input.int(14, "ATR Length")
rr = input.float(2.0, "Risk Reward", step=0.25)
confirmBars = input.int(1, "Confirmation Bars")

// ----------------------
// Core Calculations
// ----------------------
atr = ta.atr(atrLen)

// Liquidity levels (simple swing logic)
sellLiquidity = ta.highest(high, 10)
buyLiquidity = ta.lowest(low, 10)

// Sweep detection
sellSweep = high > sellLiquidity[1] and close < sellLiquidity[1]
buySweep = low < buyLiquidity[1] and close > buyLiquidity[1]

// Confirmation candles
bullConfirm = close > open and close > close[1]
bearConfirm = close < open and close < close[1]

// ----------------------
// Trade Logic
// ----------------------
buySignal = buySweep and bullConfirm
sellSignal = sellSweep and bearConfirm

// Risk management
buyStop = low - atr
sellStop = high + atr

buyTarget = close + (close - buyStop) * rr
sellTarget = close - (sellStop - close) * rr

// ----------------------
// Plot Signals
// ----------------------
plotshape(buySignal, title="BUY", style=shape.labelup, text="BUY", color=color.new(color.green, 0))
plotshape(sellSignal, title="SELL", style=shape.labeldown, text="SELL", color=color.new(color.red, 0))

// Stops & Targets
plot(buySignal ? buyStop : na, color=color.red, style=plot.style_linebr)
plot(buySignal ? buyTarget : na, color=color.green, style=plot.style_linebr)

plot(sellSignal ? sellStop : na, color=color.red, style=plot.style_linebr)
plot(sellSignal ? sellTarget : na, color=color.green, style=plot.style_linebr)

// ----------------------
// WAIT State
// ----------------------
waitState = not buySignal and not sellSignal
plotchar(waitState, title="WAIT", char=".", location=location.top, color=color.gray)

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

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.