Garrys Pair DifferenceFirst pair should be futures, second pair is spot
Plots extents and when the extents have a higher high or lower low it plots a circle
Candlestick analysis
ST+SQZMOM v.3// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © syahdan modifying LazyBear script and many sources
//======================================================================================================================
//@version=6
indicator('ST+SQZMOM v.3', overlay = true, max_lines_count = 40)
import TradingView/ta/9
//======================================================================================================================
//groups
Alerts = 'alert'
Supertrend = 'supertrend'
SqzMom = 'sqzMom'
Sma = 'ma'
TS = 'tp/sl'
// Input switches for alerts
alertTrendChange = input.bool(true, title='Enable Trend Change Alert', group = Alerts)
alertSQZMOM = input.bool(true, title='Enable SQZMOM Alerts', group = Alerts)
// Supertrend Inputs
atrPeriod = input.int(10, 'ATR Length', minval = 1, group = Supertrend)
factor = input.float(2.5, 'Factor', minval = 0.01, step = 0.01, group = Supertrend)
// Squeeze Momentum Indicator Inputs
sources = input(close, 'Source', group = SqzMom)
bbLength = input.int(20, 'Bollinger Bands Length', minval = 1, group = SqzMom)
bbMult = input.float(2, 'Bollinger Bands MultFactor', step = 0.25, group = SqzMom)
kcLength = input(20, 'Keltner\'s Channel Length', group = SqzMom)
kcMult = input.float(1.5, 'Keltner\'s Channel MultFactor', step = 0.25, group = SqzMom)
useTrueRange = input(true, 'Use TrueRange (Keltner\'s Channel)', group = SqzMom)
addSignal = input.bool(false, title = 'add Signal to Calculate direction', group = SqzMom)
signalLength = input(5, 'Signal Length', group = SqzMom)
tooltip_sqz = 'show momentum direction, BB band and KC band'
showBB = input.bool(false, 'show BBand', tooltip = tooltip_sqz, group = SqzMom)
showKC = input.bool(false, 'show keltner channel', tooltip = tooltip_sqz, group = SqzMom)
showDir= input.bool(false, 'show squeeze direction', tooltip = tooltip_sqz, group = SqzMom)
// Customizable thresholds
lowerThreshold = input(-1.0, title = 'Lower Threshold', group = SqzMom)
upperThreshold = input(1.0, title = 'Upper Threshold', group = SqzMom)
// SMA Input settings
lengthMA = input(200, title="MA Period", group = Sma)
showMA = input.bool(true, title="Show MA", group = Sma)
addsave = input.bool(true, title = 'add MA as filter', group = Alerts)
// Hardcoded tp + sl multipliers
targetMultiplier1 = input.int(1, 'TP1 multiply', minval = 1, group = TS)
targetMultiplier2 = input.int(2, 'TP2 multiply', minval = 2, group = TS)
targetMultiplier3 = input.int(3, 'TP3 multiply', minval = 3, group = TS)
stopLossMultiplier = input.int(3, 'SL multiply', minval = 3, group = TS)
//======================================================================================================================
// Calculate Supertrend
= ta.supertrend(factor, atrPeriod)
// Plot the Supertrend line
plot(supertrend, color = direction < 0 ? color.green : color.red, title = 'ST', style = plot.style_stepline_diamond)
// Determine if the trend is up or down
upTrend = direction < 0
downTrend = direction > 0
// Track previous trend state
var int previousDirection = na
previousDirection := upTrend ? 1 : -1
// Calculate ATR for targets and stop loss
atrValue = ta.atr(atrPeriod)
// Initialize target and stop loss levels
var float entryPrice = na
var float targetLevel1 = na
var float targetLevel2 = na
var float targetLevel3 = na
var float stopLossLevel = na
// Initialize counters for lines and labels
var int count_up = 0
var int count_down = 0
// Initialize a new variable to track if new lines and labels are drawn
var bool newLinesDrawn = false
// Calculate BB
basis = ta.sma(sources, bbLength)
dev = bbMult * ta.stdev(sources, bbLength)
bbUpper = basis + dev
bbLower = basis - dev
// Calculate KC
ma = ta.sma(sources, kcLength)
trRange = useTrueRange ? ta.tr : high - low
rangema = ta.sma(trRange, kcLength)
kcUpper = ma + rangema * kcMult
kcLower = ma - rangema * kcMult
sqzOn = bbLower > kcLower and bbUpper < kcUpper
sqzOff = bbLower < kcLower and bbUpper > kcUpper
noSqz = sqzOn == false and sqzOff == false
val = ta.linreg(sources - math.avg(math.avg(ta.highest(high, kcLength), ta.lowest(low, kcLength)), ta.sma(sources, kcLength)), kcLength, 0)
signal = ta.sma(val, signalLength)
dir = not addSignal ? val : val - signal
// Calculate SMA
MA = ta.sma(sources,lengthMA)
saveEntryBuy = addsave ? MA < close : false
saveEntrySell = addsave ? MA > close : false
//======================================================================================================================
// Plot SMA
plot(showMA ? MA : na, color=color.white, linewidth=2, title='MA')
triangUp = sqzOff and dir > dir and dir >= upperThreshold
triangDown = sqzOff and dir < dir and dir <= lowerThreshold
triangUpR = sqzOff and dir < dir and dir >= upperThreshold
triangDownR = sqzOff and dir > dir and dir <= lowerThreshold
insideThreshold = sqzOff and upperThreshold > dir and dir > lowerThreshold
// Calculate target and stop loss levels
if upTrend and triangUp
entryPrice := close
targetLevel1 := close + atrValue * targetMultiplier1
targetLevel2 := close + atrValue * targetMultiplier2
targetLevel3 := close + atrValue * targetMultiplier3
stopLossLevel := close - atrValue * stopLossMultiplier
count_up := count_up + 1
count_down := 0
else if downTrend and triangDown
entryPrice := close
targetLevel1 := close - atrValue * targetMultiplier1
targetLevel2 := close - atrValue * targetMultiplier2
targetLevel3 := close - atrValue * targetMultiplier3
stopLossLevel := close + atrValue * stopLossMultiplier
count_down := count_down + 1
count_up := 0
// Plotting Squeeze Momentum Indicator
plotshape(sqzOn or noSqz, 'In Squeeze', shape.square, location.top, color=sqzOn or noSqz ? color.new(color.orange, 0) : color.new(color.white, 0))
plotshape(triangUp or triangUpR, 'Squeeze Release UpTrend', shape.triangleup, location.top, color=triangUp ? color.new(color.green, 0) : color.new(color.yellow, 0))
plotshape(triangDown or triangDownR, 'Squeeze Release DownTrend', shape.triangledown, location.top, color=triangDown ? color.new(color.red, 0) : color.new(color.yellow, 0))
plotshape(insideThreshold, 'inside threshold', shape.diamond, location.top, color.new(color.white, 0) )
// Draw lines and labels for targets and stop loss
var line stopLossLine = na
var line entryLine = na
var line targetLine1 = na
var line targetLine2 = na
var line targetLine3 = na
var label stopLossLabel = na
var label entryLabel = na
var label targetLabel1 = na
var label targetLabel2 = na
var label targetLabel3 = na
// Clear previous lines and labels if a new trend is confirmed
if upTrend and triangUp and count_up == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntryBuy
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntryBuy
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index +10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if downTrend and triangDown and count_down == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntrySell
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntrySell
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index + 10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
// Plot momentum strength/direction
plotarrow(showDir ? dir : na, 'Momentum Strength/Direction', color.new(color.aqua, 50), color.new(color.orange, 50), show_last = 500)
plot(showBB ? bbUpper : na, 'BBUpper', color.new(color.blue, 25), show_last = 500)
plot(showBB ? bbLower : na, 'BBLower', color.new(color.blue, 25), show_last = 500)
plot(showKC ? kcUpper : na, 'KCUpper', color.new(color.red, 25), show_last = 500)
plot(showKC ? kcLower : na, 'KCLower', color.new(color.red, 25), show_last = 500)
//======================================================================================================================
// Trigger alert when squeeze is released
if sqzOn and not sqzOn
alert('Squeeze On : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if sqzOff and not sqzOff // Only trigger alert if the squeeze was previously on
alert('Squeeze Off : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDown and not triangDown // Only trigger alert if the squeeze was previously on
alert('Weak TrendDown or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUp and not triangUp // Only trigger alert if the squeeze was previously on
alert('Weak TrendUp or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if insideThreshold and not insideThreshold //trigger when entering threshold channel
alert('inside threshold : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUpR and triangUp
alert('Trend Up Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDownR and triangDown
alert('Trend Down Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
// Alert for trend change when new lines and labels are drawn
if newLinesDrawn
saveEntry = addsave ? 'safe' : 'adrenaline'
trendType = upTrend ? 'Buy' : 'Sell'
stopLossValue = str.tostring(stopLossLevel, '#.###')
entryValue = str.tostring(close, '#.###')
targetValue1 = str.tostring(targetLevel1, '#.###')
targetValue2 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel2, '#.###') : '---'
targetValue3 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel3, '#.###') : '---'
alertMessage = 'Mode : '+ saveEntry +' ' +
'Pair : ' + syminfo.tickerid + ' | ' + timeframe.period + ' ' +
'Trend : ' + trendType + ' ' +
'SL : ' + stopLossValue + ' ' +
'Ent : ' + entryValue + ' ' +
'TP1 : ' + targetValue1 + ' ' +
'TP2 : ' + targetValue2 + ' ' +
'TP3 : ' + targetValue3
if alertTrendChange
alert(alertMessage, alert.freq_once_per_bar_close)
// Reset the newLinesDrawn flag
newLinesDrawn := false
ST+SQZMOM v.3// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © syahdan modifying LazyBear script and many sources
//======================================================================================================================
//@version=6
indicator('ST+SQZMOM v.3', overlay = true, max_lines_count = 40)
import TradingView/ta/9
//======================================================================================================================
//groups
Alerts = 'alert'
Supertrend = 'supertrend'
SqzMom = 'sqzMom'
Sma = 'ma'
TS = 'tp/sl'
// Input switches for alerts
alertTrendChange = input.bool(true, title='Enable Trend Change Alert', group = Alerts)
alertSQZMOM = input.bool(true, title='Enable SQZMOM Alerts', group = Alerts)
// Supertrend Inputs
atrPeriod = input.int(10, 'ATR Length', minval = 1, group = Supertrend)
factor = input.float(2.5, 'Factor', minval = 0.01, step = 0.01, group = Supertrend)
// Squeeze Momentum Indicator Inputs
sources = input(close, 'Source', group = SqzMom)
bbLength = input.int(20, 'Bollinger Bands Length', minval = 1, group = SqzMom)
bbMult = input.float(2, 'Bollinger Bands MultFactor', step = 0.25, group = SqzMom)
kcLength = input(20, 'Keltner\'s Channel Length', group = SqzMom)
kcMult = input.float(1.5, 'Keltner\'s Channel MultFactor', step = 0.25, group = SqzMom)
useTrueRange = input(true, 'Use TrueRange (Keltner\'s Channel)', group = SqzMom)
addSignal = input.bool(false, title = 'add Signal to Calculate direction', group = SqzMom)
signalLength = input(5, 'Signal Length', group = SqzMom)
tooltip_sqz = 'show momentum direction, BB band and KC band'
showBB = input.bool(false, 'show BBand', tooltip = tooltip_sqz, group = SqzMom)
showKC = input.bool(false, 'show keltner channel', tooltip = tooltip_sqz, group = SqzMom)
showDir= input.bool(false, 'show squeeze direction', tooltip = tooltip_sqz, group = SqzMom)
// Customizable thresholds
lowerThreshold = input(-1.0, title = 'Lower Threshold', group = SqzMom)
upperThreshold = input(1.0, title = 'Upper Threshold', group = SqzMom)
// SMA Input settings
lengthMA = input(200, title="MA Period", group = Sma)
showMA = input.bool(true, title="Show MA", group = Sma)
addsave = input.bool(true, title = 'add MA as filter', group = Alerts)
// Hardcoded tp + sl multipliers
targetMultiplier1 = input.int(1, 'TP1 multiply', minval = 1, group = TS)
targetMultiplier2 = input.int(2, 'TP2 multiply', minval = 2, group = TS)
targetMultiplier3 = input.int(3, 'TP3 multiply', minval = 3, group = TS)
stopLossMultiplier = input.int(3, 'SL multiply', minval = 3, group = TS)
//======================================================================================================================
// Calculate Supertrend
= ta.supertrend(factor, atrPeriod)
// Plot the Supertrend line
plot(supertrend, color = direction < 0 ? color.green : color.red, title = 'ST', style = plot.style_stepline_diamond)
// Determine if the trend is up or down
upTrend = direction < 0
downTrend = direction > 0
// Track previous trend state
var int previousDirection = na
previousDirection := upTrend ? 1 : -1
// Calculate ATR for targets and stop loss
atrValue = ta.atr(atrPeriod)
// Initialize target and stop loss levels
var float entryPrice = na
var float targetLevel1 = na
var float targetLevel2 = na
var float targetLevel3 = na
var float stopLossLevel = na
// Initialize counters for lines and labels
var int count_up = 0
var int count_down = 0
// Initialize a new variable to track if new lines and labels are drawn
var bool newLinesDrawn = false
// Calculate BB
basis = ta.sma(sources, bbLength)
dev = bbMult * ta.stdev(sources, bbLength)
bbUpper = basis + dev
bbLower = basis - dev
// Calculate KC
ma = ta.sma(sources, kcLength)
trRange = useTrueRange ? ta.tr : high - low
rangema = ta.sma(trRange, kcLength)
kcUpper = ma + rangema * kcMult
kcLower = ma - rangema * kcMult
sqzOn = bbLower > kcLower and bbUpper < kcUpper
sqzOff = bbLower < kcLower and bbUpper > kcUpper
noSqz = sqzOn == false and sqzOff == false
val = ta.linreg(sources - math.avg(math.avg(ta.highest(high, kcLength), ta.lowest(low, kcLength)), ta.sma(sources, kcLength)), kcLength, 0)
signal = ta.sma(val, signalLength)
dir = not addSignal ? val : val - signal
// Calculate SMA
MA = ta.sma(sources,lengthMA)
saveEntryBuy = addsave ? MA < close : false
saveEntrySell = addsave ? MA > close : false
//======================================================================================================================
// Plot SMA
plot(showMA ? MA : na, color=color.white, linewidth=2, title='MA')
triangUp = sqzOff and dir > dir and dir >= upperThreshold
triangDown = sqzOff and dir < dir and dir <= lowerThreshold
triangUpR = sqzOff and dir < dir and dir >= upperThreshold
triangDownR = sqzOff and dir > dir and dir <= lowerThreshold
insideThreshold = sqzOff and upperThreshold > dir and dir > lowerThreshold
// Calculate target and stop loss levels
if upTrend and triangUp
entryPrice := close
targetLevel1 := close + atrValue * targetMultiplier1
targetLevel2 := close + atrValue * targetMultiplier2
targetLevel3 := close + atrValue * targetMultiplier3
stopLossLevel := close - atrValue * stopLossMultiplier
count_up := count_up + 1
count_down := 0
else if downTrend and triangDown
entryPrice := close
targetLevel1 := close - atrValue * targetMultiplier1
targetLevel2 := close - atrValue * targetMultiplier2
targetLevel3 := close - atrValue * targetMultiplier3
stopLossLevel := close + atrValue * stopLossMultiplier
count_down := count_down + 1
count_up := 0
// Plotting Squeeze Momentum Indicator
plotshape(sqzOn or noSqz, 'In Squeeze', shape.square, location.top, color=sqzOn or noSqz ? color.new(color.orange, 0) : color.new(color.white, 0))
plotshape(triangUp or triangUpR, 'Squeeze Release UpTrend', shape.triangleup, location.top, color=triangUp ? color.new(color.green, 0) : color.new(color.yellow, 0))
plotshape(triangDown or triangDownR, 'Squeeze Release DownTrend', shape.triangledown, location.top, color=triangDown ? color.new(color.red, 0) : color.new(color.yellow, 0))
plotshape(insideThreshold, 'inside threshold', shape.diamond, location.top, color.new(color.white, 0) )
// Draw lines and labels for targets and stop loss
var line stopLossLine = na
var line entryLine = na
var line targetLine1 = na
var line targetLine2 = na
var line targetLine3 = na
var label stopLossLabel = na
var label entryLabel = na
var label targetLabel1 = na
var label targetLabel2 = na
var label targetLabel3 = na
// Clear previous lines and labels if a new trend is confirmed
if upTrend and triangUp and count_up == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntryBuy
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntryBuy
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index +10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if downTrend and triangDown and count_down == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntrySell
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntrySell
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index + 10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
// Plot momentum strength/direction
plotarrow(showDir ? dir : na, 'Momentum Strength/Direction', color.new(color.aqua, 50), color.new(color.orange, 50), show_last = 500)
plot(showBB ? bbUpper : na, 'BBUpper', color.new(color.blue, 25), show_last = 500)
plot(showBB ? bbLower : na, 'BBLower', color.new(color.blue, 25), show_last = 500)
plot(showKC ? kcUpper : na, 'KCUpper', color.new(color.red, 25), show_last = 500)
plot(showKC ? kcLower : na, 'KCLower', color.new(color.red, 25), show_last = 500)
//======================================================================================================================
// Trigger alert when squeeze is released
if sqzOn and not sqzOn
alert('Squeeze On : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if sqzOff and not sqzOff // Only trigger alert if the squeeze was previously on
alert('Squeeze Off : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDown and not triangDown // Only trigger alert if the squeeze was previously on
alert('Weak TrendDown or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUp and not triangUp // Only trigger alert if the squeeze was previously on
alert('Weak TrendUp or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if insideThreshold and not insideThreshold //trigger when entering threshold channel
alert('inside threshold : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUpR and triangUp
alert('Trend Up Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDownR and triangDown
alert('Trend Down Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
// Alert for trend change when new lines and labels are drawn
if newLinesDrawn
saveEntry = addsave ? 'safe' : 'adrenaline'
trendType = upTrend ? 'Buy' : 'Sell'
stopLossValue = str.tostring(stopLossLevel, '#.###')
entryValue = str.tostring(close, '#.###')
targetValue1 = str.tostring(targetLevel1, '#.###')
targetValue2 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel2, '#.###') : '---'
targetValue3 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel3, '#.###') : '---'
alertMessage = 'Mode : '+ saveEntry +' ' +
'Pair : ' + syminfo.tickerid + ' | ' + timeframe.period + ' ' +
'Trend : ' + trendType + ' ' +
'SL : ' + stopLossValue + ' ' +
'Ent : ' + entryValue + ' ' +
'TP1 : ' + targetValue1 + ' ' +
'TP2 : ' + targetValue2 + ' ' +
'TP3 : ' + targetValue3
if alertTrendChange
alert(alertMessage, alert.freq_once_per_bar_close)
// Reset the newLinesDrawn flag
newLinesDrawn := false
ST+SQZMOM v.3// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © syahdan modifying LazyBear script and many sources
//======================================================================================================================
//@version=6
indicator('ST+SQZMOM v.3', overlay = true, max_lines_count = 40)
import TradingView/ta/9
//======================================================================================================================
//groups
Alerts = 'alert'
Supertrend = 'supertrend'
SqzMom = 'sqzMom'
Sma = 'ma'
TS = 'tp/sl'
// Input switches for alerts
alertTrendChange = input.bool(true, title='Enable Trend Change Alert', group = Alerts)
alertSQZMOM = input.bool(true, title='Enable SQZMOM Alerts', group = Alerts)
// Supertrend Inputs
atrPeriod = input.int(10, 'ATR Length', minval = 1, group = Supertrend)
factor = input.float(2.5, 'Factor', minval = 0.01, step = 0.01, group = Supertrend)
// Squeeze Momentum Indicator Inputs
sources = input(close, 'Source', group = SqzMom)
bbLength = input.int(20, 'Bollinger Bands Length', minval = 1, group = SqzMom)
bbMult = input.float(2, 'Bollinger Bands MultFactor', step = 0.25, group = SqzMom)
kcLength = input(20, 'Keltner\'s Channel Length', group = SqzMom)
kcMult = input.float(1.5, 'Keltner\'s Channel MultFactor', step = 0.25, group = SqzMom)
useTrueRange = input(true, 'Use TrueRange (Keltner\'s Channel)', group = SqzMom)
addSignal = input.bool(false, title = 'add Signal to Calculate direction', group = SqzMom)
signalLength = input(5, 'Signal Length', group = SqzMom)
tooltip_sqz = 'show momentum direction, BB band and KC band'
showBB = input.bool(false, 'show BBand', tooltip = tooltip_sqz, group = SqzMom)
showKC = input.bool(false, 'show keltner channel', tooltip = tooltip_sqz, group = SqzMom)
showDir= input.bool(false, 'show squeeze direction', tooltip = tooltip_sqz, group = SqzMom)
// Customizable thresholds
lowerThreshold = input(-1.0, title = 'Lower Threshold', group = SqzMom)
upperThreshold = input(1.0, title = 'Upper Threshold', group = SqzMom)
// SMA Input settings
lengthMA = input(200, title="MA Period", group = Sma)
showMA = input.bool(true, title="Show MA", group = Sma)
addsave = input.bool(true, title = 'add MA as filter', group = Alerts)
// Hardcoded tp + sl multipliers
targetMultiplier1 = input.int(1, 'TP1 multiply', minval = 1, group = TS)
targetMultiplier2 = input.int(2, 'TP2 multiply', minval = 2, group = TS)
targetMultiplier3 = input.int(3, 'TP3 multiply', minval = 3, group = TS)
stopLossMultiplier = input.int(3, 'SL multiply', minval = 3, group = TS)
//======================================================================================================================
// Calculate Supertrend
= ta.supertrend(factor, atrPeriod)
// Plot the Supertrend line
plot(supertrend, color = direction < 0 ? color.green : color.red, title = 'ST', style = plot.style_stepline_diamond)
// Determine if the trend is up or down
upTrend = direction < 0
downTrend = direction > 0
// Track previous trend state
var int previousDirection = na
previousDirection := upTrend ? 1 : -1
// Calculate ATR for targets and stop loss
atrValue = ta.atr(atrPeriod)
// Initialize target and stop loss levels
var float entryPrice = na
var float targetLevel1 = na
var float targetLevel2 = na
var float targetLevel3 = na
var float stopLossLevel = na
// Initialize counters for lines and labels
var int count_up = 0
var int count_down = 0
// Initialize a new variable to track if new lines and labels are drawn
var bool newLinesDrawn = false
// Calculate BB
basis = ta.sma(sources, bbLength)
dev = bbMult * ta.stdev(sources, bbLength)
bbUpper = basis + dev
bbLower = basis - dev
// Calculate KC
ma = ta.sma(sources, kcLength)
trRange = useTrueRange ? ta.tr : high - low
rangema = ta.sma(trRange, kcLength)
kcUpper = ma + rangema * kcMult
kcLower = ma - rangema * kcMult
sqzOn = bbLower > kcLower and bbUpper < kcUpper
sqzOff = bbLower < kcLower and bbUpper > kcUpper
noSqz = sqzOn == false and sqzOff == false
val = ta.linreg(sources - math.avg(math.avg(ta.highest(high, kcLength), ta.lowest(low, kcLength)), ta.sma(sources, kcLength)), kcLength, 0)
signal = ta.sma(val, signalLength)
dir = not addSignal ? val : val - signal
// Calculate SMA
MA = ta.sma(sources,lengthMA)
saveEntryBuy = addsave ? MA < close : false
saveEntrySell = addsave ? MA > close : false
//======================================================================================================================
// Plot SMA
plot(showMA ? MA : na, color=color.white, linewidth=2, title='MA')
triangUp = sqzOff and dir > dir and dir >= upperThreshold
triangDown = sqzOff and dir < dir and dir <= lowerThreshold
triangUpR = sqzOff and dir < dir and dir >= upperThreshold
triangDownR = sqzOff and dir > dir and dir <= lowerThreshold
insideThreshold = sqzOff and upperThreshold > dir and dir > lowerThreshold
// Calculate target and stop loss levels
if upTrend and triangUp
entryPrice := close
targetLevel1 := close + atrValue * targetMultiplier1
targetLevel2 := close + atrValue * targetMultiplier2
targetLevel3 := close + atrValue * targetMultiplier3
stopLossLevel := close - atrValue * stopLossMultiplier
count_up := count_up + 1
count_down := 0
else if downTrend and triangDown
entryPrice := close
targetLevel1 := close - atrValue * targetMultiplier1
targetLevel2 := close - atrValue * targetMultiplier2
targetLevel3 := close - atrValue * targetMultiplier3
stopLossLevel := close + atrValue * stopLossMultiplier
count_down := count_down + 1
count_up := 0
// Plotting Squeeze Momentum Indicator
plotshape(sqzOn or noSqz, 'In Squeeze', shape.square, location.top, color=sqzOn or noSqz ? color.new(color.orange, 0) : color.new(color.white, 0))
plotshape(triangUp or triangUpR, 'Squeeze Release UpTrend', shape.triangleup, location.top, color=triangUp ? color.new(color.green, 0) : color.new(color.yellow, 0))
plotshape(triangDown or triangDownR, 'Squeeze Release DownTrend', shape.triangledown, location.top, color=triangDown ? color.new(color.red, 0) : color.new(color.yellow, 0))
plotshape(insideThreshold, 'inside threshold', shape.diamond, location.top, color.new(color.white, 0) )
// Draw lines and labels for targets and stop loss
var line stopLossLine = na
var line entryLine = na
var line targetLine1 = na
var line targetLine2 = na
var line targetLine3 = na
var label stopLossLabel = na
var label entryLabel = na
var label targetLabel1 = na
var label targetLabel2 = na
var label targetLabel3 = na
// Clear previous lines and labels if a new trend is confirmed
if upTrend and triangUp and count_up == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntryBuy
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntryBuy
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index +10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if downTrend and triangDown and count_down == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntrySell
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntrySell
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index + 10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
// Plot momentum strength/direction
plotarrow(showDir ? dir : na, 'Momentum Strength/Direction', color.new(color.aqua, 50), color.new(color.orange, 50), show_last = 500)
plot(showBB ? bbUpper : na, 'BBUpper', color.new(color.blue, 25), show_last = 500)
plot(showBB ? bbLower : na, 'BBLower', color.new(color.blue, 25), show_last = 500)
plot(showKC ? kcUpper : na, 'KCUpper', color.new(color.red, 25), show_last = 500)
plot(showKC ? kcLower : na, 'KCLower', color.new(color.red, 25), show_last = 500)
//======================================================================================================================
// Trigger alert when squeeze is released
if sqzOn and not sqzOn
alert('Squeeze On : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if sqzOff and not sqzOff // Only trigger alert if the squeeze was previously on
alert('Squeeze Off : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDown and not triangDown // Only trigger alert if the squeeze was previously on
alert('Weak TrendDown or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUp and not triangUp // Only trigger alert if the squeeze was previously on
alert('Weak TrendUp or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if insideThreshold and not insideThreshold //trigger when entering threshold channel
alert('inside threshold : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUpR and triangUp
alert('Trend Up Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDownR and triangDown
alert('Trend Down Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
// Alert for trend change when new lines and labels are drawn
if newLinesDrawn
saveEntry = addsave ? 'safe' : 'adrenaline'
trendType = upTrend ? 'Buy' : 'Sell'
stopLossValue = str.tostring(stopLossLevel, '#.###')
entryValue = str.tostring(close, '#.###')
targetValue1 = str.tostring(targetLevel1, '#.###')
targetValue2 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel2, '#.###') : '---'
targetValue3 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel3, '#.###') : '---'
alertMessage = 'Mode : '+ saveEntry +' ' +
'Pair : ' + syminfo.tickerid + ' | ' + timeframe.period + ' ' +
'Trend : ' + trendType + ' ' +
'SL : ' + stopLossValue + ' ' +
'Ent : ' + entryValue + ' ' +
'TP1 : ' + targetValue1 + ' ' +
'TP2 : ' + targetValue2 + ' ' +
'TP3 : ' + targetValue3
if alertTrendChange
alert(alertMessage, alert.freq_once_per_bar_close)
// Reset the newLinesDrawn flag
newLinesDrawn := false
Volume Change Color with Marker (9x volume)Mark candle blue + mark if volume is 9x bigger than previous candle.
Benzer Mumlar Bulucu (4 Saatlik)//@version=5
indicator("Benzer Mumlar Bulucu (4 Saatlik)", overlay=true)
// Mum özellikleri
body_size = math.abs(close - open) // Mumun gövde büyüklüğü
upper_wick = high - math.max(close, open) // Üst fitil uzunluğu
lower_wick = math.min(close, open) - low // Alt fitil uzunluğu
candle_range = high - low // Mumun toplam uzunluğu
// Benzerlik eşiği (kendi kriterlerinize göre değiştirebilirsiniz)
body_threshold = 0.2 // Gövde uzunluğunun toplam mum aralığına oranı (örneğin %20)
wick_threshold = 0.1 // Fitil uzunluğunun toplam mum aralığına oranı (örneğin %10)
// Benzer mum tespiti
is_similar = (body_size <= (candle_range * body_threshold)) and
(upper_wick <= (candle_range * wick_threshold)) and
(lower_wick <= (candle_range * wick_threshold))
// Grafikte işaretleme
plotshape(is_similar, style=shape.triangleup, location=location.abovebar, color=color.green, size=size.small, title="Benzer Mum")
RSI Overlay dengan Candlestickgdytcrtctvcguiycdzestgihoigytfxedxtyguihgyutxrtsdrdf7gfrts5tt8fdrrdyguicrd5e67yt79xdrsdrtfyucrtdi6to6yrt6ydfotdtdtdtyt
13 EMA Cross - Next Day High/Low//@version=6
indicator("13 EMA Cross - Next Day High/Low", overlay=true)
// Inputs for EMAs
length1 = input.int(13, title="Short EMA (13 EMA)")
length2 = input.int(34, title="Long EMA (34 EMA)")
// Input for support line properties
supportColor = input.color(#A52A2A, title="Support Line Color") // Brown color
lineWidth = input.int(2, title="Line Width")
// Calculate EMAs
ema13 = ta.ema(close, length1)
ema34 = ta.ema(close, length2)
// Detect Crosses
crossAbove = ta.crossover(ema13, ema34)
crossBelow = ta.crossunder(ema13, ema34)
// Track when a crossover happens
var float nextDayHigh = na
var float nextDayLow = na
var int crossoverBarIndex = na
if crossAbove or crossBelow
crossoverBarIndex := bar_index
nextDayHigh := na
nextDayLow := na
// Capture next day candle's high and low after crossover
if bar_index == crossoverBarIndex + 1
nextDayHigh := high
nextDayLow := low
// Draw horizontal lines at the next day's high and low
if not na(nextDayHigh) and not na(nextDayLow)
line.new(x1=crossoverBarIndex + 1, y1=nextDayHigh, x2=bar_index, y2=nextDayHigh, color=supportColor, width=lineWidth)
line.new(x1=crossoverBarIndex + 1, y1=nextDayLow, x2=bar_index, y2=nextDayLow, color=supportColor, width=lineWidth)
13 EMA Cross - Daily Supportwhen 13 ema cross 34 ema mark next day candle high and low. when high breaks wait for retest when retest happens after breakout go for 1:2 ratio
Information Entropy - Reversal PointsDirectionless entry points based off entropy. The idea is that when the market reaches a level of measurable chaos that far exceeds the norm, that should theoretically be the point where the market is most likely going to pick a direction as it strives to reduce its randomness
RSI 10 mã thể hiện 4 khung thời gian//@version=6
indicator("Multi-Timeframe RSI with Divergence Alerts in Table", overlay=true)
// Inputs
rsiLength = input.int(14, title="RSI Length")
source = input.source(close, title="Source")
// Inputs for custom symbols (10 pairs)
symbol1 = input.string("BTC/USDT", title="Symbol 1")
symbol2 = input.string("ETH/USDT", title="Symbol 2")
symbol3 = input.string("LTC/USDT", title="Symbol 3")
symbol4 = input.string("XRP/USDT", title="Symbol 4")
symbol5 = input.string("ADA/USDT", title="Symbol 5")
symbol6 = input.string("SOL/USDT", title="Symbol 6")
symbol7 = input.string("DOGE/USDT", title="Symbol 7")
symbol8 = input.string("MATIC/USDT", title="Symbol 8")
symbol9 = input.string("BNB/USDT", title="Symbol 9")
symbol10 = input.string("AVAX/USDT", title="Symbol 10")
// RSI Calculations for custom symbols
rsi(symbol, timeframe) =>
request.security(symbol, timeframe, ta.rsi(source, rsiLength))
// RSI Calculations for timeframes (H1, H4, D1, W) for the custom symbols
rsi1H1 = rsi(symbol1, "60")
rsi2H1 = rsi(symbol2, "60")
rsi3H1 = rsi(symbol3, "60")
rsi4H1 = rsi(symbol4, "60")
rsi5H1 = rsi(symbol5, "60")
rsi6H1 = rsi(symbol6, "60")
rsi7H1 = rsi(symbol7, "60")
rsi8H1 = rsi(symbol8, "60")
rsi9H1 = rsi(symbol9, "60")
rsi10H1 = rsi(symbol10, "60")
rsi1H4 = rsi(symbol1, "240")
rsi2H4 = rsi(symbol2, "240")
rsi3H4 = rsi(symbol3, "240")
rsi4H4 = rsi(symbol4, "240")
rsi5H4 = rsi(symbol5, "240")
rsi6H4 = rsi(symbol6, "240")
rsi7H4 = rsi(symbol7, "240")
rsi8H4 = rsi(symbol8, "240")
rsi9H4 = rsi(symbol9, "240")
rsi10H4 = rsi(symbol10, "240")
rsi1D1 = rsi(symbol1, "D")
rsi2D1 = rsi(symbol2, "D")
rsi3D1 = rsi(symbol3, "D")
rsi4D1 = rsi(symbol4, "D")
rsi5D1 = rsi(symbol5, "D")
rsi6D1 = rsi(symbol6, "D")
rsi7D1 = rsi(symbol7, "D")
rsi8D1 = rsi(symbol8, "D")
rsi9D1 = rsi(symbol9, "D")
rsi10D1 = rsi(symbol10, "D")
rsi1W = rsi(symbol1, "W")
rsi2W = rsi(symbol2, "W")
rsi3W = rsi(symbol3, "W")
rsi4W = rsi(symbol4, "W")
rsi5W = rsi(symbol5, "W")
rsi6W = rsi(symbol6, "W")
rsi7W = rsi(symbol7, "W")
rsi8W = rsi(symbol8, "W")
rsi9W = rsi(symbol9, "W")
rsi10W = rsi(symbol10, "W")
// Alert levels
upperLevel = 80
lowerLevel = 30
// Table creation (adjusted size to fit 10 symbols and 4 timeframes)
var table rsiTable = table.new(position.top_right, 15, 5, border_width=1) // Added 10 rows for symbols, and 4 columns for timeframes
// Functions for RSI status and color
fun_rsiStatus(rsiValue) =>
if (rsiValue > upperLevel)
"Overbought"
else if (rsiValue < lowerLevel)
"Oversold"
else
"Neutral"
fun_rsiColor(rsiValue) =>
if (rsiValue > upperLevel)
color.new(color.red, 0)
else if (rsiValue < lowerLevel)
color.new(color.green, 0)
else
color.new(color.gray, 50)
fun_textColor() =>
color.new(color.white, 0)
// Update Table headers
table.cell(rsiTable, 0, 0, "Symbol", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 1, "H1 RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 2, "H4 RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 3, "D1 RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 4, "Weekly RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
// Display RSI for each symbol and timeframe
// Symbol 1
table.cell(rsiTable, 1, 0, symbol1, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 1, 1, str.tostring(rsi1H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1H1))
table.cell(rsiTable, 1, 2, str.tostring(rsi1H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1H4))
table.cell(rsiTable, 1, 3, str.tostring(rsi1D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1D1))
table.cell(rsiTable, 1, 4, str.tostring(rsi1W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1W))
// Symbol 2
table.cell(rsiTable, 2, 0, symbol2, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 2, 1, str.tostring(rsi2H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2H1))
table.cell(rsiTable, 2, 2, str.tostring(rsi2H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2H4))
table.cell(rsiTable, 2, 3, str.tostring(rsi2D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2D1))
table.cell(rsiTable, 2, 4, str.tostring(rsi2W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2W))
// Repeat for other symbols (3 to 10)...
// Symbol 3
table.cell(rsiTable, 3, 0, symbol3, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 3, 1, str.tostring(rsi3H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3H1))
table.cell(rsiTable, 3, 2, str.tostring(rsi3H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3H4))
table.cell(rsiTable, 3, 3, str.tostring(rsi3D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3D1))
table.cell(rsiTable, 3, 4, str.tostring(rsi3W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3W))
// Symbol 4
table.cell(rsiTable, 4, 0, symbol4, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 4, 1, str.tostring(rsi4H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4H1))
table.cell(rsiTable, 4, 2, str.tostring(rsi4H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4H4))
table.cell(rsiTable, 4, 3, str.tostring(rsi4D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4D1))
table.cell(rsiTable, 4, 4, str.tostring(rsi4W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4W))
// Symbol 5
table.cell(rsiTable, 5, 0, symbol5, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 5, 1, str.tostring(rsi5H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5H1))
table.cell(rsiTable, 5, 2, str.tostring(rsi5H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5H4))
table.cell(rsiTable, 5, 3, str.tostring(rsi5D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5D1))
table.cell(rsiTable, 5, 4, str.tostring(rsi5W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5W))
// Symbol 6
table.cell(rsiTable, 6, 0, symbol6, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 6, 1, str.tostring(rsi6H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6H1))
table.cell(rsiTable, 6, 2, str.tostring(rsi6H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6H4))
table.cell(rsiTable, 6, 3, str.tostring(rsi6D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6D1))
table.cell(rsiTable, 6, 4, str.tostring(rsi6W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6W))
// Symbol 7
table.cell(rsiTable, 7, 0, symbol7, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 7, 1, str.tostring(rsi7H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7H1))
table.cell(rsiTable, 7, 2, str.tostring(rsi7H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7H4))
table.cell(rsiTable, 7, 3, str.tostring(rsi7D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7D1))
table.cell(rsiTable, 7, 4, str.tostring(rsi7W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7W))
// Symbol 8
table.cell(rsiTable, 8, 0, symbol8, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 8, 1, str.tostring(rsi8H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8H1))
table.cell(rsiTable, 8, 2, str.tostring(rsi8H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8H4))
table.cell(rsiTable, 8, 3, str.tostring(rsi8D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8D1))
table.cell(rsiTable, 8, 4, str.tostring(rsi8W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8W))
// Symbol 9
table.cell(rsiTable, 9, 0, symbol9, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 9, 1, str.tostring(rsi9H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9H1))
table.cell(rsiTable, 9, 2, str.tostring(rsi9H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9H4))
table.cell(rsiTable, 9, 3, str.tostring(rsi9D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9D1))
table.cell(rsiTable, 9, 4, str.tostring(rsi9W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9W))
// Symbol 10
table.cell(rsiTable, 10, 0, symbol10, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 10, 1, str.tostring(rsi10H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10H1))
table.cell(rsiTable, 10, 2, str.tostring(rsi10H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10H4))
table.cell(rsiTable, 10, 3, str.tostring(rsi10D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10D1))
table.cell(rsiTable, 10, 4, str.tostring(rsi10W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10W))
RSI 10 mã thể hiện 4 khung thời gian//@version=6
indicator("Multi-Timeframe RSI with Divergence Alerts in Table", overlay=true)
// Inputs
rsiLength = input.int(14, title="RSI Length")
source = input.source(close, title="Source")
// Inputs for custom symbols (10 pairs)
symbol1 = input.string("BTC/USDT", title="Symbol 1")
symbol2 = input.string("ETH/USDT", title="Symbol 2")
symbol3 = input.string("LTC/USDT", title="Symbol 3")
symbol4 = input.string("XRP/USDT", title="Symbol 4")
symbol5 = input.string("ADA/USDT", title="Symbol 5")
symbol6 = input.string("SOL/USDT", title="Symbol 6")
symbol7 = input.string("DOGE/USDT", title="Symbol 7")
symbol8 = input.string("MATIC/USDT", title="Symbol 8")
symbol9 = input.string("BNB/USDT", title="Symbol 9")
symbol10 = input.string("AVAX/USDT", title="Symbol 10")
// RSI Calculations for custom symbols
rsi(symbol, timeframe) =>
request.security(symbol, timeframe, ta.rsi(source, rsiLength))
// RSI Calculations for timeframes (H1, H4, D1, W) for the custom symbols
rsi1H1 = rsi(symbol1, "60")
rsi2H1 = rsi(symbol2, "60")
rsi3H1 = rsi(symbol3, "60")
rsi4H1 = rsi(symbol4, "60")
rsi5H1 = rsi(symbol5, "60")
rsi6H1 = rsi(symbol6, "60")
rsi7H1 = rsi(symbol7, "60")
rsi8H1 = rsi(symbol8, "60")
rsi9H1 = rsi(symbol9, "60")
rsi10H1 = rsi(symbol10, "60")
rsi1H4 = rsi(symbol1, "240")
rsi2H4 = rsi(symbol2, "240")
rsi3H4 = rsi(symbol3, "240")
rsi4H4 = rsi(symbol4, "240")
rsi5H4 = rsi(symbol5, "240")
rsi6H4 = rsi(symbol6, "240")
rsi7H4 = rsi(symbol7, "240")
rsi8H4 = rsi(symbol8, "240")
rsi9H4 = rsi(symbol9, "240")
rsi10H4 = rsi(symbol10, "240")
rsi1D1 = rsi(symbol1, "D")
rsi2D1 = rsi(symbol2, "D")
rsi3D1 = rsi(symbol3, "D")
rsi4D1 = rsi(symbol4, "D")
rsi5D1 = rsi(symbol5, "D")
rsi6D1 = rsi(symbol6, "D")
rsi7D1 = rsi(symbol7, "D")
rsi8D1 = rsi(symbol8, "D")
rsi9D1 = rsi(symbol9, "D")
rsi10D1 = rsi(symbol10, "D")
rsi1W = rsi(symbol1, "W")
rsi2W = rsi(symbol2, "W")
rsi3W = rsi(symbol3, "W")
rsi4W = rsi(symbol4, "W")
rsi5W = rsi(symbol5, "W")
rsi6W = rsi(symbol6, "W")
rsi7W = rsi(symbol7, "W")
rsi8W = rsi(symbol8, "W")
rsi9W = rsi(symbol9, "W")
rsi10W = rsi(symbol10, "W")
// Alert levels
upperLevel = 80
lowerLevel = 30
// Table creation (adjusted size to fit 10 symbols and 4 timeframes)
var table rsiTable = table.new(position.top_right, 15, 5, border_width=1) // Added 10 rows for symbols, and 4 columns for timeframes
// Functions for RSI status and color
fun_rsiStatus(rsiValue) =>
if (rsiValue > upperLevel)
"Overbought"
else if (rsiValue < lowerLevel)
"Oversold"
else
"Neutral"
fun_rsiColor(rsiValue) =>
if (rsiValue > upperLevel)
color.new(color.red, 0)
else if (rsiValue < lowerLevel)
color.new(color.green, 0)
else
color.new(color.gray, 50)
fun_textColor() =>
color.new(color.white, 0)
// Update Table headers
table.cell(rsiTable, 0, 0, "Symbol", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 1, "H1 RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 2, "H4 RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 3, "D1 RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 4, "Weekly RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
// Display RSI for each symbol and timeframe
// Symbol 1
table.cell(rsiTable, 1, 0, symbol1, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 1, 1, str.tostring(rsi1H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1H1))
table.cell(rsiTable, 1, 2, str.tostring(rsi1H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1H4))
table.cell(rsiTable, 1, 3, str.tostring(rsi1D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1D1))
table.cell(rsiTable, 1, 4, str.tostring(rsi1W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1W))
// Symbol 2
table.cell(rsiTable, 2, 0, symbol2, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 2, 1, str.tostring(rsi2H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2H1))
table.cell(rsiTable, 2, 2, str.tostring(rsi2H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2H4))
table.cell(rsiTable, 2, 3, str.tostring(rsi2D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2D1))
table.cell(rsiTable, 2, 4, str.tostring(rsi2W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2W))
// Repeat for other symbols (3 to 10)...
// Symbol 3
table.cell(rsiTable, 3, 0, symbol3, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 3, 1, str.tostring(rsi3H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3H1))
table.cell(rsiTable, 3, 2, str.tostring(rsi3H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3H4))
table.cell(rsiTable, 3, 3, str.tostring(rsi3D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3D1))
table.cell(rsiTable, 3, 4, str.tostring(rsi3W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3W))
// Symbol 4
table.cell(rsiTable, 4, 0, symbol4, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 4, 1, str.tostring(rsi4H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4H1))
table.cell(rsiTable, 4, 2, str.tostring(rsi4H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4H4))
table.cell(rsiTable, 4, 3, str.tostring(rsi4D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4D1))
table.cell(rsiTable, 4, 4, str.tostring(rsi4W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4W))
// Symbol 5
table.cell(rsiTable, 5, 0, symbol5, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 5, 1, str.tostring(rsi5H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5H1))
table.cell(rsiTable, 5, 2, str.tostring(rsi5H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5H4))
table.cell(rsiTable, 5, 3, str.tostring(rsi5D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5D1))
table.cell(rsiTable, 5, 4, str.tostring(rsi5W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5W))
// Symbol 6
table.cell(rsiTable, 6, 0, symbol6, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 6, 1, str.tostring(rsi6H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6H1))
table.cell(rsiTable, 6, 2, str.tostring(rsi6H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6H4))
table.cell(rsiTable, 6, 3, str.tostring(rsi6D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6D1))
table.cell(rsiTable, 6, 4, str.tostring(rsi6W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6W))
// Symbol 7
table.cell(rsiTable, 7, 0, symbol7, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 7, 1, str.tostring(rsi7H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7H1))
table.cell(rsiTable, 7, 2, str.tostring(rsi7H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7H4))
table.cell(rsiTable, 7, 3, str.tostring(rsi7D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7D1))
table.cell(rsiTable, 7, 4, str.tostring(rsi7W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7W))
// Symbol 8
table.cell(rsiTable, 8, 0, symbol8, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 8, 1, str.tostring(rsi8H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8H1))
table.cell(rsiTable, 8, 2, str.tostring(rsi8H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8H4))
table.cell(rsiTable, 8, 3, str.tostring(rsi8D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8D1))
table.cell(rsiTable, 8, 4, str.tostring(rsi8W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8W))
// Symbol 9
table.cell(rsiTable, 9, 0, symbol9, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 9, 1, str.tostring(rsi9H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9H1))
table.cell(rsiTable, 9, 2, str.tostring(rsi9H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9H4))
table.cell(rsiTable, 9, 3, str.tostring(rsi9D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9D1))
table.cell(rsiTable, 9, 4, str.tostring(rsi9W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9W))
// Symbol 10
table.cell(rsiTable, 10, 0, symbol10, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 10, 1, str.tostring(rsi10H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10H1))
table.cell(rsiTable, 10, 2, str.tostring(rsi10H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10H4))
table.cell(rsiTable, 10, 3, str.tostring(rsi10D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10D1))
table.cell(rsiTable, 10, 4, str.tostring(rsi10W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10W))
RSI 10 mã thể hiện 4 khung thời gian//@version=6
indicator("Multi-Timeframe RSI with Divergence Alerts in Table", overlay=true)
// Inputs
rsiLength = input.int(14, title="RSI Length")
source = input.source(close, title="Source")
// Inputs for custom symbols (10 pairs)
symbol1 = input.string("BTC/USDT", title="Symbol 1")
symbol2 = input.string("ETH/USDT", title="Symbol 2")
symbol3 = input.string("LTC/USDT", title="Symbol 3")
symbol4 = input.string("XRP/USDT", title="Symbol 4")
symbol5 = input.string("ADA/USDT", title="Symbol 5")
symbol6 = input.string("SOL/USDT", title="Symbol 6")
symbol7 = input.string("DOGE/USDT", title="Symbol 7")
symbol8 = input.string("MATIC/USDT", title="Symbol 8")
symbol9 = input.string("BNB/USDT", title="Symbol 9")
symbol10 = input.string("AVAX/USDT", title="Symbol 10")
// RSI Calculations for custom symbols
rsi(symbol, timeframe) =>
request.security(symbol, timeframe, ta.rsi(source, rsiLength))
// RSI Calculations for timeframes (H1, H4, D1, W) for the custom symbols
rsi1H1 = rsi(symbol1, "60")
rsi2H1 = rsi(symbol2, "60")
rsi3H1 = rsi(symbol3, "60")
rsi4H1 = rsi(symbol4, "60")
rsi5H1 = rsi(symbol5, "60")
rsi6H1 = rsi(symbol6, "60")
rsi7H1 = rsi(symbol7, "60")
rsi8H1 = rsi(symbol8, "60")
rsi9H1 = rsi(symbol9, "60")
rsi10H1 = rsi(symbol10, "60")
rsi1H4 = rsi(symbol1, "240")
rsi2H4 = rsi(symbol2, "240")
rsi3H4 = rsi(symbol3, "240")
rsi4H4 = rsi(symbol4, "240")
rsi5H4 = rsi(symbol5, "240")
rsi6H4 = rsi(symbol6, "240")
rsi7H4 = rsi(symbol7, "240")
rsi8H4 = rsi(symbol8, "240")
rsi9H4 = rsi(symbol9, "240")
rsi10H4 = rsi(symbol10, "240")
rsi1D1 = rsi(symbol1, "D")
rsi2D1 = rsi(symbol2, "D")
rsi3D1 = rsi(symbol3, "D")
rsi4D1 = rsi(symbol4, "D")
rsi5D1 = rsi(symbol5, "D")
rsi6D1 = rsi(symbol6, "D")
rsi7D1 = rsi(symbol7, "D")
rsi8D1 = rsi(symbol8, "D")
rsi9D1 = rsi(symbol9, "D")
rsi10D1 = rsi(symbol10, "D")
rsi1W = rsi(symbol1, "W")
rsi2W = rsi(symbol2, "W")
rsi3W = rsi(symbol3, "W")
rsi4W = rsi(symbol4, "W")
rsi5W = rsi(symbol5, "W")
rsi6W = rsi(symbol6, "W")
rsi7W = rsi(symbol7, "W")
rsi8W = rsi(symbol8, "W")
rsi9W = rsi(symbol9, "W")
rsi10W = rsi(symbol10, "W")
// Alert levels
upperLevel = 80
lowerLevel = 30
// Table creation (adjusted size to fit 10 symbols and 4 timeframes)
var table rsiTable = table.new(position.top_right, 15, 5, border_width=1) // Added 10 rows for symbols, and 4 columns for timeframes
// Functions for RSI status and color
fun_rsiStatus(rsiValue) =>
if (rsiValue > upperLevel)
"Overbought"
else if (rsiValue < lowerLevel)
"Oversold"
else
"Neutral"
fun_rsiColor(rsiValue) =>
if (rsiValue > upperLevel)
color.new(color.red, 0)
else if (rsiValue < lowerLevel)
color.new(color.green, 0)
else
color.new(color.gray, 50)
fun_textColor() =>
color.new(color.white, 0)
// Update Table headers
table.cell(rsiTable, 0, 0, "Symbol", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 1, "H1 RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 2, "H4 RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 3, "D1 RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
table.cell(rsiTable, 0, 4, "Weekly RSI", text_color=fun_textColor(), bgcolor=color.new(color.gray, 70))
// Display RSI for each symbol and timeframe
// Symbol 1
table.cell(rsiTable, 1, 0, symbol1, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 1, 1, str.tostring(rsi1H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1H1))
table.cell(rsiTable, 1, 2, str.tostring(rsi1H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1H4))
table.cell(rsiTable, 1, 3, str.tostring(rsi1D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1D1))
table.cell(rsiTable, 1, 4, str.tostring(rsi1W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi1W))
// Symbol 2
table.cell(rsiTable, 2, 0, symbol2, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 2, 1, str.tostring(rsi2H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2H1))
table.cell(rsiTable, 2, 2, str.tostring(rsi2H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2H4))
table.cell(rsiTable, 2, 3, str.tostring(rsi2D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2D1))
table.cell(rsiTable, 2, 4, str.tostring(rsi2W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi2W))
// Repeat for other symbols (3 to 10)...
// Symbol 3
table.cell(rsiTable, 3, 0, symbol3, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 3, 1, str.tostring(rsi3H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3H1))
table.cell(rsiTable, 3, 2, str.tostring(rsi3H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3H4))
table.cell(rsiTable, 3, 3, str.tostring(rsi3D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3D1))
table.cell(rsiTable, 3, 4, str.tostring(rsi3W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi3W))
// Symbol 4
table.cell(rsiTable, 4, 0, symbol4, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 4, 1, str.tostring(rsi4H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4H1))
table.cell(rsiTable, 4, 2, str.tostring(rsi4H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4H4))
table.cell(rsiTable, 4, 3, str.tostring(rsi4D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4D1))
table.cell(rsiTable, 4, 4, str.tostring(rsi4W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi4W))
// Symbol 5
table.cell(rsiTable, 5, 0, symbol5, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 5, 1, str.tostring(rsi5H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5H1))
table.cell(rsiTable, 5, 2, str.tostring(rsi5H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5H4))
table.cell(rsiTable, 5, 3, str.tostring(rsi5D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5D1))
table.cell(rsiTable, 5, 4, str.tostring(rsi5W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi5W))
// Symbol 6
table.cell(rsiTable, 6, 0, symbol6, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 6, 1, str.tostring(rsi6H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6H1))
table.cell(rsiTable, 6, 2, str.tostring(rsi6H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6H4))
table.cell(rsiTable, 6, 3, str.tostring(rsi6D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6D1))
table.cell(rsiTable, 6, 4, str.tostring(rsi6W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi6W))
// Symbol 7
table.cell(rsiTable, 7, 0, symbol7, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 7, 1, str.tostring(rsi7H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7H1))
table.cell(rsiTable, 7, 2, str.tostring(rsi7H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7H4))
table.cell(rsiTable, 7, 3, str.tostring(rsi7D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7D1))
table.cell(rsiTable, 7, 4, str.tostring(rsi7W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi7W))
// Symbol 8
table.cell(rsiTable, 8, 0, symbol8, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 8, 1, str.tostring(rsi8H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8H1))
table.cell(rsiTable, 8, 2, str.tostring(rsi8H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8H4))
table.cell(rsiTable, 8, 3, str.tostring(rsi8D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8D1))
table.cell(rsiTable, 8, 4, str.tostring(rsi8W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi8W))
// Symbol 9
table.cell(rsiTable, 9, 0, symbol9, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 9, 1, str.tostring(rsi9H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9H1))
table.cell(rsiTable, 9, 2, str.tostring(rsi9H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9H4))
table.cell(rsiTable, 9, 3, str.tostring(rsi9D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9D1))
table.cell(rsiTable, 9, 4, str.tostring(rsi9W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi9W))
// Symbol 10
table.cell(rsiTable, 10, 0, symbol10, text_color=fun_textColor(), bgcolor=color.new(color.gray, 50))
table.cell(rsiTable, 10, 1, str.tostring(rsi10H1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10H1))
table.cell(rsiTable, 10, 2, str.tostring(rsi10H4, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10H4))
table.cell(rsiTable, 10, 3, str.tostring(rsi10D1, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10D1))
table.cell(rsiTable, 10, 4, str.tostring(rsi10W, "#.##"), text_color=color.new(color.white, 0), bgcolor=fun_rsiColor(rsi10W))
GT's Opening Price LineDraws one opening price line from the timeframe that you select. You're Welcome and may your trading never be the same.
GT's Opening Price LineDraws one opening price line from the timeframe that you select. You're Welcome and may your trading never be the same.
SMA PersonalThis script provides a simple way to calculate and display a Simple Moving Average on your chart with flexibility in selecting input parameters.
MA Crossover with Alerts (by Ismat)Bu Pine Script kodi "MA Crossover with Alerts" nomli indikatorni yaratadi, bu ikkita oddiy o'rtacha (MA 5 va MA 13) chiziqlarining kesishuvini kuzatib, xarid va sotish signalini ko'rsatadi
created by Ismat Barotov Latipovich
XSR v6XSR v6 - Comprehensive Price Action and Level Analysis Indicator
Authored by nanoinvestor, the XSR v6 indicator is a powerful tool designed to empower traders with an in-depth understanding of price action, support/resistance zones, and mid-level dynamics. This tool provides advanced functionalities and high customizability to adapt to diverse trading strategies.
Core Functionalities
Dynamic High-Low Identification
Precisely calculates recent high and low levels using customizable bar-back periods and depth settings.
Automatically adapts to changing market conditions by pinpointing the most relevant swing points.
Mid-Level Calculations
Includes up to 7 mid-levels derived from Fibonacci ratios, allowing traders to analyze potential retracement and extension levels.
Optional inversion and logarithmic scaling provide additional flexibility for advanced analytical needs.
Support & Resistance Zones
Automatically draws clear and color-coded support and resistance boxes on the chart.
These zones are based on calculated high/low levels, providing actionable insights for trade entries or exits.
Visual Customization
Customizable line colors, styles, widths, and extensions to enhance chart readability.
Option to extend lines for historical context or focus only on the current price action.
Daily Change Table
Displays the daily percentage change of the selected asset in a clean and intuitive table format.
Positive and negative changes are color-coded for quick interpretation.
Advanced Data Inputs
Supports multiple data sources (High/Low, Open, Close, HL2, HLC3) for range calculation.
Includes the option to use Heikin-Ashi candles for smoother price analysis.
Why Use XSR v6?
Strategic Decision-Making: Ideal for swing and intraday traders aiming to identify critical price levels for potential breakout or retracement scenarios.
Customizability: Offers highly flexible settings, including mid-level adjustments, logarithmic scaling, and Heikin-Ashi integration, to suit individual trading styles.
User-Friendly Design: Combines advanced algorithms with visually intuitive elements, ensuring clarity and ease of use for traders of all levels.
Additional Features
High-Low Offset Control: Fine-tune offset periods to refine support and resistance calculations.
Break Detection: Configurable option to stop calculations at the first significant swing for quicker level identification.
Color Customization: Adjust colors for resistance, support, and mid-levels for a tailored chart experience.
The XSR v6 indicator is a must-have tool for traders looking for precision, flexibility, and actionable insights in today’s fast-paced markets. Whether you are a beginner or an experienced trader, this indicator will enhance your market analysis and decision-making process.
ffejokrap indicatorDip buys with adds self testing indicator, test 1
sladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdksladkalsdkv
Volume and Bollinger Band Arrow IndicatorThis is an indicator that is marked with arrows when the candle has a high volume despite its small size
It works when the candle touches the bolinger band (20, 2) at least once, and may be modified or added later
Volume and Bollinger Band Arrow IndicatorThis is an indicator that is marked with arrows when the candle has a high volume despite its small size
It works when the candle touches the bolinger band (20, 2) at least once, and may be modified or added later
ATR Multi-Timeframe (Trend Direction + Current Levels) Indicator Name
ATR Multi-Timeframe (Trend Direction + Current Levels)
Description
This indicator helps you visualize support and resistance levels based on the Average True Range (ATR) and track the current trend direction across multiple timeframes (daily, weekly, and monthly). It is a valuable tool for traders looking to enhance decision-making and market volatility analysis.
Key Features
Multi-Timeframe ATR Analysis:
Calculates the Average True Range (ATR) and True Range (TR) for daily, weekly, and monthly timeframes.
Trend Direction Indicators:
Displays trend direction using arrows (▲ for uptrend, ▼ for downtrend) with color-coded labels (green for uptrend, red for downtrend).
Support and Resistance Levels:
Dynamically calculates trend levels (Open ± ATR) and opposite levels for each timeframe.
Persistent lines extend these levels into the future for better visualization.
Customizable Settings:
Toggle visibility of daily, weekly, and monthly levels.
Adjust line width and colors for each timeframe.
Summary Table:
Displays a compact table showing ATR percentages, TR percentages, and trend direction for all timeframes.
Why Use This Indicator?
Quickly identify key support and resistance levels across different timeframes.
Understand market volatility through ATR-based levels.
Spot trends and reversals with easy-to-read visual elements.
How to Use:
Add the indicator to your chart.
Enable or disable specific timeframes (Daily, Weekly, Monthly) in the settings.
Adjust line styles and colors to match your preferences.
Use the displayed levels to plan entry/exit points or manage risk.
This indicator is perfect for both swing and intraday traders who want a clear and dynamic view of volatility and trend across multiple timeframes.