Double Top/Bottom Screener - Today Only v2 //@version=6
indicator("Double Top/Bottom Screener - Today Only", overlay=true, max_lines_count=500)
// Inputs
leftBars = input.int(5, "Left Bars")
rightBars = input.int(5, "Right Bars")
tolerance = input.float(0.02, "Max Difference (e.g., 0.02 for 2 cents)", step=0.01)
atrLength = input.int(14, "ATR Length for Normalized Distance", minval=1)
requiredPeaks = input.int(3, "Required Identical Peaks", minval=2, maxval=5)
// Declarations of persistent variables and arrays
var array resistanceLevels = array.new(0)
var array resistanceCounts = array.new(0)
var array supportLevels = array.new(0)
var array supportCounts = array.new(0)
var array resLines = array.new(0)
var array supLines = array.new(0)
var bool hasDoubleTop = false
var bool hasDoubleBottom = false
var float doubleTopLevel = na
var float doubleBottomLevel = na
var int todayStart = na
// Step 1: Identify Swing Highs/Lows
swingHigh = ta.pivothigh(high, leftBars, rightBars)
swingLow = ta.pivotlow(low, leftBars, rightBars)
// Today's premarket start (04:00 AM ET)
todayStart := timestamp(syminfo.timezone, year, month, dayofmonth, 4, 0, 0)
// Clear arrays and delete lines on the first bar or new day
if barstate.isfirst or (dayofmonth != dayofmonth and time >= todayStart)
// Delete all existing lines only if arrays are not empty
if array.size(resLines) > 0
for i = array.size(resLines) - 1 to 0
line.delete(array.get(resLines, i))
if array.size(supLines) > 0
for i = array.size(supLines) - 1 to 0
line.delete(array.get(supLines, i))
// Clear arrays
array.clear(resistanceLevels)
array.clear(supportLevels)
array.clear(resistanceCounts)
array.clear(supportCounts)
array.clear(resLines)
array.clear(supLines)
// Reset flags
hasDoubleTop := false
hasDoubleBottom := false
doubleTopLevel := na
doubleBottomLevel := na
// Add new swings only if today and after premarket
if not na(swingHigh) and time >= todayStart and dayofmonth == dayofmonth
bool isEqualHigh = false
int peakIndex = -1
float prevLevel = na
if array.size(resistanceLevels) > 0
for i = 0 to array.size(resistanceLevels) - 1
prevLevel := array.get(resistanceLevels, i)
if math.abs(swingHigh - prevLevel) <= tolerance
isEqualHigh := true
peakIndex := i
break
if isEqualHigh and peakIndex >= 0
array.set(resistanceCounts, peakIndex, array.get(resistanceCounts, peakIndex) + 1)
if array.get(resistanceCounts, peakIndex) == requiredPeaks
hasDoubleTop := true
doubleTopLevel := prevLevel
else
array.push(resistanceLevels, swingHigh)
array.push(resistanceCounts, 1)
line newResLine = line.new(bar_index - rightBars, swingHigh, bar_index, swingHigh, color=color.red, width=2, extend=extend.none)
array.push(resLines, newResLine)
if not na(swingLow) and time >= todayStart and dayofmonth == dayofmonth
bool isEqualLow = false
int peakIndex = -1
float prevLevel = na
if array.size(supportLevels) > 0
for i = 0 to array.size(supportLevels) - 1
prevLevel := array.get(supportLevels, i)
if math.abs(swingLow - prevLevel) <= tolerance
isEqualLow := true
peakIndex := i
break
if isEqualLow and peakIndex >= 0
array.set(supportCounts, peakIndex, array.get(supportCounts, peakIndex) + 1)
if array.get(supportCounts, peakIndex) == requiredPeaks
hasDoubleBottom := true
doubleBottomLevel := prevLevel
else
array.push(supportLevels, swingLow)
array.push(supportCounts, 1)
line newSupLine = line.new(bar_index - rightBars, swingLow, bar_index, swingLow, color=color.green, width=2, extend=extend.none)
array.push(supLines, newSupLine)
// Monitor and remove broken levels/lines; reset pattern if the equal level breaks
if array.size(resistanceLevels) > 0
for i = array.size(resistanceLevels) - 1 to 0
float level = array.get(resistanceLevels, i)
if close > level
line.delete(array.get(resLines, i))
array.remove(resLines, i)
array.remove(resistanceLevels, i)
array.remove(resistanceCounts, i)
if level == doubleTopLevel
hasDoubleTop := false
doubleTopLevel := na
if array.size(supportLevels) > 0
for i = array.size(supportLevels) - 1 to 0
float level = array.get(supportLevels, i)
if close < level
line.delete(array.get(supLines, i))
array.remove(supLines, i)
array.remove(supportLevels, i)
array.remove(supportCounts, i)
if level == doubleBottomLevel
hasDoubleBottom := false
doubleBottomLevel := na
// Limit arrays (after removals)
if array.size(resistanceLevels) > 10
line oldLine = array.shift(resLines)
line.delete(oldLine)
array.shift(resistanceLevels)
array.shift(resistanceCounts)
if array.size(supportLevels) > 10
line oldLine = array.shift(supLines)
line.delete(oldLine)
array.shift(supportLevels)
array.shift(supportCounts)
// Pattern Signal: 1 only if the exact required number of peaks is met
patternSignal = (hasDoubleTop or hasDoubleBottom) ? 1 : 0
// New: Nearest Double Level Price
var float nearestDoubleLevel = na
if hasDoubleTop and not na(doubleTopLevel)
nearestDoubleLevel := doubleTopLevel
if hasDoubleBottom and not na(doubleBottomLevel)
nearestDoubleLevel := na(nearestDoubleLevel) ? doubleBottomLevel : (math.abs(close - doubleBottomLevel) < math.abs(close - nearestDoubleLevel) ? doubleBottomLevel : nearestDoubleLevel)
// New: Distance to Nearest Level (using ATR for normalization)
var float atr = ta.atr(atrLength)
var float distanceNormalizedATR = na
if not na(nearestDoubleLevel) and not na(atr) and atr > 0
distanceNormalizedATR := math.abs(close - nearestDoubleLevel) / atr
// Optional Bounce Signal (for reference)
bounceSignal = 0
if array.size(resistanceLevels) > 0
for i = 0 to array.size(resistanceLevels) - 1
float level = array.get(resistanceLevels, i)
if low <= level and high >= level and close < level
bounceSignal := 1
if array.size(supportLevels) > 0
for i = 0 to array.size(supportLevels) - 1
float level = array.get(supportLevels, i)
if high >= level and low <= level and close > level
bounceSignal := 1
// Outputs
plot(patternSignal, title="Pattern Signal", color=patternSignal == 1 ? color.purple : na, style=plot.style_circles)
plot(bounceSignal, title="Bounce Signal", color=bounceSignal == 1 ? color.yellow : na, style=plot.style_circles)
plot(nearestDoubleLevel, title="Nearest Double Level Price", color=color.orange)
plot(distanceNormalizedATR, title="Normalized Distance (ATR)", color=color.green)
bgcolor(patternSignal == 1 ? color.new(color.purple, 80) : na)
if patternSignal == 1 and barstate.isconfirmed
alert("Double Pattern detected on " + syminfo.ticker + " at " + str.tostring(close), alert.freq_once_per_bar_close)
if barstate.islast
var table infoTable = table.new(position.top_right, 1, 4, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 0, "Pattern: " + str.tostring(patternSignal), bgcolor=patternSignal == 1 ? color.purple : color.gray)
table.cell(infoTable, 0, 1, "Bounce: " + str.tostring(bounceSignal), bgcolor=bounceSignal == 1 ? color.yellow : color.gray)
table.cell(infoTable, 0, 2, "Level: " + str.tostring(nearestDoubleLevel, "#.##"), bgcolor=color.orange)
table.cell(infoTable, 0, 3, "ATR Dist: " + str.tostring(distanceNormalizedATR, "#.##"), bgcolor=color.green)
חפש סקריפטים עבור "10年期国债收益率+曲线图+数据来源"
Double Top/Bottom Screener - Today Only//@version=6
indicator("Double Top/Bottom Screener - Today Only", overlay=true, max_lines_count=500)
// Inputs
leftBars = input.int(5, "Left Bars")
rightBars = input.int(5, "Right Bars")
tolerance = input.float(0.02, "Max Difference (e.g., 0.02 for 2 cents)", step=0.01)
atrLength = input.int(14, "ATR Length for Normalized Distance", minval=1)
requiredPeaks = input.int(3, "Required Identical Peaks", minval=2, maxval=5)
// Declarations of persistent variables and arrays
var array resistanceLevels = array.new(0)
var array resistanceCounts = array.new(0)
var array supportLevels = array.new(0)
var array supportCounts = array.new(0)
var array resLines = array.new(0)
var array supLines = array.new(0)
var bool hasDoubleTop = false
var bool hasDoubleBottom = false
var float doubleTopLevel = na
var float doubleBottomLevel = na
var int todayStart = na
// Step 1: Identify Swing Highs/Lows
swingHigh = ta.pivothigh(high, leftBars, rightBars)
swingLow = ta.pivotlow(low, leftBars, rightBars)
// Today's premarket start (04:00 AM ET)
todayStart := timestamp(syminfo.timezone, year, month, dayofmonth, 4, 0, 0)
// Clear arrays and delete lines on the first bar or new day
if barstate.isfirst or (dayofmonth != dayofmonth and time >= todayStart)
// Delete all existing lines
for i = array.size(resLines) - 1 to 0
line.delete(array.get(resLines, i))
for i = array.size(supLines) - 1 to 0
line.delete(array.get(supLines, i))
// Clear arrays
array.clear(resistanceLevels)
array.clear(supportLevels)
array.clear(resistanceCounts)
array.clear(supportCounts)
array.clear(resLines)
array.clear(supLines)
// Reset flags
hasDoubleTop := false
hasDoubleBottom := false
doubleTopLevel := na
doubleBottomLevel := na
// Add new swings only if today and after premarket
if not na(swingHigh) and time >= todayStart and dayofmonth == dayofmonth
bool isEqualHigh = false
int peakIndex = -1
float prevLevel = na
if array.size(resistanceLevels) > 0
for i = 0 to array.size(resistanceLevels) - 1
prevLevel := array.get(resistanceLevels, i)
if math.abs(swingHigh - prevLevel) <= tolerance
isEqualHigh := true
peakIndex := i
break
if isEqualHigh and peakIndex >= 0
array.set(resistanceCounts, peakIndex, array.get(resistanceCounts, peakIndex) + 1)
if array.get(resistanceCounts, peakIndex) == requiredPeaks
hasDoubleTop := true
doubleTopLevel := prevLevel
else
array.push(resistanceLevels, swingHigh)
array.push(resistanceCounts, 1)
line newResLine = line.new(bar_index - rightBars, swingHigh, bar_index, swingHigh, color=color.red, width=2, extend=extend.none)
array.push(resLines, newResLine)
if not na(swingLow) and time >= todayStart and dayofmonth == dayofmonth
bool isEqualLow = false
int peakIndex = -1
float prevLevel = na
if array.size(supportLevels) > 0
for i = 0 to array.size(supportLevels) - 1
prevLevel := array.get(supportLevels, i)
if math.abs(swingLow - prevLevel) <= tolerance
isEqualLow := true
peakIndex := i
break
if isEqualLow and peakIndex >= 0
array.set(supportCounts, peakIndex, array.get(supportCounts, peakIndex) + 1)
if array.get(supportCounts, peakIndex) == requiredPeaks
hasDoubleBottom := true
doubleBottomLevel := prevLevel
else
array.push(supportLevels, swingLow)
array.push(supportCounts, 1)
line newSupLine = line.new(bar_index - rightBars, swingLow, bar_index, swingLow, color=color.green, width=2, extend=extend.none)
array.push(supLines, newSupLine)
// Monitor and remove broken levels/lines; reset pattern if the equal level breaks
if array.size(resistanceLevels) > 0
for i = array.size(resistanceLevels) - 1 to 0
float level = array.get(resistanceLevels, i)
if close > level
line.delete(array.get(resLines, i))
array.remove(resLines, i)
array.remove(resistanceLevels, i)
array.remove(resistanceCounts, i)
if level == doubleTopLevel
hasDoubleTop := false
doubleTopLevel := na
if array.size(supportLevels) > 0
for i = array.size(supportLevels) - 1 to 0
float level = array.get(supportLevels, i)
if close < level
line.delete(array.get(supLines, i))
array.remove(supLines, i)
array.remove(supportLevels, i)
array.remove(supportCounts, i)
if level == doubleBottomLevel
hasDoubleBottom := false
doubleBottomLevel := na
// Limit arrays (after removals)
if array.size(resistanceLevels) > 10
line oldLine = array.shift(resLines)
line.delete(oldLine)
array.shift(resistanceLevels)
array.shift(resistanceCounts)
if array.size(supportLevels) > 10
line oldLine = array.shift(supLines)
line.delete(oldLine)
array.shift(supportLevels)
array.shift(supportCounts)
// Pattern Signal: 1 only if the exact required number of peaks is met
patternSignal = (hasDoubleTop or hasDoubleBottom) ? 1 : 0
// New: Nearest Double Level Price
var float nearestDoubleLevel = na
if hasDoubleTop and not na(doubleTopLevel)
nearestDoubleLevel := doubleTopLevel
if hasDoubleBottom and not na(doubleBottomLevel)
nearestDoubleLevel := na(nearestDoubleLevel) ? doubleBottomLevel : (math.abs(close - doubleBottomLevel) < math.abs(close - nearestDoubleLevel) ? doubleBottomLevel : nearestDoubleLevel)
// New: Distance to Nearest Level (using ATR for normalization)
var float atr = ta.atr(atrLength)
var float distanceNormalizedATR = na
if not na(nearestDoubleLevel) and not na(atr) and atr > 0
distanceNormalizedATR := math.abs(close - nearestDoubleLevel) / atr
// Optional Bounce Signal (for reference)
bounceSignal = 0
if array.size(resistanceLevels) > 0
for i = 0 to array.size(resistanceLevels) - 1
float level = array.get(resistanceLevels, i)
if low <= level and high >= level and close < level
bounceSignal := 1
if array.size(supportLevels) > 0
for i = 0 to array.size(supportLevels) - 1
float level = array.get(supportLevels, i)
if high >= level and low <= level and close > level
bounceSignal := 1
// Outputs
plot(patternSignal, title="Pattern Signal", color=patternSignal == 1 ? color.purple : na, style=plot.style_circles)
plot(bounceSignal, title="Bounce Signal", color=bounceSignal == 1 ? color.yellow : na, style=plot.style_circles)
plot(nearestDoubleLevel, title="Nearest Double Level Price", color=color.orange)
plot(distanceNormalizedATR, title="Normalized Distance (ATR)", color=color.green)
bgcolor(patternSignal == 1 ? color.new(color.purple, 80) : na)
if patternSignal == 1 and barstate.isconfirmed
alert("Double Pattern detected on " + syminfo.ticker + " at " + str.tostring(close), alert.freq_once_per_bar_close)
if barstate.islast
var table infoTable = table.new(position.top_right, 1, 4, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 0, "Pattern: " + str.tostring(patternSignal), bgcolor=patternSignal == 1 ? color.purple : color.gray)
table.cell(infoTable, 0, 1, "Bounce: " + str.tostring(bounceSignal), bgcolor=bounceSignal == 1 ? color.yellow : color.gray)
table.cell(infoTable, 0, 2, "Level: " + str.tostring(nearestDoubleLevel, "#.##"), bgcolor=color.orange)
table.cell(infoTable, 0, 3, "ATR Dist: " + str.tostring(distanceNormalizedATR, "#.##"), bgcolor=color.green)
Double Top/Bottom Screener V1//@version=6
indicator("Double Top/Bottom Screener", overlay=true, max_lines_count=500)
// Inputs
leftBars = input.int(5, "Left Bars")
rightBars = input.int(5, "Right Bars")
tolerance = input.float(0.02, "Max Difference (e.g., 0.02 for 2 cents)", step=0.01)
atrLength = input.int(14, "ATR Length for Normalized Distance", minval=1)
requiredPeaks = input.int(3, "Required Identical Peaks", minval=2, maxval=5)
// Declarations of persistent variables and arrays
var array resistanceLevels = array.new(0)
var array resistanceCounts = array.new(0)
var array supportLevels = array.new(0)
var array supportCounts = array.new(0)
var array resLines = array.new(0)
var array supLines = array.new(0)
var bool hasDoubleTop = false
var bool hasDoubleBottom = false
var float doubleTopLevel = na
var float doubleBottomLevel = na
var int todayStart = na
var bool isNewDay = false
// Step 1: Identify Swing Highs/Lows
swingHigh = ta.pivothigh(high, leftBars, rightBars)
swingLow = ta.pivotlow(low, leftBars, rightBars)
// Today's premarket start (04:00 AM ET)
if dayofmonth != dayofmonth
todayStart := timestamp(syminfo.timezone, year, month, dayofmonth, 4, 0, 0)
isNewDay := true
else
isNewDay := false
// Clear arrays and reset flags only once at premarket start
if isNewDay and time >= todayStart
array.clear(resistanceLevels)
array.clear(supportLevels)
array.clear(resistanceCounts)
array.clear(supportCounts)
array.clear(resLines)
array.clear(supLines)
hasDoubleTop := false
hasDoubleBottom := false
doubleTopLevel := na
doubleBottomLevel := na
// Add new swings and check for identical peaks
if not na(swingHigh) and time >= todayStart
bool isEqualHigh = false
int peakIndex = -1
float prevLevel = na
if array.size(resistanceLevels) > 0
for i = 0 to array.size(resistanceLevels) - 1
prevLevel := array.get(resistanceLevels, i)
if math.abs(swingHigh - prevLevel) <= tolerance
isEqualHigh := true
peakIndex := i
break
if isEqualHigh and peakIndex >= 0
array.set(resistanceCounts, peakIndex, array.get(resistanceCounts, peakIndex) + 1)
if array.get(resistanceCounts, peakIndex) == requiredPeaks
hasDoubleTop := true
doubleTopLevel := prevLevel
else
array.push(resistanceLevels, swingHigh)
array.push(resistanceCounts, 1)
line newResLine = line.new(bar_index - rightBars, swingHigh, bar_index, swingHigh, color=color.red, width=2, extend=extend.right)
array.push(resLines, newResLine)
if not na(swingLow) and time >= todayStart
bool isEqualLow = false
int peakIndex = -1
float prevLevel = na
if array.size(supportLevels) > 0
for i = 0 to array.size(supportLevels) - 1
prevLevel := array.get(supportLevels, i)
if math.abs(swingLow - prevLevel) <= tolerance
isEqualLow := true
peakIndex := i
break
if isEqualLow and peakIndex >= 0
array.set(supportCounts, peakIndex, array.get(supportCounts, peakIndex) + 1)
if array.get(supportCounts, peakIndex) == requiredPeaks
hasDoubleBottom := true
doubleBottomLevel := prevLevel
else
array.push(supportLevels, swingLow)
array.push(supportCounts, 1)
line newSupLine = line.new(bar_index - rightBars, swingLow, bar_index, swingLow, color=color.green, width=2, extend=extend.right)
array.push(supLines, newSupLine)
// Monitor and remove broken levels/lines; reset pattern if the equal level breaks
if array.size(resistanceLevels) > 0
for i = array.size(resistanceLevels) - 1 to 0
float level = array.get(resistanceLevels, i)
if close > level
line.delete(array.get(resLines, i))
array.remove(resLines, i)
array.remove(resistanceLevels, i)
array.remove(resistanceCounts, i)
if level == doubleTopLevel
hasDoubleTop := false
doubleTopLevel := na
if array.size(supportLevels) > 0
for i = array.size(supportLevels) - 1 to 0
float level = array.get(supportLevels, i)
if close < level
line.delete(array.get(supLines, i))
array.remove(supLines, i)
array.remove(supportLevels, i)
array.remove(supportCounts, i)
if level == doubleBottomLevel
hasDoubleBottom := false
doubleBottomLevel := na
// Limit arrays (after removals)
if array.size(resistanceLevels) > 10
line oldLine = array.shift(resLines)
line.delete(oldLine)
array.shift(resistanceLevels)
array.shift(resistanceCounts)
if array.size(supportLevels) > 10
line oldLine = array.shift(supLines)
line.delete(oldLine)
array.shift(supportLevels)
array.shift(supportCounts)
// Pattern Signal: 1 only if the exact required number of peaks is met
patternSignal = (hasDoubleTop or hasDoubleBottom) and (array.size(resistanceCounts) > 0 and array.get(resistanceCounts, array.size(resistanceCounts) - 1) == requiredPeaks or array.size(supportCounts) > 0 and array.get(supportCounts, array.size(supportCounts) - 1) == requiredPeaks) ? 1 : 0
// New: Nearest Double Level Price
var float nearestDoubleLevel = na
if hasDoubleTop and not na(doubleTopLevel)
nearestDoubleLevel := doubleTopLevel
if hasDoubleBottom and not na(doubleBottomLevel)
nearestDoubleLevel := na(nearestDoubleLevel) ? doubleBottomLevel : (math.abs(close - doubleBottomLevel) < math.abs(close - nearestDoubleLevel) ? doubleBottomLevel : nearestDoubleLevel)
// New: Distance to Nearest Level (using ATR for normalization)
var float atr = ta.atr(atrLength)
var float distanceNormalizedATR = na
if not na(nearestDoubleLevel) and not na(atr) and atr > 0
distanceNormalizedATR := math.abs(close - nearestDoubleLevel) / atr
// Optional Bounce Signal (for reference)
bounceSignal = 0
if array.size(resistanceLevels) > 0
for i = 0 to array.size(resistanceLevels) - 1
float level = array.get(resistanceLevels, i)
if low <= level and high >= level and close < level
bounceSignal := 1
if array.size(supportLevels) > 0
for i = 0 to array.size(supportLevels) - 1
float level = array.get(supportLevels, i)
if high >= level and low <= level and close > level
bounceSignal := 1
// Outputs
plot(patternSignal, title="Pattern Signal", color=patternSignal == 1 ? color.purple : na, style=plot.style_circles)
plot(bounceSignal, title="Bounce Signal", color=bounceSignal == 1 ? color.yellow : na, style=plot.style_circles)
plot(nearestDoubleLevel, title="Nearest Double Level Price", color=color.orange)
plot(distanceNormalizedATR, title="Normalized Distance (ATR)", color=color.green)
bgcolor(patternSignal == 1 ? color.new(color.purple, 80) : na)
if patternSignal == 1 and barstate.isconfirmed
alert("Double Pattern detected on " + syminfo.ticker + " at " + str.tostring(close), alert.freq_once_per_bar_close)
if barstate.islast
var table infoTable = table.new(position.top_right, 1, 4, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 0, "Pattern: " + str.tostring(patternSignal), bgcolor=patternSignal == 1 ? color.purple : color.gray)
table.cell(infoTable, 0, 1, "Bounce: " + str.tostring(bounceSignal), bgcolor=bounceSignal == 1 ? color.yellow : color.gray)
table.cell(infoTable, 0, 2, "Level: " + str.tostring(nearestDoubleLevel, "#.##"), bgcolor=color.orange)
table.cell(infoTable, 0, 3, "ATR Dist: " + str.tostring(distanceNormalizedATR, "#.##"), bgcolor=color.green)
Double Top/Bottom Screener 3-5 peaks //@version=6
indicator("Double Top/Bottom Screener", overlay=true, max_lines_count=500)
// Inputs
leftBars = input.int(5, "Left Bars")
rightBars = input.int(5, "Right Bars")
tolerance = input.float(0.02, "Max Difference (e.g., 0.02 for 2 cents)", step=0.01)
atrLength = input.int(14, "ATR Length for Normalized Distance", minval=1)
maxPeaks = input.int(5, "Max Identical Peaks", minval=2, maxval=5)
// Declarations of persistent variables and arrays
var array resistanceLevels = array.new(0)
var array resistanceCounts = array.new(0)
var array supportLevels = array.new(0)
var array supportCounts = array.new(0)
var array resLines = array.new(0)
var array supLines = array.new(0)
var bool hasDoubleTop = false
var bool hasDoubleBottom = false
var float doubleTopLevel = na
var float doubleBottomLevel = na
var int todayStart = na
var bool isNewDay = false
// Step 1: Identify Swing Highs/Lows
swingHigh = ta.pivothigh(high, leftBars, rightBars)
swingLow = ta.pivotlow(low, leftBars, rightBars)
// Today's premarket start (04:00 AM ET)
if dayofmonth != dayofmonth
todayStart := timestamp(syminfo.timezone, year, month, dayofmonth, 4, 0, 0)
isNewDay := true
else
isNewDay := false
// Clear arrays and reset flags only once at premarket start
if isNewDay and time >= todayStart
array.clear(resistanceLevels)
array.clear(supportLevels)
array.clear(resistanceCounts)
array.clear(supportCounts)
array.clear(resLines)
array.clear(supLines)
hasDoubleTop := false
hasDoubleBottom := false
doubleTopLevel := na
doubleBottomLevel := na
// Add new swings and check for identical peaks
if not na(swingHigh) and time >= todayStart
bool isEqualHigh = false
int peakIndex = -1
float prevLevel = na // Declare prevLevel with initial value
if array.size(resistanceLevels) > 0
for i = 0 to array.size(resistanceLevels) - 1
prevLevel := array.get(resistanceLevels, i)
if math.abs(swingHigh - prevLevel) <= tolerance
isEqualHigh := true
peakIndex := i
break
if isEqualHigh and peakIndex >= 0
array.set(resistanceCounts, peakIndex, array.get(resistanceCounts, peakIndex) + 1)
if array.get(resistanceCounts, peakIndex) >= maxPeaks
hasDoubleTop := true
doubleTopLevel := prevLevel
else
array.push(resistanceLevels, swingHigh)
array.push(resistanceCounts, 1)
line newResLine = line.new(bar_index - rightBars, swingHigh, bar_index, swingHigh, color=color.red, width=2, extend=extend.right)
array.push(resLines, newResLine)
if not na(swingLow) and time >= todayStart
bool isEqualLow = false
int peakIndex = -1
float prevLevel = na // Declare prevLevel with initial value
if array.size(supportLevels) > 0
for i = 0 to array.size(supportLevels) - 1
prevLevel := array.get(supportLevels, i)
if math.abs(swingLow - prevLevel) <= tolerance
isEqualLow := true
peakIndex := i
break
if isEqualLow and peakIndex >= 0
array.set(supportCounts, peakIndex, array.get(supportCounts, peakIndex) + 1)
if array.get(supportCounts, peakIndex) >= maxPeaks
hasDoubleBottom := true
doubleBottomLevel := prevLevel
else
array.push(supportLevels, swingLow)
array.push(supportCounts, 1)
line newSupLine = line.new(bar_index - rightBars, swingLow, bar_index, swingLow, color=color.green, width=2, extend=extend.right)
array.push(supLines, newSupLine)
// Monitor and remove broken levels/lines; reset pattern if the equal level breaks
if array.size(resistanceLevels) > 0
for i = array.size(resistanceLevels) - 1 to 0
float level = array.get(resistanceLevels, i)
if close > level
line.delete(array.get(resLines, i))
array.remove(resLines, i)
array.remove(resistanceLevels, i)
array.remove(resistanceCounts, i)
if level == doubleTopLevel
hasDoubleTop := false
doubleTopLevel := na
if array.size(supportLevels) > 0
for i = array.size(supportLevels) - 1 to 0
float level = array.get(supportLevels, i)
if close < level
line.delete(array.get(supLines, i))
array.remove(supLines, i)
array.remove(supportLevels, i)
array.remove(supportCounts, i)
if level == doubleBottomLevel
hasDoubleBottom := false
doubleBottomLevel := na
// Limit arrays (after removals)
if array.size(resistanceLevels) > 10
line oldLine = array.shift(resLines)
line.delete(oldLine)
array.shift(resistanceLevels)
array.shift(resistanceCounts)
if array.size(supportLevels) > 10
line oldLine = array.shift(supLines)
line.delete(oldLine)
array.shift(supportLevels)
array.shift(supportCounts)
// Pattern Signal: 1 if any pattern with maxPeaks is active and unbroken
patternSignal = (hasDoubleTop or hasDoubleBottom) ? 1 : 0
// New: Nearest Double Level Price
var float nearestDoubleLevel = na
if hasDoubleTop and not na(doubleTopLevel)
nearestDoubleLevel := doubleTopLevel
if hasDoubleBottom and not na(doubleBottomLevel)
nearestDoubleLevel := na(nearestDoubleLevel) ? doubleBottomLevel : (math.abs(close - doubleBottomLevel) < math.abs(close - nearestDoubleLevel) ? doubleBottomLevel : nearestDoubleLevel)
// New: Distance to Nearest Level (using ATR for normalization)
var float atr = ta.atr(atrLength)
var float distanceNormalizedATR = na
if not na(nearestDoubleLevel) and not na(atr) and atr > 0
distanceNormalizedATR := math.abs(close - nearestDoubleLevel) / atr
// Optional Bounce Signal (for reference)
bounceSignal = 0
if array.size(resistanceLevels) > 0
for i = 0 to array.size(resistanceLevels) - 1
float level = array.get(resistanceLevels, i)
if low <= level and high >= level and close < level
bounceSignal := 1
if array.size(supportLevels) > 0
for i = 0 to array.size(supportLevels) - 1
float level = array.get(supportLevels, i)
if high >= level and low <= level and close > level
bounceSignal := 1
// Outputs
plot(patternSignal, title="Pattern Signal", color=patternSignal == 1 ? color.purple : na, style=plot.style_circles)
plot(bounceSignal, title="Bounce Signal", color=bounceSignal == 1 ? color.yellow : na, style=plot.style_circles)
plot(nearestDoubleLevel, title="Nearest Double Level Price", color=color.orange)
plot(distanceNormalizedATR, title="Normalized Distance (ATR)", color=color.green)
bgcolor(patternSignal == 1 ? color.new(color.purple, 80) : na)
if patternSignal == 1 and barstate.isconfirmed
alert("Double Pattern detected on " + syminfo.ticker + " at " + str.tostring(close), alert.freq_once_per_bar_close)
if barstate.islast
var table infoTable = table.new(position.top_right, 1, 4, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 0, "Pattern: " + str.tostring(patternSignal), bgcolor=patternSignal == 1 ? color.purple : color.gray)
table.cell(infoTable, 0, 1, "Bounce: " + str.tostring(bounceSignal), bgcolor=bounceSignal == 1 ? color.yellow : color.gray)
table.cell(infoTable, 0, 2, "Level: " + str.tostring(nearestDoubleLevel, "#.##"), bgcolor=color.orange)
table.cell(infoTable, 0, 3, "ATR Dist: " + str.tostring(distanceNormalizedATR, "#.##"), bgcolor=color.green)
MA Pack + Cross Signals (Short vs Long)Overview
A flexible moving average pack that lets you switch between short-term trend detection and long-term trend confirmation .
Short-term mode: plots 5, 10, 20, and 50 MAs with early crossovers (10/50, 20/50).
Long-term mode: plots 50, 100, 200 MAs with Golden Cross and Death Cross signals.
Choice of SMA or EMA .
Alerts included for all crossovers.
Why Use It
Catch early trend shifts in short-term mode.
Confirm institutional trend levels in long-term mode.
Visual signals (triangles + labels) make spotting setups easy.
Alert-ready for automated trade monitoring.
Usage
Add to chart.
In settings, choose Short-term or Long-term .
Watch for markers:
Green triangles = bullish cross
Red triangles = bearish cross
Green label = Golden Cross
Red label = Death Cross
Optional: enable alerts for notifications.
Market Pressure Oscillator█ OVERVIEW
The Market Pressure Oscillator is an advanced technical indicator for TradingView, enabling traders to identify potential trend reversals and momentum shifts through candle-based pressure analysis and divergence detection. It combines a smoothed oscillator with moving average signals, overbought/oversold levels, and divergence visualization, enhanced by customizable gradients, dynamic band colors, and alerts for quick decision-making.
█ CONCEPT
The indicator measures buying or selling pressure based on candle body size (open-to-close difference) and direction, with optional smoothing for clarity and divergence detection between price action and the oscillator. It relies solely on candle data, offering insights into trend strength, overbought/oversold conditions, and potential reversals with a customizable visual presentation.
█ WHY USE IT?
- Divergence Detection: Identifies bullish and bearish divergences to reinforce signals, especially near overbought/oversold zones.
- Candle Pressure Analysis: Measures pressure based on candle body size, normalized to a ±100 scale.
- Signal Generation: Provides buy/sell signals via overbought/oversold crossovers, zero-line crossovers, moving average zero-line crossovers, and dynamic band color changes.
- Visual Clarity: Uses dynamic colors, gradients, and fill layers for intuitive chart analysis.
Flexibility: Extensive settings allow customization to individual trading preferences.
█ HOW IT WORKS?
- Candle Pressure Calculation: Computes candle body size as math.abs(close - open), normalized against the average body size over a lookback period (avgBody = ta.sma(body, len)). - Candle direction (bullish: +1, bearish: -1, neutral: 0) is multiplied by body weight to derive pressure.
- Cumulative Pressure: Sums pressure values over the lookback period (Lookback Length) and normalizes to ±100 relative to the maximum possible value.
- Smoothing: Optionally applies EMA (Smoothing Length) to normalized pressure.
- Moving Average: Calculates SMA (Moving Average Length) for trend confirmation (Moving Average (SMA)).
- Divergence Detection: Identifies bullish/bearish divergences by comparing price and oscillator pivot highs/lows within a specified range (Pivot Length). Divergence signals appear with a delay equal to the Pivot Length.
- Signals: Generates signals for:
Crossing oversold upward (buy) or overbought downward (sell).
Crossing the zero line by the oscillator or moving average (buy/sell).
Bullish/bearish divergences, marked with labels, enhancing signals, especially near overbought/oversold zones.
Dynamic band color changes when the moving average crosses MA overbought/oversold thresholds (green for oversold, red for overbought).
- Visualization: Plots the oscillator and moving average with dynamic colors, gradient fills, transparent bands, and labels, with customizable overbought/oversold levels.
Alerts: Built-in alerts for divergences, overbought/oversold crossovers, and zero-line crossovers (oscillator and moving average).
█ SETTINGS AND CUSTOMIZATION
- Lookback Length: Period for aggregating candle pressure (default: 14).
- Smoothing Length (EMA): EMA length for smoothing the oscillator (default: 1). Higher values smooth the signal but may reduce signal frequency; adjust overbought/oversold levels accordingly.
- Moving Average Length (SMA): SMA length for the moving average (default: 14, minval=1). Higher values make SMA a trend indicator, requiring adjusted MA overbought/oversold levels.
- Pivot Length (Left/Right): Candles for detecting pivot highs/lows in divergence calculations (default: 2, minval=1). Higher values reduce noise but add delay equal to the set value.
- Enable Divergence Detection: Enables divergence detection (default: true).
- Overbought/Oversold Levels: Thresholds for the oscillator (default: 30/-30) and moving average (default: 10/-10). For the moving average, no arrows appear; bands change color from gray to green (oversold) or red (overbought), reinforcing entry signals.
- Signal Type: Select signals to display: "None", "Overbought/Oversold", "Zero Line", "MA Zero Line", "All" (default: "Overbought/Oversold").
- Colors and Gradients: Customize colors for bullish/bearish oscillator, moving average, zero line, overbought/oversold levels, and divergence labels.
- Transparency: Adjust gradient fill transparency (default: 70, minval=0, maxval=100) and band/label transparency (default: 40, minval=0, maxval=100) for consistent visuals.
- Visualizations: Enable/disable moving average, gradients for zero/overbought/oversold levels, and gradient fills.
█ USAGE EXAMPLES
- Momentum Analysis: Observe the MPO Oscillator above 0 for bullish momentum or below 0 for bearish momentum. The SMA, being smoother, reacts slower and can confirm trend direction as a noise filter.
- Reversal Signals: Look for buy triangles when the oscillator crosses oversold upward, especially when the SMA is below the MA oversold threshold and the band turns green. Similarly, seek sell triangles when crossing overbought downward, with the SMA above the MA overbought threshold and the band turning red.
- Using Divergences: Treat bullish (green labels) and bearish (red labels) divergences as reinforcement for other signals, especially near overbought/oversold zones, indicating stronger potential trend reversals.
- Customization: Adjust lookback length, smoothing, and moving average length to specific instruments and timeframes to minimize false signals.
█ USER NOTES
Combine the indicator with tools like Fibonacci levels or pivot points to enhance accuracy.
Test different settings for lookback length, smoothing, and moving average length on your chosen instrument and timeframe to find optimal values.
TA█ TA Library
📊 OVERVIEW
TA is a Pine Script technical analysis library. This library provides 25+ moving averages and smoothing filters , from classic SMA/EMA to Kalman Filters and adaptive algorithms, implemented based on academic research.
🎯 Core Features
Academic Based - Algorithms follow original papers and formulas
Performance Optimized - Pre-calculated constants for faster response
Unified Interface - Consistent function design
Research Based - Integrates technical analysis research
🎯 CONCEPTS
Library Design Philosophy
This technical analysis library focuses on providing:
Academic Foundation
Algorithms based on published research papers and academic standards
Implementations that follow original mathematical formulations
Clear documentation with research references
Developer Experience
Unified interface design for consistent usage patterns
Pre-calculated constants for optimal performance
Comprehensive function collection to reduce development time
Single import statement for immediate access to all functions
Each indicator encapsulated as a simple function call - one line of code simplifies complexity
Technical Excellence
25+ carefully implemented moving averages and filters
Support for advanced algorithms like Kalman Filter and MAMA/FAMA
Optimized code structure for maintainability and reliability
Regular updates incorporating latest research developments
🚀 USING THIS LIBRARY
Import Library
//@version=6
import DCAUT/TA/1 as dta
indicator("Advanced Technical Analysis", overlay=true)
Basic Usage Example
// Classic moving average combination
ema20 = ta.ema(close, 20)
kama20 = dta.kama(close, 20)
plot(ema20, "EMA20", color.red, 2)
plot(kama20, "KAMA20", color.green, 2)
Advanced Trading System
// Adaptive moving average system
kama = dta.kama(close, 20, 2, 30)
= dta.mamaFama(close, 0.5, 0.05)
// Trend confirmation and entry signals
bullTrend = kama > kama and mamaValue > famaValue
bearTrend = kama < kama and mamaValue < famaValue
longSignal = ta.crossover(close, kama) and bullTrend
shortSignal = ta.crossunder(close, kama) and bearTrend
plot(kama, "KAMA", color.blue, 3)
plot(mamaValue, "MAMA", color.orange, 2)
plot(famaValue, "FAMA", color.purple, 2)
plotshape(longSignal, "Buy", shape.triangleup, location.belowbar, color.green)
plotshape(shortSignal, "Sell", shape.triangledown, location.abovebar, color.red)
📋 FUNCTIONS REFERENCE
ewma(source, alpha)
Calculates the Exponentially Weighted Moving Average with dynamic alpha parameter.
Parameters:
source (series float) : Series of values to process.
alpha (series float) : The smoothing parameter of the filter.
Returns: (float) The exponentially weighted moving average value.
dema(source, length)
Calculates the Double Exponential Moving Average (DEMA) of a given data series.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Double Exponential Moving Average value.
tema(source, length)
Calculates the Triple Exponential Moving Average (TEMA) of a given data series.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Triple Exponential Moving Average value.
zlema(source, length)
Calculates the Zero-Lag Exponential Moving Average (ZLEMA) of a given data series. This indicator attempts to eliminate the lag inherent in all moving averages.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Zero-Lag Exponential Moving Average value.
tma(source, length)
Calculates the Triangular Moving Average (TMA) of a given data series. TMA is a double-smoothed simple moving average that reduces noise.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Triangular Moving Average value.
frama(source, length)
Calculates the Fractal Adaptive Moving Average (FRAMA) of a given data series. FRAMA adapts its smoothing factor based on fractal geometry to reduce lag. Developed by John Ehlers.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the moving average calculation.
Returns: (float) The calculated Fractal Adaptive Moving Average value.
kama(source, length, fastLength, slowLength)
Calculates Kaufman's Adaptive Moving Average (KAMA) of a given data series. KAMA adjusts its smoothing based on market efficiency ratio. Developed by Perry J. Kaufman.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the efficiency calculation.
fastLength (simple int) : Fast EMA length for smoothing calculation. Optional. Default is 2.
slowLength (simple int) : Slow EMA length for smoothing calculation. Optional. Default is 30.
Returns: (float) The calculated Kaufman's Adaptive Moving Average value.
t3(source, length, volumeFactor)
Calculates the Tilson Moving Average (T3) of a given data series. T3 is a triple-smoothed exponential moving average with improved lag characteristics. Developed by Tim Tillson.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the moving average calculation.
volumeFactor (simple float) : Volume factor affecting responsiveness. Optional. Default is 0.7.
Returns: (float) The calculated Tilson Moving Average value.
ultimateSmoother(source, length)
Calculates the Ultimate Smoother of a given data series. Uses advanced filtering techniques to reduce noise while maintaining responsiveness. Based on digital signal processing principles by John Ehlers.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the smoothing calculation.
Returns: (float) The calculated Ultimate Smoother value.
kalmanFilter(source, processNoise, measurementNoise)
Calculates the Kalman Filter of a given data series. Optimal estimation algorithm that estimates true value from noisy observations. Based on the Kalman Filter algorithm developed by Rudolf Kalman (1960).
Parameters:
source (series float) : Series of values to process.
processNoise (simple float) : Process noise variance (Q). Controls adaptation speed. Optional. Default is 0.05.
measurementNoise (simple float) : Measurement noise variance (R). Controls smoothing. Optional. Default is 1.0.
Returns: (float) The calculated Kalman Filter value.
mcginleyDynamic(source, length)
Calculates the McGinley Dynamic of a given data series. McGinley Dynamic is an adaptive moving average that adjusts to market speed changes. Developed by John R. McGinley Jr.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the dynamic calculation.
Returns: (float) The calculated McGinley Dynamic value.
mama(source, fastLimit, slowLimit)
Calculates the Mesa Adaptive Moving Average (MAMA) of a given data series. MAMA uses Hilbert Transform Discriminator to adapt to market cycles dynamically. Developed by John F. Ehlers.
Parameters:
source (series float) : Series of values to process.
fastLimit (simple float) : Maximum alpha (responsiveness). Optional. Default is 0.5.
slowLimit (simple float) : Minimum alpha (smoothing). Optional. Default is 0.05.
Returns: (float) The calculated Mesa Adaptive Moving Average value.
fama(source, fastLimit, slowLimit)
Calculates the Following Adaptive Moving Average (FAMA) of a given data series. FAMA follows MAMA with reduced responsiveness for crossover signals. Developed by John F. Ehlers.
Parameters:
source (series float) : Series of values to process.
fastLimit (simple float) : Maximum alpha (responsiveness). Optional. Default is 0.5.
slowLimit (simple float) : Minimum alpha (smoothing). Optional. Default is 0.05.
Returns: (float) The calculated Following Adaptive Moving Average value.
mamaFama(source, fastLimit, slowLimit)
Calculates Mesa Adaptive Moving Average (MAMA) and Following Adaptive Moving Average (FAMA).
Parameters:
source (series float) : Series of values to process.
fastLimit (simple float) : Maximum alpha (responsiveness). Optional. Default is 0.5.
slowLimit (simple float) : Minimum alpha (smoothing). Optional. Default is 0.05.
Returns: ( ) Tuple containing values.
laguerreFilter(source, length, gamma, order)
Calculates the standard N-order Laguerre Filter of a given data series. Standard Laguerre Filter uses uniform weighting across all polynomial terms. Developed by John F. Ehlers.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Length for UltimateSmoother preprocessing.
gamma (simple float) : Feedback coefficient (0-1). Lower values reduce lag. Optional. Default is 0.8.
order (simple int) : The order of the Laguerre filter (1-10). Higher order increases lag. Optional. Default is 8.
Returns: (float) The calculated standard Laguerre Filter value.
laguerreBinomialFilter(source, length, gamma)
Calculates the Laguerre Binomial Filter of a given data series. Uses 6-pole feedback with binomial weighting coefficients. Developed by John F. Ehlers.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Length for UltimateSmoother preprocessing.
gamma (simple float) : Feedback coefficient (0-1). Lower values reduce lag. Optional. Default is 0.5.
Returns: (float) The calculated Laguerre Binomial Filter value.
superSmoother(source, length)
Calculates the Super Smoother of a given data series. SuperSmoother is a second-order Butterworth filter from aerospace technology. Developed by John F. Ehlers.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Period for the filter calculation.
Returns: (float) The calculated Super Smoother value.
rangeFilter(source, length, multiplier)
Calculates the Range Filter of a given data series. Range Filter reduces noise by filtering price movements within a dynamic range.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the average range calculation.
multiplier (simple float) : Multiplier for the smooth range. Higher values increase filtering. Optional. Default is 2.618.
Returns: ( ) Tuple containing filtered value, trend direction, upper band, and lower band.
qqe(source, rsiLength, rsiSmooth, qqeFactor)
Calculates the Quantitative Qualitative Estimation (QQE) of a given data series. QQE is an improved RSI that reduces noise and provides smoother signals. Developed by Igor Livshin.
Parameters:
source (series float) : Series of values to process.
rsiLength (simple int) : Number of bars for the RSI calculation. Optional. Default is 14.
rsiSmooth (simple int) : Number of bars for smoothing the RSI. Optional. Default is 5.
qqeFactor (simple float) : QQE factor for volatility band width. Optional. Default is 4.236.
Returns: ( ) Tuple containing smoothed RSI and QQE trend line.
sslChannel(source, length)
Calculates the Semaphore Signal Level (SSL) Channel of a given data series. SSL Channel provides clear trend signals using moving averages of high and low prices.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the moving average calculation.
Returns: ( ) Tuple containing SSL Up and SSL Down lines.
ma(source, length, maType)
Calculates a Moving Average based on the specified type. Universal interface supporting all moving average algorithms.
Parameters:
source (series float) : Series of values to process.
length (simple int) : Number of bars for the moving average calculation.
maType (simple MaType) : Type of moving average to calculate. Optional. Default is SMA.
Returns: (float) The calculated moving average value based on the specified type.
atr(length, maType)
Calculates the Average True Range (ATR) using the specified moving average type. Developed by J. Welles Wilder Jr.
Parameters:
length (simple int) : Number of bars for the ATR calculation.
maType (simple MaType) : Type of moving average to use for smoothing. Optional. Default is RMA.
Returns: (float) The calculated Average True Range value.
macd(source, fastLength, slowLength, signalLength, maType, signalMaType)
Calculates the Moving Average Convergence Divergence (MACD) with customizable MA types. Developed by Gerald Appel.
Parameters:
source (series float) : Series of values to process.
fastLength (simple int) : Period for the fast moving average.
slowLength (simple int) : Period for the slow moving average.
signalLength (simple int) : Period for the signal line moving average.
maType (simple MaType) : Type of moving average for main MACD calculation. Optional. Default is EMA.
signalMaType (simple MaType) : Type of moving average for signal line calculation. Optional. Default is EMA.
Returns: ( ) Tuple containing MACD line, signal line, and histogram values.
dmao(source, fastLength, slowLength, maType)
Calculates the Dual Moving Average Oscillator (DMAO) of a given data series. Uses the same algorithm as the Percentage Price Oscillator (PPO), but can be applied to any data series.
Parameters:
source (series float) : Series of values to process.
fastLength (simple int) : Period for the fast moving average.
slowLength (simple int) : Period for the slow moving average.
maType (simple MaType) : Type of moving average to use for both calculations. Optional. Default is EMA.
Returns: (float) The calculated Dual Moving Average Oscillator value as a percentage.
continuationIndex(source, length, gamma, order)
Calculates the Continuation Index of a given data series. The index represents the Inverse Fisher Transform of the normalized difference between an UltimateSmoother and an N-order Laguerre filter. Developed by John F. Ehlers, published in TASC 2025.09.
Parameters:
source (series float) : Series of values to process.
length (simple int) : The calculation length.
gamma (simple float) : Controls the phase response of the Laguerre filter. Optional. Default is 0.8.
order (simple int) : The order of the Laguerre filter (1-10). Optional. Default is 8.
Returns: (float) The calculated Continuation Index value.
📚 RELEASE NOTES
v1.0 (2025.09.24)
✅ 25+ technical analysis functions
✅ Complete adaptive moving average series (KAMA, FRAMA, MAMA/FAMA)
✅ Advanced signal processing filters (Kalman, Laguerre, SuperSmoother, UltimateSmoother)
✅ Performance optimized with pre-calculated constants and efficient algorithms
✅ Unified function interface design following TradingView best practices
✅ Comprehensive moving average collection (DEMA, TEMA, ZLEMA, T3, etc.)
✅ Volatility and trend detection tools (QQE, SSL Channel, Range Filter)
✅ Continuation Index - Latest research from TASC 2025.09
✅ MACD and ATR calculations supporting multiple moving average types
✅ Dual Moving Average Oscillator (DMAO) for arbitrary data series analysis
alangari EMA Crossoverإذا كان عندك متوسطين متحركين أسيين (EMA) بفترات مختلفة (مثلاً 10 و 21).
التقاطع الصاعد (Bullish Crossover): لما الـ EMA القصير (10) يقطع الـ EMA الطويل (21) من تحت لفوق → إشارة شراء.
التقاطع الهابط (Bearish Crossover): لما الـ EMA القصير يقطع الطويل من فوق لتحت → إشارة بيع.
Exponential Moving Averages (EMA) Crossover
An EMA crossover strategy uses two exponential moving averages with different periods (e.g., a fast EMA and a slow EMA).
Bullish Crossover: Occurs when the fast EMA crosses above the slow EMA, often interpreted as a buy signal indicating upward momentum.
Bearish Crossover: Occurs when the fast EMA crosses below the slow EMA, often interpreted as a sell signal indicating downward momentum.
This technique helps traders identify trend reversals and confirm the strength or weakness of the current price direction.
Simple Turnover (Enhanced v2)📊 Simple Turnover (Enhanced)
🔹 Overview
The Simple Turnover Indicator calculates a stock’s turnover by combining both price and volume, and then compares it against quarterly highs. This helps traders quickly gauge whether market participation in a move is strong enough to confirm a breakout, or weak and likely to be false.
Unlike volume alone, turnover considers both traded volume and price level, giving a truer reflection of capital flow in/out of a stock.
________________________________________
🔹 Formulae Used
1. Average Price (SMA)
AvgPrice=SMA(Close,n)
2. Average Volume (SMA)
AvgVol=SMA(Volume,n)
3. Turnover (Raw)
Turnover raw=AvgPrice × AvgVol
4. Unit Adjustment
• If Millions → Turnover = Turnover raw × 10^−6
• If Crores → Turnover = Turnover raw × 10^−7
• If Raw → Turnover = Turnover raw
5. Quarterly High Turnover (qHigh)
Within each calendar quarter (Jan–Mar, Apr–Jun, Jul–Sep, Oct–Dec), we track the maximum turnover seen:
qHigh=max (Turnover within current quarter)
________________________________________
🔹 Visualization
• Bars → Color follows price candle:
o Green if Close ≥ Open
o Red if Close < Open
• Blue Line → Rolling Quarterly High Turnover (qHigh)
________________________________________
🔹 Strategy Use Case
The Simple Turnover Indicator is most effective for confirming true vs false breakouts.
• A true breakout should be supported by increasing turnover, showing real capital backing the move.
• A false breakout often occurs with weak or declining turnover, suggesting lack of conviction.
📌 Example Strategy (3H timeframe):
1. Identify a demand zone using your preferred supply-demand indicator.
2. From this demand zone, monitor turnover bars.
3. A potential long entry is validated when:
o The current turnover bar is at least 20% higher than the previous one or two bars.
o Example setting: SMA length = 5 (i.e., turnover = 5-bar average close × 5-bar average volume).
4. This confirms strong participation in the move, increasing probability of a sustained breakout.
________________________________________
🔹 Disclaimer
⚠️ This indicator/strategy does not guarantee 100% accurate results.
It is intended to improve the probability of identifying true breakouts.
The actual success of the strategy will depend on price action, market momentum, and prevailing market conditions.
Always use this as a supporting tool along with broader trading analysis and risk management.
Irrationality Index by CRYPTO_ADA_BTC"The market can be irrational longer than you can stay solvent" ~ John Maynard Keynes
This indicator, the Irrationality Index, measures how far the current market price has deviated from a smoothed estimate of its "fair value," normalized for recent volatility. It provides traders with a visual sense of when the market may be behaving irrationally, without giving direct buy or sell signals.
How it works:
1. Fair Value Calculation
The indicator estimates a "fair value" for the asset using a combination of a long-term EMA (exponential moving average) and a linear regression trend over a configurable period. This fair value serves as a smoothed baseline for price, balancing trend-following and mean-reversion.
2. Volatility-Adjusted Z-Score
The deviation between price and fair value is measured in standard deviations of recent log returns:
Z = (log(price) - log(fairValue)) / volatility
This standardization accounts for different volatility environments, allowing comparison across assets.
3. Irrationality Score (0–100)
The Z-score is transformed using a logistic mapping into a 0–100 scale:
- 50 → price near fair value (rational zone)
- >75 → high irrationality, price stretched above fair value
- >90 → extreme irrationality, unsustainable extremes
- <25 → high irrationality, price stretched below fair value
- <10 → extreme bearish irrationality
4. Price vs Fair Value (% deviation)
The indicator plots the percentage difference between price and fair value:
pctDiff = (price - fairValue) / fairValue * 100
- Positive values → Percentage above fair value (optimistic / overvalued)
- Negative values → Percentage below fair value (pessimistic / undervalued)
Visuals:
- Irrationality (%) Line (0–100) shows irrationality level.
- Background Colors: Yellow= high bullish irrationality, Green= extreme bullish irrationality, Orange= high bearish irrationality, Red= extreme bearish irrationality.
- Price - FairValue (%) plot: price deviation vs fair value (%), Colored green above 0 and red below 0.
- Label: display actual price, estimated fair value, and Z-score for the latest bar.
- Alerts: configurable thresholds for high and extreme irrationality.
How to read it:
- 50 → Market trading near fair value.
- >75 / >90 → Price may be irrationally high; risk of pullback increases.
- <25 / <10 → Price may be irrationally low; potential rebound zones, but trends can continue.
- Price - FairValue (%) plot → visual guide for % price stretch relative to fair value.
Notes / Warnings:
- Measures relative deviation, not fundamental value!
- High irrationality scores do not automatically indicate trades; markets can remain can be irrational longer than you can stay solvent .
- Best used with other tools: momentum, volume, divergence, and multi-timeframe analysis.
Supertrend DashboardOverview
This dashboard is a multi-timeframe technical indicator dashboard based on Supertrend. It combines:
Trend detection via Supertrend
Momentum via RSI and OBV (volume)
Volatility via a basic candle-based metric (bs)
Trend strength via ADX
Multi-timeframe analysis to see whether the trend is bullish across different timeframes
It then displays this info in a table on the chart with colors for quick visual interpretation.
2️⃣ Inputs
Dashboard settings:
enableDashboard: Toggle the dashboard on/off
locationDashboard: Where the table appears (Top right, Bottom left, etc.)
sizeDashboard: Text size in the table
strategyName: Custom name for the strategy
Indicator settings:
factor (Supertrend factor): Controls how far the Supertrend lines are from price
atrLength: ATR period for Supertrend calculation
rsiLength: Period for RSI calculation
Visual settings:
colorBackground, colorFrame, colorBorder: Control dashboard style
3️⃣ Core Calculations
a) Supertrend
Supertrend is a trend-following indicator that generates bullish or bearish signals.
Logic:
Compute ATR (atr = ta.atr(atrLength))
Compute preliminary bands:
upperBand = src + factor * atr
lowerBand = src - factor * atr
Smooth bands to avoid false flips:
lowerBand := lowerBand > prevLower or close < prevLower ? lowerBand : prevLower
upperBand := upperBand < prevUpper or close > prevUpper ? upperBand : prevUpper
Determine direction (bullish / bearish):
dir = 1 → bullish
dir = -1 → bearish
Supertrend line = lowerBand if bullish, upperBand if bearish
Output:
st → line to plot
bull → boolean (true = bullish)
b) Buy / Sell Trigger
Logic:
bull = ta.crossover(close, supertrend) → close crosses above Supertrend → buy signal
bear = ta.crossunder(close, supertrend) → close crosses below Supertrend → sell signal
trigger → checks which signal was most recent:
trigger = ta.barssince(bull) < ta.barssince(bear) ? 1 : 0
1 → Buy
0 → Sell
c) RSI (Momentum)
rsi = ta.rsi(close, rsiLength)
Logic:
RSI > 50 → bullish
RSI < 50 → bearish
d) OBV / Volume Trend (vosc)
OBV tracks whether volume is pushing price up or down.
Manual calculation (safe for all Pine versions):
obv = ta.cum( math.sign( nz(ta.change(close), 0) ) * volume )
vosc = obv - ta.ema(obv, 20)
Logic:
vosc > 0 → bullish
vosc < 0 → bearish
e) Volatility (bs)
Measures how “volatile” the current candle is:
bs = ta.ema(math.abs((open - close) / math.max(high - low, syminfo.mintick) * 100), 3)
Higher % → stronger candle moves
Displayed on dashboard as a number
f) ADX (Trend Strength)
= ta.dmi(14, 14)
Logic:
adx > 20 → Trending
adx < 20 → Ranging
g) Multi-Timeframe Supertrend
Timeframes: 1m, 3m, 5m, 10m, 15m, 30m, 1H, 2H, 4H, 12H, 1D
Logic:
for tf in timeframes
= request.security(syminfo.tickerid, tf, f_supertrend(ohlc4, factor, atrLength))
array.push(tf_bulls, bull_tf ? 1.0 : 0.0)
bull_tf ? 1.0 : 0.0 → converts boolean to number
Then we calculate user rating:
userRating = (sum of bullish timeframes / total timeframes) * 10
0 → Strong Sell, 10 → Strong Buy
4️⃣ Dashboard Table Layout
Row Column 0 (Label) Column 1 (Value)
0 Strategy strategyName
1 Technical Rating textFromRating(userRating) (color-coded)
2 Current Signal Buy / Sell (based on last Supertrend crossover)
3 Current Trend Bullish / Bearish (based on Supertrend)
4 Trend Strength bs %
5 Volume vosc → Bullish/Bearish
6 Volatility adx → Trending/Ranging
7 Momentum RSI → Bullish/Bearish
8 Timeframe Trends 📶 Merged cell
9-19 1m → Daily Bullish/Bearish for each timeframe (green/red)
5️⃣ Color Logic
Green shades → bullish / trending / buy
Red / orange → bearish / weak / sell
Yellow → neutral / ranging
Example:
dashboard_cell_bg(1, 1, colorFromRating(userRating))
dashboard_cell_bg(1, 2, trigger ? color.green : color.red)
dashboard_cell_bg(1, 3, superBull ? color.green : color.red)
Makes the dashboard visually intuitive
6️⃣ Key Logic Flow
Calculate Supertrend on current timeframe
Detect buy/sell triggers based on crossover
Calculate RSI, OBV, Volatility, ADX
Request Supertrend on multiple timeframes → convert to 1/0
Compute user rating (percentage of bullish timeframes)
Populate dashboard table with colors and values
✅ The result: You get a compact, fast, multi-timeframe trend dashboard that shows:
Current signal (Buy/Sell)
Current trend (Bullish/Bearish)
Momentum, volatility, and volume cues
Trend across multiple timeframes
Overall technical rating
It’s essentially a full trend-strength scanner directly on your chart.
Mongoose Global Conflict Risk Index v1Overview
The Mongoose Global Conflict Risk Index v1 is a multi-asset composite indicator designed to track the early pricing of geopolitical stress and potential conflict risk across global markets. By combining signals from safe havens, volatility indices, energy markets, and emerging market equities, the index provides a normalized 0–10 score with clear bias classifications (Neutral, Caution, Elevated, High, Shock).
This tool is not predictive of headlines but captures when markets are clustering around conflict-sensitive assets before events are widely recognized.
Methodology
The indicator calculates rolling rate-of-change z-scores for eight conflict-sensitive assets:
Gold (XAUUSD) – classic safe haven
US Dollar Index (DXY) – global reserve currency flows
VIX (Equity Volatility) – S&P 500 implied volatility
OVX (Crude Oil Volatility Index) – energy stress gauge
Crude Oil (CL1!) – WTI front contract
Natural Gas (NG1!) – energy security proxy, especially Europe
EEM (Emerging Markets ETF) – global risk capital flight
FXI (China ETF) – Asia/China proxy risk
Rules:
Safe havens and vol indices trigger when z-score > threshold.
Energy triggers when z-score > threshold.
Risk assets trigger when z-score < –threshold.
Each trigger is assigned a weight, summed, normalized, and scaled 0–10.
Bias classification:
0–2: Neutral
2–4: Caution
4–6: Elevated
6–8: High
8–10: Conflict Risk-On
How to Use
Timeframes:
Daily (1D) for strategic signals and early warnings.
4H for event shocks (missiles, sanctions, sudden escalations).
Weekly (1W) for sustained trends and macro build-ups.
What to Look For:
A single trigger (for example, Gold ON) may be noise.
A cluster of 2–3 triggers across Gold, USD, VIX, and Energy often marks early stress pricing.
Elevated readings (>4) = caution; High (>6) = rotation into havens; Shock (>8) = market conviction of conflict risk.
Practical Application:
Monitor as a heatmap of global stress.
Combine with fundamental or headline tracking.
Use alert conditions at ≥4, ≥6, ≥8 for systematic monitoring.
Notes
This indicator is for informational and educational purposes only.
It is not financial advice and should be used in conjunction with other analysis methods.
Simple Technicals Table📊 Simple Technicals Table
🎯 A comprehensive technical analysis dashboard displaying key pivot points and moving averages across multiple timeframes
📋 OVERVIEW
The Simple Technicals Table is a powerful indicator that organizes essential trading data into a clean, customizable table format. It combines Fibonacci-based pivot points with critical moving averages for both daily and weekly timeframes, giving traders instant access to key support/resistance levels and trend information.
Perfect for:
Technical analysts studying multi-timeframe data
Chart readers needing quick reference levels
Market researchers analyzing price patterns
Educational purposes and data visualization
🚀 KEY FEATURES
📊 Dual Timeframe Analysis
Daily (D1) and Weekly (W1) data side-by-side
Real-time updates as market conditions change
Seamless comparison between timeframes
🎯 Fibonacci Pivot Points
R3, R2, R1 : Resistance levels using Fibonacci ratios (38.2%, 61.8%, 100%)
PP : Central pivot point from previous period's data
S1, S2, S3 : Support levels with same methodology
📈 Complete EMA Suite
EMA 10 : Short-term trend identification
EMA 20 : Popular swing trading reference
EMA 50 : Medium-term trend confirmation
EMA 100 : Institutional support/resistance
EMA 200 : Long-term trend determination
📊 Essential Indicators
RSI 14 : Momentum for overbought/oversold conditions
ATR 14 : Volatility measurement for risk management
🎨 Full Customization
9 table positions : Place anywhere on your chart
5 text sizes : Tiny to huge for optimal visibility
Custom colors : Background, headers, and text
Optional pivot lines : Visual weekly levels on chart
⚙️ HOW IT WORKS
Fibonacci Pivot Calculation:
Pivot Point (PP) = (High + Low + Close) / 3
Range = High - Low
Resistance Levels:
R1 = PP + (Range × 0.382)
R2 = PP + (Range × 0.618)
R3 = PP + (Range × 1.000)
Support Levels:
S1 = PP - (Range × 0.382)
S2 = PP - (Range × 0.618)
S3 = PP - (Range × 1.000)
Smart Price Formatting:
< $1: 5 decimal places (crypto-friendly)
$1-$10: 4 decimal places
$10-$100: 3 decimal places
> $100: 2 decimal places
📊 TECHNICAL ANALYSIS APPLICATIONS
⚠️ EDUCATIONAL PURPOSE ONLY
This indicator is designed solely for technical analysis and educational purposes . It provides data visualization to help understand market structure and price relationships.
📈 Data Analysis Uses
Support & Resistance Identification : Visualize Fibonacci-based pivot levels
Trend Analysis : Study EMA relationships and price positioning
Multi-Timeframe Study : Compare daily and weekly technical data
Market Structure : Understand key technical levels and indicators
📚 Educational Benefits
Learn about Fibonacci pivot point calculations
Understand moving average relationships
Study RSI and ATR indicator values
Practice multi-timeframe technical analysis
🔍 Data Visualization Features
Organized table format for easy data reading
Color-coded levels for quick identification
Real-time technical indicator values
Historical data integrity maintained
🛠️ SETUP GUIDE
1. Installation
Search "Simple Technicals Table" in indicators
Add to chart (appears in middle-left by default)
Table displays automatically on any timeframe
2. Customization
Table Position : Choose from 9 locations
Text Size : Adjust for screen resolution
Colors : Match your chart theme
Pivot Lines : Toggle weekly level visualization
3. Optimization Tips
Use larger text on mobile devices
Dark backgrounds work well with light text
Enable pivot lines for visual reference
✅ BEST PRACTICES
Recommended Usage:
Use for technical analysis and educational study only
Combine with other analytical methods for comprehensive analysis
Study multi-timeframe data relationships
Practice understanding technical indicator values
Important Notes:
Levels based on previous period's data
Most effective in trending markets
No repainting - uses confirmed data only
Works on all instruments and timeframes
🔧 TECHNICAL SPECS
Performance:
Pine Script v5 optimized code
Minimal CPU/memory usage
Real-time data updates
No lookahead bias
Compatibility:
All chart types (Candlestick, Bar, Line)
Any instrument (Stocks, Forex, Crypto, etc.)
All timeframes supported
Mobile and desktop friendly
Data Accuracy:
Precise floating-point calculations
Historical data integrity maintained
No future data leakage
📱 DEVICE SUPPORT
✅ Desktop browsers (Chrome, Firefox, Safari, Edge)
✅ TradingView mobile app (iOS/Android)
✅ TradingView desktop application
✅ Light and dark themes
✅ All screen resolutions
📋 VERSION INFO
Version 1.0 - Initial Release
Fibonacci-based pivot calculations
Dual timeframe support (Daily/Weekly)
Complete EMA suite (10, 20, 50, 100, 200)
RSI and ATR indicators
Fully customizable interface
Optional pivot line visualization
Smart price formatting
Mobile-optimized display
⚠️ DISCLAIMER
This indicator is designed for technical analysis, educational and informational purposes ONLY . It provides data visualization and technical calculations to help users understand market structure and price relationships.
⚠️ NOT FOR TRADING DECISIONS
This tool does NOT provide trading signals or investment advice
All data is for analytical and educational purposes only
Users should not base trading decisions solely on this indicator
Always conduct thorough research and analysis before making any financial decisions
📚 Educational Use Only
Use for learning technical analysis concepts
Study market data and indicator relationships
Practice chart reading and data interpretation
Understand mathematical calculations behind technical indicators
The Simple Technicals Table provides technical data visualization to assist in market analysis education. It does not constitute financial advice, trading recommendations, or investment guidance. Users are solely responsible for their own research and decisions.
Author: ToTrieu
Version: 1.0
Category: Technical Analysis / Support & Resistance
License: Open source for educational use
💬 Questions? Comments? Feel free to reach out!
Volume Bubbles & Liquidity Heatmap [LuxAlgo]The Volume Bubbles & Liquidity Heatmap indicator highlights volume and liquidity clearly and precisely with its volume bubbles and liquidity heat map, allowing to identify key price areas.
Customize the bubbles with different time frames and different display modes: total volume, buy and sell volume, or delta volume.
🔶 USAGE
The primary objective of this tool is to offer traders a straightforward method for analyzing volume on any selected timeframe.
By default, the tool displays buy and sell volume bubbles for the daily timeframe over the last 2,000 bars. Traders should be aware of the difference between the timeframe of the chart and that of the bubbles.
The tool also displays a liquidity heat map to help traders identify price areas where liquidity accumulates or is lacking.
🔹 Volume Bubbles
The bubbles have three possible display modes:
Total Volume: Displays the total volume of trades per bubble.
Buy & Sell Volume: Each bubble is divided into buy and sell volume.
Delta Volume: Displays the difference between buy and sell volume.
Each bubble represents the trading volume for a given period. By default, the timeframe for each bubble is set to daily, meaning each bubble represents the trading volume for each day.
The size of each bubble is proportional to the volume traded; a larger bubble indicates greater volume, while a smaller bubble indicates lower volume.
The color of each bubble indicates the dominant volume: green for buy volume and red for sell volume.
One of the tool's main goals is to facilitate simple, clear, multi-timeframe volume analysis.
The previous chart shows Delta Volume bubbles with various chart and bubble timeframe configurations.
To correctly visualize the bubbles, traders must ensure there is a sufficient number of bars per bubble. This is achieved by using a lower chart timeframe and a higher bubble timeframe.
As can be seen in the image above, the greater the difference between the chart and bubble timeframes, the better the visualization.
🔹 Liquidity Heatmap
The other main element of the tool is the liquidity heatmap. By default, it divides the chart into 25 different price areas and displays the accumulated trading volume on each.
The image above shows a 4-hour BTC chart displaying only the liquidity heatmap. Traders should be aware of these key price areas and observe how the price behaves in them, looking for possible opportunities to engage with the market.
The main parameters for controlling the heatmap on the settings panel are Rows and Cell Minimum Size. Rows modifies the number of horizontal price areas displayed, while Cell Minimum Size modifies the minimum size of each liquidity cell in each row.
As can be seen in the above BTC hourly chart, the cell size is 24 at the top and 168 at the bottom. The cells are smaller on top and bigger on the bottom.
The color of each cell reflects the liquidity size with a gradient; this reflects the total volume traded within each cell. The default colors are:
Red: larger liquidity
Yellow: medium liquidity
Blue: lower liquidity
🔹 Using Both Tools Together
This indicator provides the means to identify directional bias and market timing.
The main idea is that if buyers are strong, prices are likely to increase, and if sellers are strong, prices are likely to decrease. This gives us a directional bias for opening long or short positions. Then, we combine our directional bias with price rejection or acceptance of key liquidity levels to determine the timing of opening or closing our positions.
Now, let's review some charts.
This first chart is BTC 1H with Delta Weekly Bubbles. Delta Bubbles measure the difference between buy and sell volume, so we can easily see which group is dominant (buyers or sellers) and how strong they are in any given week. This, along with the key price areas displayed by the Liquidity Heatmap, can help us navigate the markets.
We divided market behavior into seven groups, and each group has several bubbles, numbered from 1 to 17.
Bubbles 1, 2, and 3: After strong buyers market consolidates with positive delta, prices move up next week.
Bubbles 3, 4, and 5: Strength changes from buyers to sellers. Next week, prices go down.
Bubbles 6 and 7: The market trades at higher prices, but with negative delta. Next week, prices go down.
Bubbles 7, 8, and 9: Strength changes from sellers to buyers. Next weeks (9 and 10), prices go up.
Bubbles 10, 11, and 12: After strong buyers prices trade higher with a negative delta. Next weeks (12 and 13) prices go down.
Bubbles 12, 14, and 15: Strength changes from sellers to buyers; next week, prices increase.
Bubbles 15 and 16: The market trades higher with a very small positive delta; next week, prices go down.
Current bubble/week 17 is not yet finished. Right now, it is trading lower, but with a smaller negative delta than last week. This may signal that sellers are losing strength and that a potential reversal will follow, with prices trading higher.
This is the same BTC 1H chart, but with price rejections from key liquidity areas acting as strong price barriers.
When prices reach a key area with strong liquidity and are rejected, it signals a good time to take action.
By observing price behavior at certain key price levels, we can improve our timing for entering or exiting the markets.
🔶 DETAILS
🔹 Bubbles Display
From the settings panel, traders can configure the bubbles with four main parameters: Mode, Timeframe, Size%, and Shape.
The image above shows five-minute BTC charts with execution over the last 3,500 bars, different display modes, a daily timeframe, 100% size, and shape one.
The Size % parameter controls the overall size of the bubbles, while the Shape parameter controls their vertical growth.
Since the chart has two scales, one for time and one for price, traders can use the Shape parameter to make the bubbles round.
The chart above shows the same bubbles with different size and shape parameters.
You can also customize data labels and timeframe separators from the settings panel.
🔶 SETTINGS
Execute on last X bars: Number of bars for indicator execution
🔹 Bubbles
Display Bubbles: Enable/Disable volume bubbles.
Bubble Mode: Select from the following options: total volume, buy and sell volume, or the delta between buy and sell volume.
Bubble Timeframe: Select the timeframe for which the bubbles will be displayed.
Bubble Size %: Select the size of the bubbles as a percentage.
Bubble Shape: Select the shape of the bubbles. The larger the number, the more vertical the bubbles will be stretched.
🔹 Labels
Display Labels: Enable/Disable data labels, select size and location.
🔹 Separators
Display Separators: Enable/Disable timeframe separators and select color.
🔹 Liquidity Heatmap
Display Heatmap: Enable/Disable liquidity heatmap.
Heatmap Rows: select number of rows to be displayed.
Cell Minimum Size: Select the minimum size for each cell in each row.
Colors.
🔹 Style
Buy & Sell Volume Colors.
Dual Best MA Strategy AnalyzerDual Best MA Strategy Analyzer (Lookback Window)
What it does
This indicator scans a range of moving-average lengths and finds the single best MA for long crossovers and the single best MA for short crossunders over a fixed lookback window. It then plots those two “winner” MAs on your chart:
Best Long MA (green): The MA length that would have made the highest total profit using a simple “price crosses above MA → long; exit on cross back below” logic.
Best Short MA (red): The MA length that would have made the highest total profit using “price crosses below MA → short; exit on cross back above.”
You can switch between SMA and EMA, set the min/max length, choose a step size, and define the lookback window used for evaluation.
How it works (brief)
For each candidate MA length between Min MA Length and Max MA Length (stepping by Step Size), the script:
Builds the MA (SMA or EMA).
Simulates a naïve crossover strategy over the last Lookback Window candles:
Long model: enter on crossover, exit on crossunder.
Short model: enter on crossunder, exit on crossover.
Sums simple P&L in price units (no compounding, no fees/slippage).
Picks the best long and best short lengths by total P&L and plots those two MAs.
Note: Long and short are evaluated independently. The script plots MAs only; it doesn’t open positions.
Inputs
Min MA Length / Max MA Length – Bounds for MA search.
Step Size – Spacing between tested lengths (e.g., 10 tests 10, 20, 30…).
Use EMA instead of SMA – Toggle average type.
Lookback Window (candles) – Number of bars used to score each MA. Needs enough history to be meaningful.
What the plots mean
Best Long MA (green): If price crosses above this line (historically), that MA length produced the best long-side results over the lookback.
Best Short MA (red): If price crosses below this line (historically), that MA length produced the best short-side results.
These lines can change over time as new bars enter the lookback window. Think of them as adaptive “what worked best recently” guides, not fixed signals.
Practical tips
Timeframe matters: Run it on the timeframe you trade; the “best” length on 1h won’t match 1m or 1D.
Step size trade-off: Smaller steps = more precision but heavier compute. Larger steps = faster scans, coarser choices.
Use with confirmation: Combine with structure, volume, or volatility filters. This is a single-factor tester.
Normalization: P&L is in raw price units. For cross-symbol comparison, consider using one symbol at a time (or adapt the script to percent P&L).
Limitations & assumptions
No fees, funding, slippage, or position sizing.
Simple “in/out” on the next crossover; no stops/targets/filters.
Results rely on lookback choice and will repaint historically as the “best” length is re-selected with new data (the plot is adaptive, not forward-fixed).
The script tests up to ~101 candidates internally (bounded by your min/max/step).
Good uses
Quickly discover a recently effective MA length for trend following.
Compare SMA vs EMA performance on your market/timeframe.
Build a playbook: note which lengths tend to win in certain regimes (trending vs choppy).
Not included (by design)
Alerts, entries/exits, or a full strategy report. It’s an analyzer/overlay.
If you want alerts, you can add simple conditions like:
ta.crossover(close, plotLongMA) for potential long interest
ta.crossunder(close, plotShortMA) for potential short interest
Changelog / Notes
v1: Initial release. Array-based scanner, SMA/EMA toggle, adaptive long/short best MA plots, user-set lookback.
Disclaimer
This is educational tooling, not financial advice. Test thoroughly and use proper risk management.
Extremum Range MA Crossover Strategy1. Principle of Work & Strategy Logic ⚙️📈
Main idea: The strategy tries to catch the moment of a breakout from a price consolidation range (flat) and the start of a new trend. It combines two key elements:
Moving Average (MA) 📉: Acts as a dynamic support/resistance level and trend filter.
Range Extremes (Range High/Low) 🔺🔻: Define the borders of the recent price channel or consolidation.
The strategy does not attempt to catch absolute tops and bottoms. Instead, it enters an already formed move after the breakout, expecting continuation.
Type: Trend-following, momentum-based.
Timeframes: Works on different TFs (H1, H4, D), but best suited for H4 and higher, where breakouts are more meaningful.
2. Justification of Indicators & Settings ⚙️
A. Moving Average (MA) 📊
Why used: Core of the strategy. It smooths price fluctuations and helps define the trend. The price (via extremes) must cross the MA → signals a potential trend shift or strengthening.
Parameters:
maLength = 20: Default length (≈ one trading month, 20-21 days). Good balance between sensitivity & smoothing.
Lower TF → reduce (10–14).
Higher TF → increase (50).
maSource: Defines price source (default = Close). Alternatives (HL2, HLC3) → smoother, less noisy MA.
maType: Default = EMA (Exponential MA).
Why EMA? Faster reaction to recent price changes vs SMA → useful for breakout strategies.
Other options:
SMA 🟦 – classic, slowest.
WMA 🟨 – weights recent data stronger.
HMA 🟩 – near-zero lag, but “nervous,” more false signals.
DEMA/TEMA 🟧 – even faster & more sensitive than EMA.
VWMA 🔊 – volume-weighted.
ZLEMA ⏱ – reduced lag.
👉 Choice = tradeoff between speed of reaction & false signals.
B. Range Extremes (Previous High/Low) 📏
Why used: Define borders of recent trading range.
prevHigh = local resistance.
prevLow = local support.
Break of these levels on close = trigger.
Parameters:
lookbackPeriod = 5: Searches for highest high / lowest low of last 5 candles. Very recent range.
Higher value (10–20) → wider, stronger ranges but rarer signals.
3. Entry & Exit Rules 🎯
Long signals (BUY) 🟢📈
Condition (longCondition): Previous Low crosses MA from below upwards.
→ Price bounced from the bottom & strong enough to push range border above MA.
Execution: Auto-close short (if any) → open long.
Short signals (SELL) 🔴📉
Condition (shortCondition): Previous High crosses MA from above downwards.
→ Price rejected from the top, upper border failed above MA.
Execution: Auto-close long (if any) → open short.
Exit conditions 🚪
Exit Long (exitLongCondition): Close below prevLow.
→ Uptrend likely ended, range shifts down.
Exit Short (exitShortCondition): Close above prevHigh.
→ Downtrend likely ended, range shifts up.
⚠️ Important: Exit = only on candle close beyond extremes (not just wick).
4. Trading Settings ⚒️
overlay = true → indicators shown on chart.
initial_capital = 10000 💵.
default_qty_type = strategy.cash, default_qty_value = 100 → trades fixed $100 per order (not lots). Can switch to % of equity.
commission_type = strategy.commission.percent, commission_value = 0.1 → default broker fee = 0.1%. Adjust for your broker!
slippage = 3 → slippage = 3 ticks. Adjust to asset liquidity.
currency = USD.
margin_long = 100, margin_short = 100 → no leverage (100% margin).
5. Visualization on Chart 📊
The strategy draws 3 lines:
🔵 MA line (thickness 2).
🔴 Previous High (last N candles).
🟢 Previous Low (last N candles).
Also: entry/exit arrows & equity curve shown in backtest.
Disclaimer ⚠️📌
Risk Warning: This description & code are for educational purposes only. Not financial advice. Trading (Forex, Stocks, Crypto) carries high risk and may lead to full capital loss. You trade at your own risk.
Testing: Always backtest & demo test first. Past results ≠ future profits.
Responsibility: Author of this strategy & description is not responsible for your trading decisions or losses.
Volume Delta Oscillator with Divergence█ OVERVIEW
The Volume Delta Oscillator with Divergence is a technical indicator designed for the TradingView platform, helping traders identify potential trend reversal points and market momentum shifts through volume delta analysis and divergence detection. The indicator combines a smoothed volume delta oscillator with moving average-based signals, overbought/oversold levels, and divergence visualization, enhanced by configurable gradients and alerts for quick decision-making.
█ CONCEPT
The core idea of the indicator is to measure net buying or selling pressure through volume delta, smooth it for greater clarity, and detect divergences between price action and the oscillator. The indicator does not use external data, making it a compromise but practical tool for analyzing market dynamics based on available price and volume data. It provides insights into market dynamics, overbought/oversold conditions, and potential reversal points, with an attractive visual presentation.
█ WHY USE IT?
- Divergence detection: Identifies bullish and bearish divergences between price and the oscillator, signaling potential reversals.
- Volume delta analysis: Measures cumulative volume delta to assess buying/selling pressure, expressed as a percentage for cross-market comparability.
- Signal generation: Creates buy/sell signals based on overbought/oversold level crossovers, zero line crossovers, and moving average zero line crossovers.
- Visual clarity: Uses gradients, fills, and dynamic colors for intuitive chart analysis.
- Flexibility: Numerous settings allow adaptation to various markets (e.g., forex, crypto, stocks) and trading strategies.
█ HOW IT WORKS?
- Volume delta calculation: Computes net buying/selling pressure per candle as volume * (close - open) / (high - low), aggregated over a specified period (Cumulative Delta Length).
- Smoothing: Applies an EMA (Smoothing Length) to the cumulative delta percentage, creating a smoother oscillator (Delta Oscillator).
- Moving Average: Calculates an SMA (Moving Average Length) of the smoothed delta for trend confirmation (Moving Average (SMA)).
- Divergence detection: Identifies bullish and bearish divergences by comparing price and oscillator pivot highs/lows within a specified range (Pivot Length).
- Normalization: Delta is expressed as a percentage of total volume, ensuring consistency across instruments and timeframes.
- Signals: Generates signals for:
Crossing the oversold level upward (buy) or overbought level downward (sell).
Crossing the zero line by the oscillator or moving average (buy/sell).
Bullish/bearish divergences, marked with labels.
- Visualization: Draws the oscillator and moving average with dynamic colors, gradient fills, and transparent bands and labels, with configurable overbought/oversold levels.
- Alerts: Built-in alerts for divergence detection, overbought/oversold crossovers, and zero line crossovers (both oscillator and moving average).
█ SETTINGS AND CUSTOMIZATION
- Cumulative Delta Length: Period for aggregating volume delta (default: 14).
- Smoothing Length (EMA): EMA length for smoothing the delta oscillator (default: 2). Higher values smooth the signal but reduce the number of generated signals.
- Moving Average Length (SMA): SMA length for the moving average line (default: 40). Higher values allow SMA to be analyzed as a trend indicator, but require adjusting overbought/oversold levels for MA, as longer MA oscillates less.
- Pivot Length (Left/Right): Number of candles for detecting pivot highs/lows in divergence calculations (default: 2). Higher values can reduce noise but introduce a delay equal to the set value.
- Overbought/Oversold Levels: Thresholds for the oscillator (default: 18/-18) and for the moving average (default: 10/-10). For the moving average, no arrows appear; instead, the band changes color from gray to green (oversold) or red (overbought), which can strengthen entry signals for delta.
- Signal Type: Select signals to display: "Overbought/Oversold", "Zero Line", "MA Zero Line", "All", or "None" (default: Overbought/Oversold).
- Colors and gradients: Customize colors for bullish/bearish oscillator, moving average, zero line, overbought/oversold levels, and divergence labels.
- Transparency: Adjust gradient fill transparency (default: 70) and band/label transparency (default: 40) for consistent appearance.
- Visualizations: Enable/disable the moving average, gradients for zero/overbought/oversold levels, and gradient fills.
█ USAGE EXAMPLES
- Momentum analysis: Observe the delta oscillator above 0 for bullish momentum or below 0 for bearish momentum. The moving average (SMA), being smoothed, reacts more slowly and can confirm trend direction as a noise filter.
- Reversal signals: Look for buy triangles when the oscillator crosses the oversold level upward, especially when the moving average is below the MA oversold threshold. Similarly, look for sell triangles when crossing the overbought level downward, with the moving average above the MA overbought threshold. Divergence labels (bullish/bearish) indicate potential reversals.
- Divergence trading: Use bullish divergence labels (green) for potential buy opportunities and bearish labels (red) for sell opportunities, especially when confirmed by price action or other indicators.
- Customization: Adjust the cumulative delta length, smoothing, and moving average length to specific instruments and timeframes to minimize false signals.
█ NOTES FOR USERS
- Combine the indicator with other tools, such as Fibonacci levels, RSI, or pivot points, to increase accuracy.
- Test different settings for cumulative delta length, smoothing, and moving average length on your chosen instrument and timeframe to find optimal values.
Small-Cap — Sell Every Spike (Rendon1) Small-Cap — Sell Every Spike v6 — Strict, No Look-Ahead
Educational use only. This is not financial advice or a signal service.
This strategy targets low/ mid-float runners (≤ ~20M) that make parabolic spikes. It shorts qualified spikes and scales out into flushes. Logic is deliberately simple and transparent to avoid curve-fit.
What the strategy does
Detects a parabolic up move using:
Fast ROC over N bars
Big range vs ATR
Volume spike vs SMA
Fresh higher high (no stale spikes)
Enters short at bar close when conditions are met (no same-bar fills).
Manages exits with ATR targets and optional % covers.
Tracks float rotation intraday (manual float input) and blocks trades above a hard limit.
Draws daily spike-high resistance from confirmed daily bars (no repaint / no look-ahead).
Timeframes & market
Designed for 1–5 minute charts.
Intended for US small-caps; turn Premarket on.
Works intraday; avoid illiquid tickers or names with constant halts.
Entry, Exit, Risk (short side)
Entry: parabolic spike (ROC + Range≥ATR×K + Vol≥SMA×K, new HH).
Optional confirmations (OFF by default to “sell every spike”): upper-wick and VWAP cross-down.
Stop: ATR stop above entry (default 1.2× ATR).
Targets: TP1 = 1.0× ATR, TP2 = 2.0× ATR + optional 10/20/30% covers.
Safety: skip trades if RVOL is low or Float Rotation exceeds your limit (default warn 5×, hard 7×).
Inputs (Balanced defaults)
Price band: $2–$10
Float Shares: set per ticker (from Finviz).
RVOL(50) ≥ 1.5×
ROC(5) ≥ 1.0%, Range ≥ 1.6× ATR, Vol ≥ 1.8× SMA
Cooldown: 10 bars; Max trades/day: 6
Optional: Require wick (≥35%) and/or Require VWAP cross-down.
Presets suggestion:
• Balanced (defaults above)
• Safer: wick+VWAP ON, Range≥1.8×, trades/day 3–4
• Micro-float (<5M): ROC 1.4–1.8%, Range≥1.9–2.2×, Vol≥2.2×, RVOL≥2.0, wick 40–50%
No look-ahead / repaint notes
Daily spike-highs use request.security(..., lookahead_off) and shifted → only closed daily bars.
Orders arm next bar after entry; entries execute at bar close.
VWAP/ATR/ROC/Vol/RVOL are computed on the chart timeframe (no HTF peeking).
How to use
Build a watchlist: Float <20M, RelVol >2, Today +20% (Finviz).
Open 1–5m chart, enter Float Shares for the ticker.
Start with Balanced, flip to Safer on halty/SSR names or repeated VWAP reclaims.
Scale out into flushes; respect the stop and rotation guard.
Limitations & risk
Backtests on small-caps can be optimistic due to slippage, spreads, halts, SSR, and limited premarket data. Always use conservative sizing. Low-float stocks can squeeze violently.
Alerts
Parabolic UP (candidate short)
SHORT Armed (conditions met; entry at bar close)
Herman 8-9 am SweepFrom x.com
1. Sweep 8-9am high/low
2. After sweep - 82.66% back to 9am candle open (before 10am)
The rectangle only appears when the 9 a.m. candle closes.
The yellow line only appears if there is a sweep of the High or Low of the rectangle.
The green line only appears if, after the sweep, the price returns to the line before 10 a.m.
If the line is not displayed, there is no sweep before 10 am.
Credits to: @R_Herman_ on X (Twitter)
Thanks and good trading
Bias + VWAP Pullback — v4 (PA + BOS/CHOCH)Simple idea: I identify the trend (bias) from the larger timeframe, and only trade pullbacks to the VWAP/EMA during liquidity (London/New York). When the trend is clear, gold moves strongly, and its pullbacks to the balance lines provide clear opportunities.
Timeframe and Sessions (Cairo Time)
Analysis: H1 to determine the trend.
Implementation: 5m (or 1m if professional).
Trading window:
London Opening: 10:00–12:30
New York Opening: 16:30–19:00
(avoid the rest of the day unless there is exceptional traffic).
Direction determination (BIAS)
On H1:
If the price is above the 200 EMA and the daily VWAP is bullish and the price is above it → uptrend (long-only).
If the price is below the 200 EMA and the daily VWAP is bearish and the price is below it → bearish trend (short-only).
Determine your levels: yesterday's high/low (PDH/PDL) + approximate Asia range (03:00–09:30).
Entry Rules (Setup A: Trend Continuation)
Asia range breakout towards Bias during liquidity window.
Wait for a withdrawal to:
Daily VWAP, or
EMA50 on 5m frame (best if both cross).
Confirmation: Confirmation low/high on 5m (HL buy/LH sell) + clear impulse candle (Body is greater than average of last 10 candles).
Entry:
Buy: When the price returns above VWAP/EMA50 with a confirmation candle close.
Sell: The exact opposite.
Stop Loss (SL): Below/above the last confirmation low/high or ATR(14, 5m) x 1.5 (largest).
Objectives:
TP1 = 1R (Close 50% and move the rest Break-even).
TP2 = 2.5R to 3R or at an important HTF level (PDH/PDL/Bid/Demand Zone).
Entry Rules (Setup B: Reversion to VWAP – “Mean Reversion”)
Use with extreme caution, once daily maximum:
Price deviation from VWAP by more than ~1.5 x ATR(14, 5m) with rejection candles appearing near PDH/PDL.
Reverse entry towards the return of VWAP.
SL small behind rejection top/bottom.
Main target: VWAP. (Don't get greedy — this scenario is for extended periods only.)
News Filtering and Risk Management
Avoid trading 15–30 minutes before/after strong US news (CPI, NFP, FOMC).
Maximum daily loss: 1.5–2% of account balance.
Risk per trade: 0.25–0.5% (if you are learning) or 0.5–1% (if you are experienced).
Do not exceed two consecutive losing trades per day.
Don't chase the market after the opportunity has passed — wait for the next pullback.
Smart Deal Management
After TP1: Move stop to entry point + trail the rest with EMA20 on 5m or ATR Trailing = ATR(14)×1.0.
If the price touches a strong daily level (PDH/PDL) and fails to break, consider taking additional profit.
If VWAP starts to flatten and breaks against the trend on H1, stop trading for the day.
Quick Checklist (Before Entry)
H1 trend is clear and consistent with 200EMA + VWAP.
Penetrating the Asia range towards Bias.
Clean pull to VWAP/EMA50 on 5m.
Confirmation candle and real push.
SL is logical (behind swing/ATR×1.5) and R :R ≥ 1:2.
No red news coming soon.
Example of "ready-made" settings
EMA: 20, 50, 200 on 5m, 200 only on H1.
VWAP: Daily (reset daily).
ATR: 14 on 5m.
Levels: PDH/PDL + Asia Band (03:00–09:30 Cairo).
Gold Notes
Gold is fast and sharp at the open; don't get in early — wait for the draw.
Fakeouts are common before news: it is best to call with the trend after the price returns above/below VWAP.
Don't expect 80% consistent wins every day — the advantage comes from discipline, filtering out bad days, and only withdrawing when you're on the right track.
تعتبر شركة الماسة الألمانية أحد المؤسسات العاملة بالمملكة العربية السعودية ولها تاريخ طويل من الخدمات الكثيرة والمتنوعة التى مازالت تقدمها للكثير من العملاء داخل جميع مدن وأحياء المملكة حيث نقدم أفضل ما لدينا من خلال مجموعة الشركات التالية والتي من خلالها ستتلقي كل ما تحتاج إلية في كل المجال المختلفة فنحن نعمل منذ عام 2015 ولنا سابقات اعمال فى مختلف المجالات الحيوية التى نخدم من خلالها عملائنا ونوفر لهم أرخص الأسعار وبأعلى جودة من الممكن توفرها فى المجالات التالية :-
خدمات تنظيف المنازل والفلل والشقق
خدمات عزل الخزانات تنظيف غسيل صيانة اصلاح
خدمات جلي البلاط والرخام والسيراميك
خدمات نقل العفش عمالة فلبينية مدربة
خدمات مكافحة الحشرات بجدة
كل هذة الخدمات وأكثر نوفرها لكل المتعاقدين بأفضل الطرق مع توفير خطط وبرامج متنوعة لأتمام العمل المسنود إلينا بأفضل وأحدث الطرق الحديثة والعصرية سواء فى شركات النظافة بجدة ومكة المكرمة أو شركات نقل العفش بجدة عمالة فلبينية وباقى الخدمات مثل جلي وتلميع الرخام بمكة وجدة ولا ننسي شركة مكافحة حشرات بجدة التى ساعدت آلاف المواطنين على تنظيف منازلهم من الحشرات بأفضل مبيدات حشرية.
Triple-EMA Cloud (3× configurable EMAs + timeframe + fill)About This Script
Name: Triple-EMA Cloud (3× configurable EMAs + timeframe + fill)
What it does:
The script plots three Exponential Moving Averages (EMAs) on your chart.
You can set each EMA’s length (how many bars or days it averages over), source (for example, closing price, opening price, or the midpoint of high + low), and timeframe (you can have one EMA use daily data, another hourly data, etc.).
The indicator draws a “cloud” or channel by shading the area between the outermost two EMAs of the three. This lets you see a band or zone that the price is moving in, defined by those EMAs.
You also get full control over how each of the three EMA‐lines looks: color, thickness, transparency, and plot style (solid line, steps, circles, etc.).
How to Use It (for Beginners)
Here’s how a trader who’s new to charts can use this tool, especially when looking for pullbacks or undercut price action.
Key Concepts
Trend: Imagine the market price is generally going up or down. EMAs are a way to smooth out price movements so you can see the trend more clearly.
Pullback: When a price has been going up (an uptrend), sometimes it dips down a little before going up again. That dip is the pullback. It’s a chance to enter or add to a position at a “better price.”
Undercut: This is when price drops below an important level (for example an EMA) and then comes back up. It looks like it broke below, but then it recovers. That may show reverse pressure or strength building.
How the Script Helps With Pullbacks & Undercuts
Marking Trend Zones with the Cloud
The cloud between the outer EMA lines gives you a zone of expected support/resistance. If the price is above the cloud, that zone can act like a “floor” in uptrends; if it is below, the cloud might act like a “ceiling” in downtrends.
Watching Price vs the EMAs
If the price pulls back toward the cloud (or toward one of the EMAs) and then bounces back up, that’s a signal that the uptrend might continue.
If the price undercuts (goes a bit below) one of the EMAs or the cloud and then returns above it, that can also be a signal. It suggests that even though there was a temporary drop, buyers stepped in.
Using the Three EMAs for Confirmation
Because the script uses three EMAs, you can see how tightly or loosely they are spaced.
If all three EMAs are broadly aligned (for example, in an uptrend: shorter length above longer length, each pulling from reliable price source), that gives more confidence in trend strength.
If the middle EMA (or different source/timeframe) is holding up as support while others are above, it strengthens signal.
Entry & Exit Points
Entry: For example, after a pullback toward the cloud or “mid‐EMA”, wait for price to show a bounce up. That could be a better entry than buying at the top.
Stop Loss / Risk: You might place a stop loss just below the cloud or the lowest of your selected EMAs so that if price breaks through, the idea is invalidated.
Profit Target: Could be a recent high, resistance level, or a fixed reward-risk multiple (for example aiming to make twice what you risked).
Practical Steps for New Traders
Set up the EMAs
Choose simple lengths like 10, 21, 50.
For example, EMA #1 = length 10, source Close, timeframe “current chart”; EMA #2 = length 21, source (H+L)/2; EMA #3 = length 50, maybe timeframe daily.
Observe the Price Action
When price moves up, then dips, see if it comes back near the shaded cloud or one of the EMAs.
See if the dip touches the EMAs lightly (not a big drop) and then price starts climbing again.
Look for undercuts
If price briefly goes below a line (or below cloud) and then closes back above, that’s undercut + recovery. That bounce back is often meaningful.
Manage risk
Only put in money you can afford to lose.
Use small position size until you get comfortable.
Use stop-loss (as mentioned) in case the price doesn’t bounce as expected.
Practice
Put this indicator on charts (stocks you follow) in past time periods. See how price behaved with pullbacks / undercuts relative to the EMAs & cloud. This helps you learn to see signals.
What It Doesn’t Do (and What to Be Careful Of)
It doesn’t predict the future — it simply shows zones and trends. Price can still break down through the cloud.
In a “choppy” market (i.e. when price is going up and down without a clear trend), signals from EMAs / clouds are less reliable. You’ll get more “false bounces.”
Under / overshoots & big news events can break through clean levels, so always watch for confirmation (volume, price behavior) before putting big money in.
Hilly 3.0 Advanced Crypto Scalping Strategy - 1 & 5 Min ChartsHow to Use
Copy the Code: Copy the script above.
Paste in TradingView: Open TradingView, go to the Pine Editor (bottom of the chart), paste the code, and click “Add to Chart.”
Check for Errors: Verify no errors appear in the Pine Editor console. The script uses Pine Script v5 (@version=5).
Select Timeframe:
1-Minute Chart: Use defaults (emaFastLen=7, emaSlowLen=14, rsiLen=10, rsiOverbought=80, rsiOversold=20, slPerc=0.5, tpPerc=1.0, useCandlePatterns=false, patternLookback=10).
5-Minute Chart: Adjust to emaFastLen=9, emaSlowLen=21, rsiLen=14, rsiOverbought=75, rsiOversold=25, slPerc=0.8, tpPerc=1.5, useCandlePatterns=true, patternLookback=10.
Apply to Chart: Use a liquid crypto pair (e.g., BTC/USDT, ETH/USDT on Binance or Coinbase).
Verify Signals:
Green “BUY” or “EMA BUY” labels and triangle-up arrows below candles for bullish signals (EMA crossovers, bullish engulfing, hammer, doji, morning star, three white soldiers, double bottom).
Red “SELL” or “EMA SELL” labels and triangle-down arrows above candles for bearish signals (EMA crossovers, bearish engulfing, shooting star, doji, evening star, three black crows, double top).
Green/red background highlights for signal candles.
Backtest: Use TradingView’s Strategy Tester to evaluate performance over 1–3 months, checking Net Profit, Win Rate, and Drawdown.
Demo Test: Run on a demo account to confirm signal visibility and performance before trading with real funds.
Key Levels: Daily, Weekly, Monthly [BackQuant]Key Levels: Daily, Weekly, Monthly
Map the market’s “memory” in one glance—yesterday’s range, this week’s chosen day high/low, and D/W/M opens—then auto-clean levels once they break.
What it does
This tool plots three families of high-signal reference lines and keeps them tidy as price evolves:
Chosen Day High/Low (per week) — Pick a weekday (e.g., Monday). For each past week, the script records that day’s session high and low and projects them forward for a configurable number of bars. These act like “memory levels” that price often revisits.
Daily / Weekly / Monthly Opens — Plots the opening price of each new day, week, and month with separate styling. These opens frequently behave like magnets/flip lines intraday and anchors for regime on higher timeframes.
Auto-pruning — When price breaks a stored level, the script can automatically remove it to reduce clutter and refocus you on still-active lines. See: (broken levels removed).
Why these levels matter
Liquidity pockets — Prior day’s high/low and the daily open concentrate stops and pending orders. Mapping them quickly reveals likely sweep or fade zones. Example: previous day highs + daily open highlighting liquidity:
Context & regime — Monthly opens frame macro bias; trading above a rising cluster of monthly opens vs. below gives a clean top-down read. Example: monthly-only “macro outlook” view:
Cleaner charts — Auto-remove broken lines so you focus on what still matters right now.
What it plots (at a glance)
Past Chosen Day High/Low for up to N prior weeks (your choice), extended right.
Current Daily Open , Weekly Open , and Monthly Open , each with its own color, label, and forward extension.
Optional short labels (e.g., “Mon High”) or full labels (with week/month info).
How breaks are detected & cleaned
You control both the evidence and the timing of a “break”:
Break uses — Choose Close (more conservative) or Wick (more sensitive).
Inclusive? — If enabled, equality counts (≥ high or ≤ low). If disabled, you need a strict cross.
Allow intraday breaks? — If on, a level can break during the tracked day; if off, the script only counts breaks after the session completes.
Remove Broken Levels — When a break is confirmed, the line/label is deleted automatically. (See the demo: )
Quick start
Pick a Day of Week to Track (e.g., Monday).
Set how many weeks back to show (e.g., 8–10).
Choose how far to extend each family (bars to the right for chosen-day H/L and D/W/M opens).
Decide if a break uses Close or Wick , and whether equality counts.
Toggle Remove Broken Levels to keep the chart clean automatically.
Tips by use-case
Intraday bias — Watch the Daily Open as a magnet/flip. If price gaps above and holds, pullbacks to the daily open often decide direction. Pair with last day’s high/low for sweep→reversal or true breakout cues. See:
Weekly structure — Track the week’s chosen day (e.g., Monday) high/low across prior weeks. If price stalls near a cluster of old “Monday Highs,” look for sweep/reject patterns or continuation on reclaim.
Macro regime — Hide daily/weekly lines and keep only Monthly Opens to read bigger cycles at a glance (BTC/crypto especially). Example:
Customization
Use wicks or bodies for highs/lows (wicks capture extremes; bodies are stricter).
Line style & thickness — solid/dashed/dotted, width 1–5, plus global transparency.
Labels — Abbreviated (“Mon High”, “D Open”) or full (month/week/day info).
Color scheme — Separate colors for highs, lows, and each of D/W/M opens.
Capacity controls — Set how many daily/weekly/monthly opens and how many weeks of chosen-day H/L to keep visible.
What’s under the hood
On your selected weekday, the script records that session’s true high and true low (using wicks or body-based extremes—your choice), then projects a horizontal line forward for the next bars.
At each new day/week/month , it records the opening price and projects that line forward as well.
Each bar, the script checks your “break” rules; once broken, lines/labels are removed if auto-cleaning is on.
Everything updates in real time; past levels don’t repaint after the session finishes.
Recommended presets
Day trading — Weeks back: 6–10; extend D/W opens: 50–100 bars; Break uses: Close ; Inclusive: off; Auto-remove: on.
Swing — Fewer daily opens, more weekly opens (2–6), and 8–12 weeks of chosen-day H/L.
Macro — Show only Monthly Opens (1–6 months), dashed style, thicker lines for clarity.
Reading the examples
Broken lines disappear — decluttering in action:
Macro outlook — monthly opens as cycle rails:
Liquidity map — previous day highs + daily open:
Final note
These are not “signals”—they’re reference points that many participants watch. By standardising how you draw them and automatically clearing the ones that no longer matter, you turn a noisy chart into a focused map: where liquidity likely sits, where price memory lives, and which lines are still in play.