OPEN-SOURCE SCRIPT
Displacement + Liquidity Levels

//version=5
indicator("Displacement + Liquidity Levels", overlay=true, max_lines_count=500)
// INPUTS
swingLeft = input.int(5, "Swing Left")
swingRight = input.int(5, "Swing Right")
rangeLen = input.int(10, "Range Lookback")
// SWINGS
relevantHigh = ta.pivothigh(high, swingLeft, swingRight)
relevantLow = ta.pivotlow(low, swingLeft, swingRight)
// ARRAYS
var line[] highLines = array.new_line()
var line[] lowLines = array.new_line()
// LIQUIDITY SWEEPS
sweepHigh = not na(relevantHigh) and high > relevantHigh and close < relevantHigh
sweepLow = not na(relevantLow) and low < relevantLow and close > relevantLow
// DISPLACEMENT
bodySize = math.abs(close - open)
candleRange = high - low
avgRange = ta.sma(candleRange, rangeLen)
displacementUp = close > open and bodySize > candleRange*0.6 and candleRange > avgRange
displacementDown = open > close and bodySize > candleRange*0.6 and candleRange > avgRange
// SIGNALS
bullishSignal = sweepLow and displacementUp
bearishSignal = sweepHigh and displacementDown
plotshape(bullishSignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.large, text="LONG")
plotshape(bearishSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.large, text="SHORT")
// NEUE LINIEN
if not na(relevantHigh)
l = line.new(bar_index, relevantHigh, bar_index + 500, relevantHigh, extend=extend.right, color=color.red, width=2)
array.push(highLines, l)
if not na(relevantLow)
l = line.new(bar_index, relevantLow, bar_index + 500, relevantLow, extend=extend.right, color=color.green, width=2)
array.push(lowLines, l)
// LINIEN LÖSCHEN, WENN GETOUCHT
for i = array.size(highLines)-1 to 0 by -1
l = array.get(highLines, i)
if high >= line.get_price(l, bar_index)
line.delete(l)
array.remove(highLines, i)
for i = array.size(lowLines)-1 to 0 by -1
l = array.get(lowLines, i)
if low <= line.get_price(l, bar_index)
line.delete(l)
array.remove(lowLines, i)
indicator("Displacement + Liquidity Levels", overlay=true, max_lines_count=500)
// INPUTS
swingLeft = input.int(5, "Swing Left")
swingRight = input.int(5, "Swing Right")
rangeLen = input.int(10, "Range Lookback")
// SWINGS
relevantHigh = ta.pivothigh(high, swingLeft, swingRight)
relevantLow = ta.pivotlow(low, swingLeft, swingRight)
// ARRAYS
var line[] highLines = array.new_line()
var line[] lowLines = array.new_line()
// LIQUIDITY SWEEPS
sweepHigh = not na(relevantHigh) and high > relevantHigh and close < relevantHigh
sweepLow = not na(relevantLow) and low < relevantLow and close > relevantLow
// DISPLACEMENT
bodySize = math.abs(close - open)
candleRange = high - low
avgRange = ta.sma(candleRange, rangeLen)
displacementUp = close > open and bodySize > candleRange*0.6 and candleRange > avgRange
displacementDown = open > close and bodySize > candleRange*0.6 and candleRange > avgRange
// SIGNALS
bullishSignal = sweepLow and displacementUp
bearishSignal = sweepHigh and displacementDown
plotshape(bullishSignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.large, text="LONG")
plotshape(bearishSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.large, text="SHORT")
// NEUE LINIEN
if not na(relevantHigh)
l = line.new(bar_index, relevantHigh, bar_index + 500, relevantHigh, extend=extend.right, color=color.red, width=2)
array.push(highLines, l)
if not na(relevantLow)
l = line.new(bar_index, relevantLow, bar_index + 500, relevantLow, extend=extend.right, color=color.green, width=2)
array.push(lowLines, l)
// LINIEN LÖSCHEN, WENN GETOUCHT
for i = array.size(highLines)-1 to 0 by -1
l = array.get(highLines, i)
if high >= line.get_price(l, bar_index)
line.delete(l)
array.remove(highLines, i)
for i = array.size(lowLines)-1 to 0 by -1
l = array.get(lowLines, i)
if low <= line.get_price(l, bar_index)
line.delete(l)
array.remove(lowLines, i)
オープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。